Skip to content

Commit a5d498d

Browse files
committed
normalize deployment test scripts
1 parent 500fcc1 commit a5d498d

File tree

3 files changed

+39
-15
lines changed

3 files changed

+39
-15
lines changed

dist/dist-packages/linux/linux.test.bash

+12-4
Original file line numberDiff line numberDiff line change
@@ -182,18 +182,26 @@ else
182182
exit 1
183183
fi
184184

185+
export \
185186
ZITI_CTRL_EDGE_ADVERTISED_ADDRESS=${ZITI_CTRL_ADVERTISED_ADDRESS} \
186-
ZITI_CTRL_EDGE_ADVERTISED_PORT=${ZITI_CTRL_ADVERTISED_PORT} \
187-
go test -v -count=1 -tags="quickstart manual" ./ziti/run/...
187+
ZITI_CTRL_EDGE_ADVERTISED_PORT=${ZITI_CTRL_ADVERTISED_PORT}
188+
189+
_test_result=$(go test -v -count=1 -tags="quickstart manual" ./ziti/run/...)
190+
191+
# check for failure modes that don't result in an error exit code
192+
if [[ "${_test_result}" =~ "no tests to run" ]]
193+
then
194+
echo "ERROR: test failed because no tests to run"
195+
exit 1
196+
fi
188197

189198
ATTEMPTS=5
190199
DELAY=3
191200

192201
# verify console is available
193202
curl_cmd="curl -skSfw '%{http_code}\t%{url}\n' -o/dev/null \"https://${ZITI_CTRL_ADVERTISED_ADDRESS}:${ZITI_CTRL_ADVERTISED_PORT}/zac/\""
194-
until ! ((ATTEMPTS)) || eval "${curl_cmd}" &> /dev/null
203+
until ! (( ATTEMPTS-- )) || eval "${curl_cmd}" &> /dev/null
195204
do
196-
(( ATTEMPTS-- ))
197205
echo "Waiting for zac"
198206
sleep ${DELAY}
199207
done

dist/docker-images/docker.test.bash

+12-4
Original file line numberDiff line numberDiff line change
@@ -124,18 +124,26 @@ ziti edge create edge-router "${ZITI_ROUTER_NAME}" -to ~ziggy/.config/ziti/"${ZI
124124
docker compose up ziti-router --detach
125125

126126
unset GOOS
127+
export \
127128
ZITI_CTRL_EDGE_ADVERTISED_ADDRESS=${ZITI_CTRL_ADVERTISED_ADDRESS} \
128-
ZITI_CTRL_EDGE_ADVERTISED_PORT=${ZITI_CTRL_ADVERTISED_PORT} \
129-
go test -v -count=1 -tags="quickstart manual" ./ziti/run/...
129+
ZITI_CTRL_EDGE_ADVERTISED_PORT=${ZITI_CTRL_ADVERTISED_PORT}
130+
131+
_test_result=$(go test -v -count=1 -tags="quickstart manual" ./ziti/run/...)
132+
133+
# check for failure modes that don't result in an error exit code
134+
if [[ "${_test_result}" =~ "no tests to run" ]]
135+
then
136+
echo "ERROR: test failed because no tests to run"
137+
exit 1
138+
fi
130139

131140
ATTEMPTS=5
132141
DELAY=3
133142

134143
# verify console is available
135144
curl_cmd="curl -skSfw '%{http_code}\t%{url}\n' -o/dev/null \"https://${ZITI_CTRL_ADVERTISED_ADDRESS}:${ZITI_CTRL_ADVERTISED_PORT}/zac/\""
136-
until ! ((ATTEMPTS)) || eval "${curl_cmd}" &> /dev/null
145+
until ! (( ATTEMPTS-- )) || eval "${curl_cmd}" &> /dev/null
137146
do
138-
(( ATTEMPTS-- ))
139147
echo "Waiting for zac"
140148
sleep ${DELAY}
141149
done

dist/docker-images/k8s.test.bash

+15-7
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,10 @@ bash -x ./quickstart/kubernetes/miniziti.bash start \
128128
--values-dir "${EXTRA_VALUES_DIR}"
129129

130130
MINIKUBE_IP="$(minikube --profile "${ZITI_NAMESPACE}" ip)"
131+
ZITI_CTRL_ADVERTISED_ADDRESS="miniziti-controller.${MINIKUBE_IP}.sslip.io"
131132

132133
# verify console is available
133-
curl -skSfw '%{http_code}\t%{url}\n' -o/dev/null "https://miniziti-controller.${MINIKUBE_IP}.sslip.io/zac/"
134+
curl -skSfw '%{http_code}\t%{url}\n' -o/dev/null "https://${ZITI_CTRL_ADVERTISED_ADDRESS}:${ZITI_CTRL_ADVERTISED_PORT}/zac/"
134135

135136
ZITI_PWD=$(
136137
minikube kubectl --profile "${ZITI_NAMESPACE}" -- \
@@ -140,14 +141,21 @@ ZITI_PWD=$(
140141
--output go-template='{{index .data "admin-password" | base64decode }}'
141142
)
142143

144+
143145
export \
144146
ZITI_PWD \
145147
ZITI_ROUTER_NAME="miniziti-router" \
146-
ZITI_CTRL_ADVERTISED_ADDRESS="miniziti-controller.${MINIKUBE_IP}.sslip.io"
147-
148-
ZITI_CTRL_EDGE_ADVERTISED_ADDRESS=${ZITI_CTRL_ADVERTISED_ADDRESS} \
149-
ZITI_CTRL_EDGE_ADVERTISED_PORT=${ZITI_CTRL_ADVERTISED_PORT} \
150-
ZITI_TEST_BIND_ADDRESS="ziti-controller-client.${ZITI_NAMESPACE}.svc.cluster.local" \
151-
go test -v -count=1 -tags="quickstart manual" ./ziti/run/...
148+
ZITI_CTRL_EDGE_ADVERTISED_ADDRESS="${ZITI_CTRL_ADVERTISED_ADDRESS}" \
149+
ZITI_CTRL_EDGE_ADVERTISED_PORT="${ZITI_CTRL_ADVERTISED_PORT}" \
150+
ZITI_TEST_BIND_ADDRESS="ziti-controller-client.${ZITI_NAMESPACE}.svc.cluster.local"
151+
152+
_test_result=$(go test -v -count=1 -tags="quickstart manual" ./ziti/run/...)
153+
154+
# check for failure modes that don't result in an error exit code
155+
if [[ "${_test_result}" =~ "no tests to run" ]]
156+
then
157+
echo "ERROR: test failed because no tests to run"
158+
exit 1
159+
fi
152160

153161
cleanup

0 commit comments

Comments
 (0)