forked from cmbi/xssp-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_tests.sh
executable file
·47 lines (40 loc) · 894 Bytes
/
run_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
#!/usr/bin/env bash
while [[ $# -gt 1 ]]
do
_key="$1"
case $_key in
-t|--tests)
_tests="$2"
shift
;;
*)
echo "Unknown option: $_key"
exit 1
;;
esac
shift # past argument or value
done
if [ "x$_tests" = "x" ]; then
_tests=tests/unit
fi
echo $_tests
case "$_tests" in
*unit*)
_dc_run_opts="--no-deps --rm"
;;
*)
_dc_run_opts="--rm"
;;
esac
_nose_opts="-v --with-coverage --cover-inclusive --cover-package xssp_api"
_dc_opts="-f docker-compose.yml -f docker-compose-dev.yml"
_command="docker-compose $_dc_opts run $_dc_run_opts celery nosetests $_nose_opts $_tests"
echo $_command
$_command
exit_code=$?
# Remove all containers and network only if the tests passed. Keep them around
# for debugging the failed tests.
if [ $exit_code -eq 0 ]; then
docker-compose down
fi
exit $exit_code