File tree Expand file tree Collapse file tree 4 files changed +16
-2
lines changed Expand file tree Collapse file tree 4 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,9 @@ package RewindTest;
2222# 5. run_pg_rewind - stops the old master (if it's still running) and runs
2323# pg_rewind to synchronize it with the now-promoted standby server.
2424#
25+ # 6. clean_rewind_test - stops both servers used in the test, if they're
26+ # still running.
27+ #
2528# The test script can use the helper functions master_psql and standby_psql
2629# to run psql against the master and standby servers, respectively. The
2730# test script can also use the $connstr_master and $connstr_standby global
@@ -56,6 +59,7 @@ our @EXPORT = qw(
5659 create_standby
5760 promote_standby
5861 run_pg_rewind
62+ clean_rewind_test
5963) ;
6064
6165
@@ -262,9 +266,8 @@ recovery_target_timeline='latest'
262266}
263267
264268# Clean up after the test. Stop both servers, if they're still running.
265- END
269+ sub clean_rewind_test
266270{
267- my $save_rc = $? ;
268271 if ($test_master_datadir )
269272 {
270273 system " pg_ctl -D $test_master_datadir -s -m immediate stop 2> /dev/null" ;
273276 {
274277 system " pg_ctl -D $test_standby_datadir -s -m immediate stop 2> /dev/null" ;
275278 }
279+ }
280+
281+ # Stop the test servers, just in case they're still running.
282+ END
283+ {
284+ my $save_rc = $? ;
285+ clean_rewind_test();
276286 $? = $save_rc ;
277287}
Original file line number Diff line number Diff line change @@ -78,6 +78,7 @@ sub run_test
7878) ,
7979 ' tail-copy' );
8080
81+ RewindTest::clean_rewind_test();
8182}
8283
8384# Run the test in both modes
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ sub run_test
4040) ,
4141 ' database names' );
4242
43+ RewindTest::clean_rewind_test();
4344}
4445
4546# Run the test in both modes.
Original file line number Diff line number Diff line change @@ -62,6 +62,8 @@ sub run_test
6262 " $test_master_datadir /tst_standby_dir/standby_subdir" ,
6363 " $test_master_datadir /tst_standby_dir/standby_subdir/standby_file3" ],
6464 " file lists match" );
65+
66+ RewindTest::clean_rewind_test();
6567}
6668
6769# Run the test in both modes.
You can’t perform that action at this time.
0 commit comments