Skip to content
Snippets Groups Projects
Commit e890655c authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

SW-415: use same setup and teardown as in t_lsmrapp_scheduling_functional....

SW-415: use same setup and teardown as in t_lsmrapp_scheduling_functional. TODO: create common bash file with setup/teardown routines.
parent af968b07
No related branches found
No related tags found
1 merge request!87Lsmr epic
...@@ -18,21 +18,9 @@ password=lsrm ...@@ -18,21 +18,9 @@ password=lsrm
#keep track of helper application pids to kill in teardown
PIDS=
# setup propagation of signals to child processes # setup propagation of signals to child processes
teardown() { teardown() {
echo "tearing down test environment" echo "tearing down test environment"
for PID in $PIDS
do
# get the full command
CMD="`ps --pid $PID h -o command`"
echo "killing helper application: $CMD"
# and kill it
kill -TERM $PID
done
echo "removing test credentials file: $CREDENTIALS_PATH" echo "removing test credentials file: $CREDENTIALS_PATH"
rm $CREDENTIALS_PATH rm $CREDENTIALS_PATH
...@@ -48,7 +36,6 @@ export LSMR_DBCREDENTIALS=$DJANGO_TEST_DATABASE_NAME ...@@ -48,7 +36,6 @@ export LSMR_DBCREDENTIALS=$DJANGO_TEST_DATABASE_NAME
# Run test # Run test
$LOFARROOT/lib*/python*/site-packages/lofar/sas/lsmr/manage.py test --pattern="t_lsmrapp_scheduling_django.py" --testrunner=postgres_testrunner.PostgresqlTestRunner & $LOFARROOT/lib*/python*/site-packages/lofar/sas/lsmr/manage.py test --pattern="t_lsmrapp_scheduling_django.py" --testrunner=postgres_testrunner.PostgresqlTestRunner &
TEST_PID=$! TEST_PID=$!
PIDS="$TEST_PID $PIDS"
wait "$TEST_PID" wait "$TEST_PID"
# wait again (to get the status code of the test) # wait again (to get the status code of the test)
......
...@@ -63,7 +63,6 @@ export LSMR_DBCREDENTIALS=$DJANGO_TEST_DATABASE_NAME ...@@ -63,7 +63,6 @@ export LSMR_DBCREDENTIALS=$DJANGO_TEST_DATABASE_NAME
# Run test # Run test
./t_lsmrapp_scheduling_functional.py & ./t_lsmrapp_scheduling_functional.py &
TEST_PID=$! TEST_PID=$!
PIDS="$TEST_PID $PIDS"
wait "$TEST_PID" wait "$TEST_PID"
# wait again (to get the status code of the test) # wait again (to get the status code of the test)
......
#!/bin/sh #!/bin/bash
set +x
mkdir -p ~/.lofar/dbcredentials
DJANGO_TEST_DATABASE_NAME="lsmr_test_`uuidgen | sed 's/-/_/g'`"
CREDENTIALS_PATH="$HOME/.lofar/dbcredentials/$DJANGO_TEST_DATABASE_NAME.ini"
echo "creating test credentials file: $CREDENTIALS_PATH"
echo "[database:$DJANGO_TEST_DATABASE_NAME]
host=localhost
type=postgres
database=$DJANGO_TEST_DATABASE_NAME
port=7654
user=lsrm
password=lsrm
" > "$CREDENTIALS_PATH"
# setup propagation of signals to child processes
teardown() {
echo "tearing down test environment"
echo "removing test credentials file: $CREDENTIALS_PATH"
rm $CREDENTIALS_PATH
}
## Trap upon signals and upon normal exit.
trap 'STATUS=$?; teardown; exit $STATUS' SIGHUP SIGINT SIGQUIT SIGKILL SIGTERM
export DJANGO_TEST_PORT=$DJANGO_TEST_PORT
export LSMR_DBCREDENTIALS=$DJANGO_TEST_DATABASE_NAME
# Run test
$LOFARROOT/lib*/python*/site-packages/lofar/sas/lsmr/manage.py test --pattern="t_lsmrapp_specification_django.py" --testrunner=postgres_testrunner.PostgresqlTestRunner &
TEST_PID=$!
wait "$TEST_PID"
# wait again (to get the status code of the test)
wait "$TEST_PID"
TEST_EXIT_CODE=$?
teardown
exit $TEST_EXIT_CODE
$LOFARROOT/lib*/python*/site-packages/lofar/sas/lsmr/manage.py test --pattern="t_lsmrapp_specification_django.py" --testrunner=postgres_testrunner.PostgresqlTestRunner
...@@ -63,7 +63,6 @@ export LSMR_DBCREDENTIALS=$DJANGO_TEST_DATABASE_NAME ...@@ -63,7 +63,6 @@ export LSMR_DBCREDENTIALS=$DJANGO_TEST_DATABASE_NAME
# Run test # Run test
./t_lsmrapp_specification_functional.py & ./t_lsmrapp_specification_functional.py &
TEST_PID=$! TEST_PID=$!
PIDS="$TEST_PID $PIDS"
wait "$TEST_PID" wait "$TEST_PID"
# wait again (to get the status code of the test) # wait again (to get the status code of the test)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment