forked from uc-cdis/compose-services
-
Notifications
You must be signed in to change notification settings - Fork 0
/
smoke_test.sh
55 lines (47 loc) · 1.16 KB
/
smoke_test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
help() {
cat - <<EOM
Use: bash smoke_test.sh [--help] HOSTNAME
ex 1: bash smoke_test.sh localhost
ex 2: bash smoke_test.sh --help
EOM
}
curly() {
local url=''
local service=''
local result='unknown'
url="$1"
shift
service="$1"
result="$(curl -k -s -i -X GET "$url" | head -1 | awk '{ print $2 }')"
echo "$result $service $url"
if [[ "$result" == "200" ]]; then
return 0
fi
return 1
}
if [[ $# -lt 1 || "$1" =~ -*help ]]; then
help
exit 0
fi
proto=https://
hostname="$1"
shift
if [[ "$hostname" =~ ^https{0,1}:// ]]; then
# hostname include protocol
proto=""
fi
result=0
curly "${proto}${hostname}/index.html" "portal"
if [[ $? != 0 ]]; then result=$?; fi
curly "${proto}${hostname}/user/.well-known/jwks" "fence"
if [[ $? != 0 ]]; then result=$?; fi
curly "${proto}${hostname}/index/_status" "indexd"
if [[ $? != 0 ]]; then result=$?; fi
curly "${proto}${hostname}/peregrine/_status" "peregrine"
if [[ $? != 0 ]]; then result=$?; fi
curly "${proto}${hostname}/api/_status" "sheepdog"
if [[ $? != 0 ]]; then result=$?; fi
curly "${proto}${hostname}/pidgin/_status" "pidgin"
if [[ $? != 0 ]]; then result=1; fi
exit $result