@@ -30,38 +30,16 @@ export ANSIBLE_BECOME_USER=root
30
30
if [[ " ${TESTCASE} " =~ " collection" ]]; then
31
31
# Build and install collection
32
32
ansible-galaxy collection build
33
- ansible-galaxy collection install kubernetes_sigs-kubespray-$( grep " ^version:" galaxy.yml | awk ' {print $2}' ) .tar.gz
34
-
35
- # Simply remove all of our files and directories except for our tests directory
36
- # to be absolutely certain that none of our playbooks or roles
37
- # are interfering with our collection
38
- find -mindepth 1 -maxdepth 1 ! -regex ' ./\(tests\|inventory\)' -exec rm -rfv {} +
39
-
40
- cat > cluster.yml << EOF
41
- - name: Install Kubernetes
42
- ansible.builtin.import_playbook: kubernetes_sigs.kubespray.cluster
43
- EOF
44
-
45
- cat > upgrade-cluster.yml << EOF
46
- - name: Install Kubernetes
47
- ansible.builtin.import_playbook: kubernetes_sigs.kubespray.upgrade-cluster
48
- EOF
49
-
50
- cat > reset.yml << EOF
51
- - name: Remove Kubernetes
52
- ansible.builtin.import_playbook: kubernetes_sigs.kubespray.reset
53
- EOF
54
-
55
- cat > remove-node.yml << EOF
56
- - name: Remove node from Kubernetes
57
- ansible.builtin.import_playbook: kubernetes_sigs.kubespray.remove_node
58
- EOF
59
-
33
+ ansible-galaxy collection install kubernetes_sigs-kubespray-* .tar.gz
60
34
fi
61
-
62
35
run_playbook () {
63
- playbook=$1
36
+ if [[ " ${TESTCASE} " =~ " collection" ]]; then
37
+ playbook=kubernetes_sigs.kubespray.$1
38
+ else
39
+ playbook=$1 .yml
40
+ fi
64
41
shift
42
+
65
43
ansible-playbook \
66
44
-e @tests/common_vars.yml \
67
45
-e @tests/${TESTCASE_FILE} \
@@ -71,11 +49,10 @@ ansible-playbook \
71
49
}
72
50
73
51
74
-
75
52
# # START KUBESPRAY
76
53
77
54
# Create cluster
78
- run_playbook cluster.yml
55
+ run_playbook cluster
79
56
80
57
# Repeat deployment if testing upgrade
81
58
if [ " ${UPGRADE_TEST} " != " false" ]; then
@@ -85,10 +62,10 @@ if [ "${UPGRADE_TEST}" != "false" ]; then
85
62
86
63
case " ${UPGRADE_TEST} " in
87
64
" basic" )
88
- run_playbook cluster.yml
65
+ run_playbook cluster
89
66
;;
90
67
" graceful" )
91
- run_playbook upgrade-cluster.yml
68
+ run_playbook upgrade-cluster
92
69
;;
93
70
* )
94
71
;;
97
74
98
75
# Test control plane recovery
99
76
if [ " ${RECOVER_CONTROL_PLANE_TEST} " != " false" ]; then
100
- run_playbook reset.yml --limit " ${RECOVER_CONTROL_PLANE_TEST_GROUPS} " -e reset_confirmation=yes
101
- run_playbook recover-control-plane.yml -e etcd_retries=10 --limit " etcd:kube_control_plane"
102
- fi
103
-
104
- # Tests Cases
105
- # # Test Control Plane API
106
- run_playbook tests/testcases/010_check-apiserver.yml
107
- run_playbook tests/testcases/015_check-nodes-ready.yml
108
-
109
- # # Test that all nodes are Ready
110
-
111
- if [[ ! ( " $TESTCASE " =~ " macvlan" ) ]]; then
112
- run_playbook tests/testcases/020_check-pods-running.yml
113
- run_playbook tests/testcases/030_check-network.yml
114
- if [[ ! ( " $TESTCASE " =~ " hardening" ) ]]; then
115
- # TODO: We need to remove this condition by finding alternative container
116
- # image instead of netchecker which doesn't work at hardening environments.
117
- run_playbook tests/testcases/040_check-network-adv.yml
118
- fi
77
+ run_playbook reset --limit " ${RECOVER_CONTROL_PLANE_TEST_GROUPS} " -e reset_confirmation=yes
78
+ run_playbook recover-control-plane -e etcd_retries=10 --limit " etcd:kube_control_plane"
119
79
fi
120
80
121
- # # Kubernetes conformance tests
122
- run_playbook tests/testcases/100_check-k8s-conformance.yml
81
+ # Run tests
82
+ ansible-playbook \
83
+ -e @tests/common_vars.yml \
84
+ -e @tests/${TESTCASE_FILE} \
85
+ -e local_release_dir=${PWD} /downloads \
86
+ tests/testcases/tests.yml
123
87
124
88
# Test node removal procedure
125
89
if [ " ${REMOVE_NODE_CHECK} " = " true" ]; then
126
- run_playbook remove-node.yml -e skip_confirmation=yes -e node=${REMOVE_NODE_NAME}
90
+ run_playbook remove-node -e skip_confirmation=yes -e node=${REMOVE_NODE_NAME}
127
91
fi
128
92
129
93
# Clean up at the end, this is to allow stage1 tests to include cleanup test
130
94
if [ " ${RESET_CHECK} " = " true" ]; then
131
- run_playbook reset.yml -e reset_confirmation=yes
95
+ run_playbook reset -e reset_confirmation=yes
132
96
fi
0 commit comments