Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0d8a22a

Browse files
committed
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_testfunction that is called at the end of each test.Michael Paquier
1 parent3d80a1e commit0d8a22a

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

‎src/bin/pg_rewind/RewindTest.pm

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff 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+
subclean_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";
@@ -273,5 +276,12 @@ END
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
}

‎src/bin/pg_rewind/t/001_basic.pl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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

‎src/bin/pg_rewind/t/002_databases.pl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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.

‎src/bin/pg_rewind/t/003_extrafiles.pl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff 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.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp