@@ -36,7 +36,7 @@ set -o pipefail
36
36
script=" ${BASH_SOURCE[0]} "
37
37
scriptDir=" $( cd " $( dirname " ${script} " ) " && pwd ) "
38
38
39
- function usage {
39
+ usage () {
40
40
echo " usage: ${script} [-v <version>] [-n <name>] [-s] [-o <directory>] [-t <tests>] [-c <name>] [-p true|false] [-x <number_of_threads>] [-d <wdt_download_url>] [-i <wit_download_url>] [-l <wle_download_url>] [-m <maven_profile_name>] [-h]"
41
41
echo " -v Kubernetes version (optional) "
42
42
echo " (default: 1.16, supported values depend on the kind version. See kindversions.properties) "
@@ -65,7 +65,7 @@ function usage {
65
65
exit $1
66
66
}
67
67
68
- function captureLogs {
68
+ captureLogs () {
69
69
echo " Capture Kind logs..."
70
70
mkdir " ${RESULT_ROOT} /kubelogs"
71
71
kind export logs " ${RESULT_ROOT} /kubelogs" --name " ${kind_name} " --verbosity 99
@@ -121,7 +121,7 @@ while getopts "v:n:o:t:c:x:p:d:i:l:m:sh" opt; do
121
121
esac
122
122
done
123
123
124
- function versionprop {
124
+ versionprop () {
125
125
grep " ${1} _${2} =" " ${scriptDir} /kindversions.properties" | cut -d' =' -f2
126
126
}
127
127
@@ -201,11 +201,16 @@ esac
201
201
202
202
echo ' Create registry container unless it already exists'
203
203
running=" $( docker inspect -f ' {{.State.Running}}' " ${reg_name} " 2> /dev/null || true) "
204
- if [ " ${running} " != ' true' ]; then
205
- docker run \
206
- -d --restart=always -p " 127.0.0.1:${reg_port} :5000" --name " ${reg_name} " \
207
- registry:2
204
+ if [ " ${running} " = ' false' ]; then
205
+ docker rm --force " ${reg_name} "
208
206
fi
207
+ if [ " ${running} " = ' true' ]; then
208
+ docker stop " ${reg_name} "
209
+ docker rm --force " ${reg_name} "
210
+ fi
211
+ docker run \
212
+ -d --restart=always -p " 127.0.0.1:${reg_port} :5000" --name " ${reg_name} " \
213
+ registry:2
209
214
210
215
reg_host=" ${reg_name} "
211
216
if [ " ${kind_network} " = " bridge" ]; then
@@ -303,6 +308,7 @@ echo 'Clean up result root...'
303
308
rm -rf " ${RESULT_ROOT:? } /*"
304
309
305
310
echo " Run tests..."
311
+
306
312
if [ " ${test_filter} " != " **/It*" ]; then
307
313
echo " Running mvn -Dit.test=${test_filter} -Dwdt.download.url=${wdt_download_url} -Dwit.download.url=${wit_download_url} -Dwle.download.url=${wle_download_url} -DPARALLEL_CLASSES=${parallel_run} -DNUMBER_OF_THREADS=${threads} -pl integration-tests -P ${maven_profile_name} verify"
308
314
time mvn -Dit.test=" ${test_filter} " -Dwdt.download.url=" ${wdt_download_url} " -Dwit.download.url=" ${wit_download_url} " -Dwle.download.url=" ${wle_download_url} " -DPARALLEL_CLASSES=" ${parallel_run} " -DNUMBER_OF_THREADS=" ${threads} " -pl integration-tests -P ${maven_profile_name} verify 2>&1 | tee " ${RESULT_ROOT} /kindtest.log" || captureLogs
319
325
echo " Collect journalctl logs"
320
326
docker exec kind-worker journalctl --utc --dmesg --system > " ${RESULT_ROOT} /journalctl-kind-worker.out"
321
327
docker exec kind-control-plane journalctl --utc --dmesg --system > " ${RESULT_ROOT} /journalctl-kind-control-plane.out"
328
+
329
+ echo " Destroy cluster and registry"
330
+ kind delete cluster --name " ${kind_name} "
331
+ docker stop " ${reg_name} "
332
+ docker rm --force " ${reg_name} "
0 commit comments