forked from testdrivenio/testdriven-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.sh
More file actions
58 lines (49 loc) · 1.22 KB
/
test.sh
File metadata and controls
58 lines (49 loc) · 1.22 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
#!/bin/bash
env=$1
file=""
fails=""
if [[ "${env}" == "stage" ]]; then
file="docker-compose-stage.yml"
elif [[ "${env}" == "dev" ]]; then
file="docker-compose-dev.yml"
elif [[ "${env}" == "prod" ]]; then
file="docker-compose-prod.yml"
else
echo "USAGE: sh test.sh environment_name"
echo "* environment_name: must either be 'dev', 'stage', or 'prod'"
exit 1
fi
inspect() {
if [ $1 -ne 0 ]; then
fails="${fails} $2"
fi
}
/bin/sleep 5
docker-compose -f $file run users-service python manage.py test
inspect $? users
docker-compose -f $file run users-service flake8 project
inspect $? users-lint
docker-compose -f $file run exercises python manage.py test
inspect $? exercises
docker-compose -f $file run exercises flake8 project
inspect $? exercises-lint
docker-compose -f $file run scores python manage.py test
inspect $? scores
docker-compose -f $file run scores flake8 project
inspect $? scores-lint
if [[ "${env}" == "dev" ]]; then
docker-compose -f $file run client npm test -- --coverage
inspect $? client
testcafe chrome e2e
inspect $? e2e
else
testcafe chrome e2e/index.test.js
inspect $? e2e
fi
if [ -n "${fails}" ]; then
echo "Tests failed: ${fails}"
exit 1
else
echo "Tests passed!"
exit 0
fi