-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.sh
More file actions
93 lines (84 loc) · 2.19 KB
/
test.sh
File metadata and controls
93 lines (84 loc) · 2.19 KB
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
#!/bin/bash
type=$1
fails=""
inspect() {
if [ $1 -ne 0 ]; then
fails="${fails} $2"
fi
}
server() {
docker-compose up -d --build
docker-compose exec users python manage.py test
inspect $? users
docker-compose exec users flake8 project
inspect $? users-lint
docker-compose exec exercises python manage.py test
inspect $? exercises
docker-compose exec exercises flake8 project
inspect $? exercises-lint
docker-compose exec scores python manage.py test
inspect $? scores
docker-compose exec scores flake8 project
inspect $? scores-lint
docker-compose down
}
client() {
docker-compose up -d --build
docker-compose exec client npm test -- --coverage --watchAll=false
inspect $? client
docker-compose down
}
e2e() {
docker-compose -f docker-compose-stage.yml up -d --build
docker-compose -f docker-compose-stage.yml exec users python manage.py recreate_db
./node_modules/.bin/cypress run --config baseUrl=http://localhost --env REACT_APP_API_GATEWAY_URL=$REACT_APP_API_GATEWAY_URL,LOAD_BALANCER_DNS_NAME=http://localhost
inspect $? e2e
docker-compose -f docker-compose-stage.yml down
}
all() {
docker-compose up -d --build
docker-compose exec users python manage.py test
inspect $? users
docker-compose exec users flake8 project
inspect $? users-lint
docker-compose exec exercises python manage.py test
inspect $? exercises
docker-compose exec exercises flake8 project
inspect $? exercises-lint
docker-compose exec scores python manage.py test
inspect $? scores
docker-compose exec scores flake8 project
inspect $? scores-lint
docker-compose exec client npm test -- --coverage --watchAll=false
inspect $? client
docker-compose down
e2e
}
# run appropriate tests
if [[ "${type}" == "server" ]]; then
echo "\n"
echo "Running server-side tests!\n"
server
elif [[ "${type}" == "client" ]]; then
echo "\n"
echo "Running client-side tests!\n"
client
elif [[ "${type}" == "e2e" ]]; then
echo "\n"
echo "Running e2e tests!\n"
e2e
else
echo "\n"
echo "Running all tests!\n"
all
fi
# return proper code
if [ -n "${fails}" ]; then
echo "\n"
echo "Tests failed: ${fails}"
exit 1
else
echo "\n"
echo "Tests passed!"
exit 0
fi