@@ -19,7 +19,7 @@ function join_by {
1919# default to randomly generated namespace, same as chart-testing would do, but we need to load secrets into the same namespace
2020NAMESPACE=trino-$( LC_ALL=C tr -dc ' a-z0-9' < /dev/urandom | head -c 6 || true)
2121HELM_EXTRA_SET_ARGS=
22- CT_ARGS=(--charts=charts/trino --skip-clean-up)
22+ CT_ARGS=(--charts=charts/trino --skip-clean-up --helm-extra-args= " --timeout 2m " )
2323CLEANUP_NAMESPACE=true
2424TEST_NAMES=(default single_node complete_values)
2525
@@ -71,8 +71,18 @@ openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 \
7171 -addext " subjectAltName=DNS:localhost,DNS:*.$NAMESPACE ,DNS:*.$NAMESPACE .svc,DNS:*.$NAMESPACE .svc.cluster.local,IP:127.0.0.1" \
7272 -keyout cert.key -out cert.crt
7373
74- kubectl create namespace " $NAMESPACE "
75- kubectl -n " $NAMESPACE " create secret tls certificates --cert=cert.crt --key=cert.key
74+ kubectl create namespace " $NAMESPACE " --dry-run=client --output yaml | kubectl apply --filename -
75+ kubectl -n " $NAMESPACE " create secret tls certificates --cert=cert.crt --key=cert.key --dry-run=client --output yaml | kubectl apply --filename -
76+
77+ # only install the Prometheus Helm chart when running the `complete_values` test
78+ if printf ' %s\0' " ${TEST_NAMES[@]} " | grep -qwz complete_values; then
79+ helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
80+ helm upgrade --install prometheus-operator prometheus-community/kube-prometheus-stack -n " $NAMESPACE " \
81+ --version " 60.0.2" \
82+ --set prometheus.prometheusSpec.serviceMonitorSelectorNilUsesHelmValues=false \
83+ --set grafana.enabled=false
84+ kubectl rollout status --watch deployments -l release=prometheus-operator -n " $NAMESPACE "
85+ fi
7686
7787CT_ARGS+=(--namespace " $NAMESPACE " )
7888
@@ -84,21 +94,23 @@ for test_name in "${TEST_NAMES[@]}"; do
8494 if ! time ct install " ${CT_ARGS[@]} " --helm-extra-set-args " $HELM_EXTRA_SET_ARGS ${testCases[$test_name]} " ; then
8595 echo 1>&2 " ❌ Test $test_name failed"
8696 echo 1>&2 " Test logs:"
87- kubectl --namespace " $NAMESPACE " logs --tail=-1 --selector app.kubernetes.io/component=test
97+ kubectl --namespace " $NAMESPACE " logs --tail=-1 --selector app.kubernetes.io/component=test --all-containers=true
8898 result=1
8999 else
90100 echo 1>&2 " ✅ Test $test_name completed"
91101 fi
92102 if [ " $CLEANUP_NAMESPACE " == " true" ]; then
93- for release in $( helm --namespace " $NAMESPACE " ls --all --short) ; do
103+ for release in $( helm --namespace " $NAMESPACE " ls --all --short | grep -v ' prometheus-operator ' ) ; do
94104 echo 1>&2 " Cleaning up Helm release $release "
95105 helm --namespace " $NAMESPACE " delete " $release "
96106 done
97107 fi
98108done
99109
100110if [ " $CLEANUP_NAMESPACE " == " true" ]; then
111+ helm -n " $NAMESPACE " uninstall prometheus-operator --ignore-not-found
101112 kubectl delete namespace " $NAMESPACE "
113+ kubectl delete crd $( kubectl api-resources --api-group=monitoring.coreos.com --output name)
102114fi
103115
104116exit $result
0 commit comments