diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2015-04-15 19:54:38 +0300 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2015-04-15 19:54:38 +0300 |
commit | 0d8a22a9ac6a61b7993abb642cb7e4645f4087b0 (patch) | |
tree | 67e0401c20ee5ed65717c80ccdbebb66ace31384 /src/bin/pg_rewind/RewindTest.pm | |
parent | 3d80a1e0e3e278edc6022d642478dcbd089d4483 (diff) |
Shut down test servers after pg_rewind regression tests.
Now that the test servers are initialized twice in each .pl script,
the single END block is not enough to stop them. Add a new clean_rewind_test
function that is called at the end of each test.
Michael Paquier
Diffstat (limited to 'src/bin/pg_rewind/RewindTest.pm')
-rw-r--r-- | src/bin/pg_rewind/RewindTest.pm | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/bin/pg_rewind/RewindTest.pm b/src/bin/pg_rewind/RewindTest.pm index 50cae2c2632..e6a5b9b3d95 100644 --- a/src/bin/pg_rewind/RewindTest.pm +++ b/src/bin/pg_rewind/RewindTest.pm @@ -22,6 +22,9 @@ package RewindTest; # 5. run_pg_rewind - stops the old master (if it's still running) and runs # pg_rewind to synchronize it with the now-promoted standby server. # +# 6. clean_rewind_test - stops both servers used in the test, if they're +# still running. +# # The test script can use the helper functions master_psql and standby_psql # to run psql against the master and standby servers, respectively. The # test script can also use the $connstr_master and $connstr_standby global @@ -56,6 +59,7 @@ our @EXPORT = qw( create_standby promote_standby run_pg_rewind + clean_rewind_test ); @@ -262,9 +266,8 @@ recovery_target_timeline='latest' } # Clean up after the test. Stop both servers, if they're still running. -END +sub clean_rewind_test { - my $save_rc = $?; if ($test_master_datadir) { system "pg_ctl -D $test_master_datadir -s -m immediate stop 2> /dev/null"; @@ -273,5 +276,12 @@ END { system "pg_ctl -D $test_standby_datadir -s -m immediate stop 2> /dev/null"; } +} + +# Stop the test servers, just in case they're still running. +END +{ + my $save_rc = $?; + clean_rewind_test(); $? = $save_rc; } |