-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·71 lines (50 loc) · 1.29 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
#author stevensu1977
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
flowqlet_endpoint=${FLOWQLET_ENDPOINT}
if [ -z "$FLOWQLET_ENDPOINT" ]; then
flowqlet_endpoint="http://127.0.0.1:8801"
fi
help () {
echo "./test.sh e2e|start|stop <scenario name>"
exit
}
start ( ) {
printf "\n${GREEN}FLOWQLET_ENDPOINT: $flowqlet_endpoint${NC}"
printf "\n${GREEN}========Create Scenario $1========${NC}\n"
printf "\n"
curl -v -X POST ${flowqlet_endpoint}/api/v1/instance/f20030f4b7f4c64aa271236f124e77384a83dcf5/$1
printf "\n${GREEN}=================================${NC}\n"
}
stop () {
printf "\n${GREEN}FLOWQLET_ENDPOINT: $flowqlet_endpoint${NC}"
printf "\n${GREEN}========Remove Scenario $1========${NC}\n"
printf "\n"
curl -v -X DELETE ${flowqlet_endpoint}/api/v1/instance/f20030f4b7f4c64aa271236f124e77384a83dcf5/$1
printf "\n${GREEN}=================================${NC}\n"
}
if [ -z "$1" ]; then
help
fi
if [ -z "$2" ]; then
echo "you need input scenario name"
exit
fi
if [ "$1" == "e2e" ]; then
start $2
sleep 2
stop $2
exit
fi
if [ "$1" == "start" ]; then
start $2
exit
fi
if [ "$1" == "stop" ]; then
stop $2
exit
fi
printf "ERROR:${RED} Wrong cmd "$1" only accept start|stop ${NC}\n"