-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun_tests.sh
46 lines (38 loc) · 1.37 KB
/
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
set -eo pipefail
DOCKERCMD="docker compose --env-file src/docker/.compose.testing.env -f src/docker/docker-compose-testing.yml"
# remove old test results if needed (locally)
echo Cleaning up
git clean -xf data/teststorage
git checkout -- data/teststorage
# Clean old containers
$DOCKERCMD down
export GROUP_ID=$(id -g)
export USER_ID=$(id -u)
# Lint seems to operate on the local dir
echo Running linting
$DOCKERCMD run web pylint -E --disable E1101,E0307 --ignore-paths '.*\/migrations\/[0-9]+.*.py' \
analysis \
datasets \
dashboard \
home \
jobs \
kantele \
rawstatus \
|| (echo Linting failed && $DOCKERCMD down && exit 2)
echo Linting OK
echo Prebuilding DB and MQ containers
# Get DB container ready so web doesnt try to connect before it has init'ed
$DOCKERCMD up --detach db mq
echo Created db container and started it
sleep 5
echo Running tests
# Run tests
TESTCMD="python manage.py test"
if [[ -z "$1" ]]
then
$DOCKERCMD run --use-aliases web $TESTCMD --exclude-tag mstulos || ($DOCKERCMD logs web storage_mvfiles storage_downloads tulos_ingester && exit 1)
$DOCKERCMD run --use-aliases web $TESTCMD mstulos || ($DOCKERCMD logs web storage_mvfiles storage_downloads tulos_ingester && exit 1)
else
$DOCKERCMD run --use-aliases web $TESTCMD $1|| ($DOCKERCMD logs web storage_mvfiles storage_downloads tulos_ingester && exit 1)
fi
$DOCKERCMD down