-
Notifications
You must be signed in to change notification settings - Fork 49
/
check-patch.e2e-kubemacpool-functests.sh
executable file
·60 lines (47 loc) · 2.08 KB
/
check-patch.e2e-kubemacpool-functests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash -xe
# This script should be able to execute KubeMacPool
# functional tests against Kubernetes cluster with
# CNAO built with latest changes, on any
# environment with basic dependencies listed in
# check-patch.packages installed and docker running.
#
# yum -y install automation/check-patch.packages
# automation/check-patch.e2e-kubemacpool-functests.sh
function __get_skipped_tests() {
local __resultvar=$1
local skipped_regex=""
# We can't test all KMP opt-mode CNAO context, as the operator will reconcile
# back to the configured opt-mode when the test tries to change it.
# So we check KMP webhook's opt-mode and skip tests accordingly
if grep 'default/mutatevirtualmachines_opt_out_patch.yaml' hack/components/bump-kubemacpool.sh; then
echo "KMP VM webhook is set to opt-out mode. Skipping opt-in Context"
skipped_regex="${skipped_regex} \(opt-in\smode\)"
elif grep 'default/mutatevirtualmachines_opt_in_patch.yaml' hack/components/bump-kubemacpool.sh; then
echo "KMP VM webhook is set to opt-in mode. Skipping opt-out Context"
skipped_regex="${skipped_regex} \(opt-out\smode\)"
fi
eval $__resultvar="'$skipped_regex'"
}
teardown() {
rm -rf "${TMP_COMPONENT_PATH}"
cd ${TMP_PROJECT_PATH}
make cluster-down
}
main() {
# Setup CNAO and artifacts temp directory
source automation/check-patch.setup.sh
cd ${TMP_PROJECT_PATH}
# Spin-up ephemeral cluster with latest CNAO
# this script also exports KUBECONFIG, and fetch $COMPONENT repository
COMPONENT="kubemacpool" source automation/components-functests.setup.sh
trap teardown EXIT
echo "Deploy KubeVirt latest stable release"
./hack/deploy-kubevirt.sh
echo "Get skip tests regex"
__get_skipped_tests SKIPPED_TESTS
# Run KubeMacPool functional tests
cd ${TMP_COMPONENT_PATH}
export CLUSTER_ROOT_DIRECTORY=${TMP_PROJECT_PATH}
KUBECONFIG=${KUBECONFIG} make E2E_TEST_EXTRA_ARGS="-ginkgo.noColor -test.outputdir=$ARTIFACTS --ginkgo.junit-report=$ARTIFACTS/junit.functest.xml --ginkgo.skip $SKIPPED_TESTS" functest
}
[[ "${BASH_SOURCE[0]}" == "$0" ]] && main "$@"