-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
93ad7bc
commit b123dbb
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
# install tools if missing | ||
for t in curl jq ; do | ||
if [ ! "$(command -v $t)" ]; then | ||
if [ "$(id -u)" != 0 ]; then | ||
echo "$t is missing, unable to install it" | ||
exit 1 | ||
fi | ||
|
||
apt-get -o DPkg::Lock::Timeout=60 update >/dev/null | ||
apt-get -o DPkg::Lock::Timeout=60 install -y "$t" >/dev/null | ||
fi | ||
done | ||
|
||
|
||
# Test the s3inbox's healthchecks, GET /health and HEAD / | ||
token="$(curl -s http://oidc:8080/tokens | jq -r '.[0]')" | ||
|
||
response="$(curl -s -k -LI 'http://s3inbox:8000' -o /dev/null -w '%{http_code}\n' -H 'Authorization: Bearer $token')" | ||
if [ "$response" != "200" ]; then | ||
echo "Bad health response from HEAD /, expected 200 got: $response" | ||
exit 1 | ||
fi | ||
|
||
response="$(curl -s -k -LI 'http://s3inbox:8000/health' -o /dev/null -w '%{http_code}\n' -H 'Authorization: Bearer $token')" | ||
if [ "$response" != "200" ]; then | ||
echo "Bad health response from /health, expected 200 got: $response" | ||
exit 1 | ||
fi | ||
|
||
echo "Healthcheck tests completed successfully" |