Skip to content

Commit

Permalink
Fixed the test code to handle the background job properly (#228)
Browse files Browse the repository at this point in the history
Since the test code only uses "sleep" to wait for the background job
to finish, an incomplete background job could cause the next test to fail. 

As an example, we have confirmed that the test fails on a poorly 
performing server.
  • Loading branch information
zwyan0 authored and Masahiro Ikeda committed Jun 7, 2022
1 parent 00f7c5d commit 1071b19
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sql/show.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ echo ''
echo '###### SHOW COMMAND TEST-0002 ######'
echo '###### Status RUNNING ######'
init_catalog
pg_rman backup -B ${BACKUP_PATH} -b full -Z -p ${TEST_PGPORT} -d postgres --quiet &
pg_rman backup -B ${BACKUP_PATH} -b full -Z -p ${TEST_PGPORT} -d postgres --quiet & # run in background
sleep 1
pg_rman show -B ${BACKUP_PATH} > ${TEST_BASE}/TEST-0002-show.out 2>&1
if grep "RUNNING" ${TEST_BASE}/TEST-0002-show.out > /dev/null ; then
echo 'OK: RUNNING status is shown properly.'
else
echo 'NG: RUNNING status is not shown.'
fi
sleep 5
wait # wait to finish the backup running in the background with '&'.
echo ''

echo '###### SHOW COMMAND TEST-0003 ######'
Expand Down

0 comments on commit 1071b19

Please sign in to comment.