Skip to content

Commit

Permalink
systemtests: stop psql server after test has finished
Browse files Browse the repository at this point in the history
- and cleanup some messages and return codes
  • Loading branch information
franku committed May 27, 2020
1 parent 759b0ef commit bdce03a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
@@ -1,7 +1,7 @@
#!/bin/bash

local_db_stop_server() {
echo "Stop db server"
echo "stop db server"
pg_ctl --silent --pgdata=data stop
tries=10
while psql --host="$1" --list > /dev/null 2>&1; do
Expand Down Expand Up @@ -33,7 +33,7 @@ local_db_prepare_files() {
}

local_db_start_server() {
echo "Start db server"
echo "start db server"
pg_ctl --silent --pgdata=data --log=log/logfile start

tries=10
Expand All @@ -52,7 +52,7 @@ local_db_start_server() {
return 1
}
sleep 0.1
done
done

return 0
}
Expand Down
10 changes: 6 additions & 4 deletions systemtests/tests/python-fd-plugin-postgres-test/testrunner
Expand Up @@ -22,7 +22,7 @@ PSQL="psql --host $TESTPGHOST"
[ -d "$TESTPGHOST" ] || mkdir -p "$TESTPGHOST"

pushd database > /dev/null || exit 1
setup_local_db "$TESTPGHOST" || exit
setup_local_db "$TESTPGHOST" || exit 1
popd > /dev/null

#shellcheck source=../scripts/functions
Expand Down Expand Up @@ -78,8 +78,6 @@ pushd database/ > /dev/null
local_db_stop_server "$TESTPGHOST"
rm -Rf data
rm -Rf wal_archive
echo "------------ stopped"
ps -e | grep postgres
popd > /dev/null

cat <<END_OF_DATA >$tmp/bconcmds
Expand All @@ -105,11 +103,15 @@ echo "restore_command = 'cp $current_test_directory/database/wal_archive/%f %p'"

# start DB again - shall recover to latest possible state
pushd database > /dev/null
ps -e | grep postgres
local_db_start_server "$TESTPGHOST" || exit 1
popd > /dev/null

echo "SELECT * FROM t" | ${PSQL} ${DBNAME} > $tmp/sql.log

pushd database/ > /dev/null
local_db_stop_server "$TESTPGHOST"
popd > /dev/null

check_two_logs
if (grep -q "for INCR" $tmp/sql.log)
then
Expand Down

0 comments on commit bdce03a

Please sign in to comment.