@@ -18,7 +18,7 @@ function join_by {
18
18
# default to randomly generated namespace, same as chart-testing would do, but we need to load secrets into the same namespace
19
19
NAMESPACE=trino-$( LC_ALL=C tr -dc ' a-z0-9' < /dev/urandom | head -c 6 || true)
20
20
HELM_EXTRA_SET_ARGS=
21
- CT_ARGS=(--charts=charts/trino)
21
+ CT_ARGS=(--charts=charts/trino --skip-clean-up )
22
22
CLEANUP_NAMESPACE=true
23
23
TEST_NAMES=(" ${! testCases[@]} " )
24
24
@@ -47,7 +47,6 @@ while getopts ":a:n:t:sh:" OPTKEY; do
47
47
IFS=, read -ra TEST_NAMES <<< " $OPTARG"
48
48
;;
49
49
s)
50
- CT_ARGS+=(--skip-clean-up)
51
50
CLEANUP_NAMESPACE=false
52
51
;;
53
52
h)
@@ -65,7 +64,7 @@ shift $((OPTIND - 1))
65
64
SCRIPT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " > /dev/null 2>&1 && pwd) "
66
65
cd " ${SCRIPT_DIR} " || exit 2
67
66
68
- echo " Generating a self-signed TLS certificate"
67
+ echo 1>&2 " Generating a self-signed TLS certificate"
69
68
openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 \
70
69
-subj " /O=Trino Software Foundation" \
71
70
-addext " subjectAltName=DNS:localhost,DNS:*.$NAMESPACE ,DNS:*.$NAMESPACE .svc,DNS:*.$NAMESPACE .svc.cluster.local,IP:127.0.0.1" \
@@ -76,14 +75,29 @@ kubectl -n "$NAMESPACE" create secret tls certificates --cert=cert.crt --key=cer
76
75
77
76
CT_ARGS+=(--namespace " $NAMESPACE " )
78
77
78
+ result=0
79
79
for test_name in " ${TEST_NAMES[@]} " ; do
80
- echo " "
81
- echo " 🧪 Running test $test_name "
82
- echo " "
83
- time ct install " ${CT_ARGS[@]} " --helm-extra-set-args " $HELM_EXTRA_SET_ARGS ${testCases[$test_name]} "
84
- echo " Test $test_name completed"
80
+ echo 1>&2 " "
81
+ echo 1>&2 " 🧪 Running test $test_name "
82
+ echo 1>&2 " "
83
+ if ! time ct install " ${CT_ARGS[@]} " --helm-extra-set-args " $HELM_EXTRA_SET_ARGS ${testCases[$test_name]} " ; then
84
+ echo 1>&2 " ❌ Test $test_name failed"
85
+ echo 1>&2 " Test logs:"
86
+ kubectl --namespace " $NAMESPACE " logs --tail=-1 --selector app.kubernetes.io/component=test
87
+ result=1
88
+ else
89
+ echo 1>&2 " ✅ Test $test_name completed"
90
+ fi
91
+ if [ " $CLEANUP_NAMESPACE " == " true" ]; then
92
+ for release in $( helm --namespace " $NAMESPACE " ls --all --short) ; do
93
+ echo 1>&2 " Cleaning up Helm release $release "
94
+ helm --namespace " $NAMESPACE " delete " $release "
95
+ done
96
+ fi
85
97
done
86
98
87
99
if [ " $CLEANUP_NAMESPACE " == " true" ]; then
88
100
kubectl delete namespace " $NAMESPACE "
89
101
fi
102
+
103
+ exit $result
0 commit comments