forked from cohosh/snowbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·55 lines (45 loc) · 1.3 KB
/
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
#!/bin/sh
RED='\033[0;31m'
GREEN='\033[0;32m'
NONE='\033[0m'
echo "=== Testing proxy communication with broker ==="
/go/src/script.sh
printf "Checking proxy poll... "
if grep -q "Invalid data" /go/bin/broker.err; then
printf "${RED}[fail]${NONE}\n"
printf "\tProxy provided invalid data\n"
else
printf "${GREEN}[pass]${NONE}\n"
fi
printf "Checking proxy ID... "
if grep -q "Mismatched IDs!" /go/bin/broker.err; then
printf "${RED}[fail]${NONE}\n"
printf "\tProxy provided the wrong ID\n"
else
printf "${GREEN}[pass]${NONE}\n"
fi
echo "=== Testing client connectivity ==="
printf "Checking for proxies... "
if grep -q "Client: No snowflake proxies available." /go/bin/broker.err; then
printf "${RED}[fail]${NONE}\n"
printf "\tThere are no proxies\n"
else
printf "${GREEN}[pass]${NONE}\n"
fi
/go/src/script.sh --client
wait 30
printf "Checking connectivity... "
if grep -q "Failed to retrieve answer.." /go/bin/*client*.log; then
printf "${RED}[fail]${NONE}\n"
printf "\tCouldn't connect to proxy\n"
exit
else
printf "${GREEN}[pass]${NONE}\n"
fi
printf "Attempting to connect to proxy... "
if grep -q "Client: Timed out." /go/bin/broker.err; then
printf "${RED}[fail]${NONE}\n"
printf "\tProxy was too slow to respond\n"
else
printf "${GREEN}[pass]${NONE}\n"
fi