Skip to content

Commit 8d59ad0

Browse files
authored
Merge pull request #2396 from openziti/test-zac-deployments
test zac deployments
2 parents 738ddfb + 85aec67 commit 8d59ad0

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed

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

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ cleanup(){
3232
fi
3333
)||true
3434
done
35+
if [[ -d "${ZITI_CONSOLE_LOCATION}" ]]
36+
then
37+
sudo rm -rf "${ZITI_CONSOLE_LOCATION}"
38+
fi
3539
echo "DEBUG: cleanup complete"
3640
}
3741

@@ -58,7 +62,7 @@ BASEDIR="$(cd "$(dirname "${0}")" && pwd)"
5862
REPOROOT="$(cd "${BASEDIR}/../../.." && pwd)"
5963
cd "${REPOROOT}"
6064

61-
declare -a BINS=(grep go nc nfpm)
65+
declare -a BINS=(grep go nc nfpm curl unzip)
6266
for BIN in "${BINS[@]}"; do
6367
checkCommand "$BIN"
6468
done
@@ -73,6 +77,7 @@ done
7377
: "${ZITI_ROUTER_NAME:="linux-router1"}"
7478
: "${ZITI_ROUTER_ADVERTISED_ADDRESS:="${ZITI_ROUTER_NAME}.127.0.0.1.sslip.io"}"
7579
: "${ZITI_ENROLL_TOKEN:="${TMPDIR}/${ZITI_ROUTER_NAME}.jwt"}"
80+
: "${ZITI_CONSOLE_LOCATION:="/opt/openziti/share/consoletest"}"
7681

7782
export \
7883
ZITI_GO_VERSION \
@@ -115,6 +120,7 @@ ZITI_ENROLL_TOKEN=/tmp/${ZITI_ROUTER_NAME}.jwt \
115120
sudo /opt/openziti/etc/controller/bootstrap.bash << CTRL
116121
ZITI_CTRL_ADVERTISED_ADDRESS="${ZITI_CTRL_ADVERTISED_ADDRESS}"
117122
ZITI_CTRL_ADVERTISED_PORT="${ZITI_CTRL_ADVERTISED_PORT}"
123+
ZITI_CONSOLE_LOCATION="${ZITI_CONSOLE_LOCATION}"
118124
ZITI_USER="admin"
119125
ZITI_PWD="${ZITI_PWD}"
120126
CTRL
@@ -141,6 +147,11 @@ do
141147
done
142148
ziti edge create edge-router "${ZITI_ROUTER_NAME}" -to "${ZITI_ENROLL_TOKEN}"
143149

150+
# fetch and install ziti console
151+
sudo mkdir -p "${ZITI_CONSOLE_LOCATION}"
152+
sudo tee "${ZITI_CONSOLE_LOCATION}/index.html" <<< "I am ZAC"
153+
sudo chmod -R +rX "${ZITI_CONSOLE_LOCATION}"
154+
144155
sudo /opt/openziti/etc/router/bootstrap.bash << ROUTER
145156
ZITI_CTRL_ADVERTISED_ADDRESS="${ZITI_CTRL_ADVERTISED_ADDRESS}"
146157
ZITI_CTRL_ADVERTISED_PORT="${ZITI_CTRL_ADVERTISED_PORT}"
@@ -175,4 +186,17 @@ ZITI_CTRL_EDGE_ADVERTISED_ADDRESS=${ZITI_CTRL_ADVERTISED_ADDRESS} \
175186
ZITI_CTRL_EDGE_ADVERTISED_PORT=${ZITI_CTRL_ADVERTISED_PORT} \
176187
go test -v -count=1 -tags="quickstart manual" ./ziti/cmd/edge/...
177188

189+
ATTEMPTS=5
190+
DELAY=3
191+
192+
# verify console is available
193+
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
195+
do
196+
(( ATTEMPTS-- ))
197+
echo "Waiting for zac"
198+
sleep ${DELAY}
199+
done
200+
eval "${curl_cmd}"
201+
178202
cleanup

dist/docker-images/compose.test.bash

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ BASEDIR="$(cd "$(dirname "${0}")" && pwd)"
4040
REPOROOT="$(cd "${BASEDIR}/../.." && pwd)"
4141
cd "${REPOROOT}"
4242

43-
declare -a BINS=(grep docker go nc)
43+
declare -a BINS=(grep docker go nc curl)
4444
for BIN in "${BINS[@]}"; do
4545
checkCommand "$BIN"
4646
done
@@ -128,4 +128,17 @@ ZITI_CTRL_EDGE_ADVERTISED_ADDRESS=${ZITI_CTRL_ADVERTISED_ADDRESS} \
128128
ZITI_CTRL_EDGE_ADVERTISED_PORT=${ZITI_CTRL_ADVERTISED_PORT} \
129129
go test -v -count=1 -tags="quickstart manual" ./ziti/cmd/edge/...
130130

131+
ATTEMPTS=5
132+
DELAY=3
133+
134+
# verify console is available
135+
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
137+
do
138+
(( ATTEMPTS-- ))
139+
echo "Waiting for zac"
140+
sleep ${DELAY}
141+
done
142+
eval "${curl_cmd}"
143+
131144
cleanup

0 commit comments

Comments
 (0)