forked from wangkuiyi/prism
-
Notifications
You must be signed in to change notification settings - Fork 0
/
local_run_test.bash
executable file
·63 lines (55 loc) · 1.65 KB
/
local_run_test.bash
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
56
57
58
59
60
61
62
63
if go install -gcflags "-N -l" \
github.com/wangkuiyi/prism/prism \
github.com/wangkuiyi/prism/example \
github.com/wangkuiyi/prism/example/hello; then
echo -e "\033[1mBuild Prism completed\033[0m"
else
echo -e "\033[1mBuild Prism failed\033[0m"
exit
fi
killall prism
killall hello
# Start Prism and listen on :12340
$GOPATH/bin/prism &
echo -e "\033[1mDeploy and launch hello using Prism.\033[0m"
sleep 1
$GOPATH/bin/example -action=launch -retry=10
sleep 1
R=$(curl -s http://localhost:8080/Hello)
if [ "$R" != 'Hello, "/Hello"' ]; then
echo -e "\033[1mhello is not running as expected!\033[0m"
exit
fi
echo -e "\033[1mKill hello using killall should lead to restart.\033[0m"
killall hello
sleep 1
R=$(curl -s http://localhost:8080/Hello)
if [ "$R" != 'Hello, "/Hello"' ]; then
echo -e "\033[1mhello is unexpectedly killed by killall!\033[0m"
exit
fi
echo -e "\033[1mKill hello should kill hello.\033[0m"
$GOPATH/bin/example -action=kill
sleep 1
R=$(curl -s http://localhost:8080/Hello)
if [ "$R" != '' ]; then
echo -e "\033[1mhello is not killed as expected!\033[0m"
exit
fi
echo -e "\033[1mDeploy and launch again.\033[0m"
$GOPATH/bin/example -action=launch -retry=2
sleep 1
R=$(curl -s http://localhost:8080/Hello)
if [ "$R" != 'Hello, "/Hello"' ]; then
echo -e "\033[1mhello is not running as expected!\033[0m"
exit
fi
echo -e "\033[1mKill Prism should bring down hello.\033[0m"
killall prism
sleep 1
R=$(curl -s http://localhost:8080/Hello)
if [ "$R" != '' ]; then
echo -e "\033[1mhello is not killed as expected\033[0m"
exit
fi
echo -e "\033[1m========= Congratulations! Testing passed. =========\033[0m"