-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathintegration-tests.sh
executable file
·101 lines (85 loc) · 2.75 KB
/
integration-tests.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/bash
usage() {
cat << EOF
Starts all services for the specified environment.
Options:
-f <filter> --filter <filter> A filter expression to pick out which test to run
-h --help Prints this help message and exits
EOF
}
# defaults
FILTER=\"\"
# parameters
while [ -n "$1" ]; do
case $1 in
-f | --filter)
shift
FILTER=$1
;;
-h | --help)
usage
exit 0
;;
*)
echo -e "Unknown option $1...\n"
usage
exit 1
;;
esac
shift
done
export TEST_FILTER=${FILTER}
# remove any residual containers and the attached database volume before run
docker compose -p consensus-chess-int \
-f compose.yaml -f compose.int.yaml -f compose.int-tests.yaml \
--env-file environments/db-int.env \
down -v
# start all containers required for the test, exit when it finishes
docker compose -p consensus-chess-int \
-f compose.yaml -f compose.int.yaml -f compose.int-tests.yaml \
--env-file environments/db-int.env \
up --build integration-tests \
--exit-code-from integration-tests \
--abort-on-container-exit
TEST_CODE=$?
if test $TEST_CODE -eq 0
then
GREEN='\033[0;32m'
NC='\033[0m'
echo -e "${GREEN}Pass!${NC}"
echo -e "${GREEN}"
cat << EOF
███████████
░░███░░░░░███
░███ ░███ ██████ █████ █████
░██████████ ░░░░░███ ███░░ ███░░
░███░░░░░░ ███████ ░░█████ ░░█████
░███ ███░░███ ░░░░███ ░░░░███
█████ ░░████████ ██████ ██████
░░░░░ ░░░░░░░░ ░░░░░░ ░░░░░░
EOF
echo -e "${NC}"
else
RED='\033[0;31m'
NC='\033[0m'
echo -e "${RED}Fail!${NC}"
echo -e "${RED}"
cat << EOF
█████▒▄▄▄ ██▓ ██▓
▓██ ▒▒████▄ ▓██▒▓██▒
▒████ ░▒██ ▀█▄ ▒██▒▒██░
░▓█▒ ░░██▄▄▄▄██ ░██░▒██░
░▒█░ ▓█ ▓██▒░██░░██████▒
▒ ░ ▒▒ ▓▒█░░▓ ░ ▒░▓ ░
░ ▒ ▒▒ ░ ▒ ░░ ░ ▒ ░
░ ░ ░ ▒ ▒ ░ ░ ░
░ ░ ░ ░ ░
EOF
echo -e "${NC}"
fi
# stop all containers (leave the db intact) after the run
docker compose -p consensus-chess-int \
-f compose.yaml -f compose.int.yaml \
--env-file environments/db-int.env \
stop
exit $TEST_CODE