@@ -14,8 +14,7 @@ CC_TLS_K=cc-control-login-tls
14
14
# # Ingress names
15
15
CC_ING_A=control-center
16
16
CC_ING_K=control-center-keycloak-ingress
17
- # # K8s cluster and namespace
18
- CC_CLUSTER=cc-cluster
17
+ # Namespace used for CC
19
18
CC_NS=control-center
20
19
21
20
# # UI tests to run after the control-center is installed
@@ -86,6 +85,7 @@ getTLs() {
86
85
}
87
86
88
87
checkTls () {
88
+ [ -n " $TEST " ] && return 0
89
89
log " Checking TLS certificates for all ingresses hosted in the cluster"
90
90
[ -n " $TEST " -o -n " $SKIPHELM " ] && return 0
91
91
for i in ` kubectl get ingresses -n $CC_NS | grep nginx | awk ' {print $1}' ` ; do
@@ -97,6 +97,7 @@ reloadIngress() {
97
97
[ -n " $TEST " ] && return 0
98
98
pod=` kubectl -n $CC_NS get pods | grep control-center-ingress-nginx-controller | awk ' {print $1}' ` || return 1
99
99
[ -n " $pod " ] && runCmd " $TEST " " Reloading nginx in $pod " " kubectl exec $pod -n " $CC_NS " -- nginx -s reload" || return 1
100
+ [ -z " $TEST " ] && sleep 3
100
101
}
101
102
102
103
# # Configure secrets for the control-center and the keycloak servers
@@ -155,12 +156,11 @@ runPwTests() {
155
156
if [ " $f " = cc-install-apps.js ]; then
156
157
reloadIngress && checkTls || return 1
157
158
fi
158
- sleep 3
159
159
done
160
160
}
161
161
162
162
setClusterContext () {
163
- [ " $1 " = " $CC_CLUSTER " ] && current=kind-$1 || current=$1
163
+ [ " $1 " = " $KIND_CLUSTER " ] && current=kind-$1 || current=$1
164
164
ns=$2
165
165
H=` kubectl config get-contexts | tr ' *' ' ' | awk ' {print $1}' | egrep " ^$current $" `
166
166
[ -z " $H " ] && log " Cluster $current not found in kubectl contexts" && return 1
@@ -173,13 +173,13 @@ setClusterContext() {
173
173
174
174
# # Main method for running control center
175
175
runControlCenter () {
176
- CLUSTER=${CLUSTER:- $CC_CLUSTER }
176
+ CLUSTER=${CLUSTER:- $KIND_CLUSTER }
177
177
178
178
checkCommands docker kubectl helm unzip || return 1
179
179
checkDockerRunning || return 1
180
180
181
181
# # Start a new kind cluster if needed
182
- [ " $CLUSTER " != " $CC_CLUSTER " ] || createKindCluster $CC_CLUSTER $CC_NS || return 1
182
+ [ " $CLUSTER " != " $KIND_CLUSTER " ] || createKindCluster $CLUSTER $CC_NS || return 1
183
183
184
184
# # Set the context to the cluster
185
185
setClusterContext " $CLUSTER " " $CC_NS " || return 1
@@ -199,15 +199,17 @@ runControlCenter() {
199
199
installTls && checkTls || return 1
200
200
201
201
# # Forward the ingress (it needs root access since it uses port 443)
202
- # checkBusyPort "443"
203
- checkPort 443 || forwardIngress $CC_NS || return 1
202
+ # checkPort "443"
203
+ [ " $CLUSTER " != " $KIND_CLUSTER " ] || forwardIngress $CC_NS || return 1
204
204
205
205
# # Run Playwright tests for the control-center
206
206
runPwTests || return 1
207
- if [ -z " $TEST " -a -z " $KEEPCC " ]; then
208
- stopForwardIngress || return 1
209
- [ " $CLUSTER " != " $CC_CLUSTER " ] || deleteKindCluster $CC_CLUSTER || return 1
210
- fi
207
+ stopForwardIngress || return 1
208
+
209
+ # # Delete the KinD cluster if it was created in this test
210
+ [ -n " $TEST " -o -n " $KEEPCC " -o " $CLUSTER " != " $KIND_CLUSTER " ] || deleteKindCluster " $CLUSTER " || return 1
211
+ [ -n " $TEST " -o -n " $KEEPCC " -o " $CLUSTER " = " $KIND_CLUSTER " ] || uninstallCC || return 1
212
+
211
213
return 0
212
214
}
213
215
0 commit comments