Skip to content

Commit 4eff1e9

Browse files
committed
Allow recovery tests to run on Windows as an admin user
This is the only test that fails when run as an admin user. The reason is that when Postgres is started via pg_ctl its admin privileges are lowered. However, this test called 'postgres -D datadir' directly, resulting in a failure. Replace that by calling pg_ctl and then checking the result for the expected failure, and the logfile for the expected error message.
1 parent 72c7c4e commit 4eff1e9

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/test/recovery/t/003_recovery_targets.pl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ sub test_recovery_standby
132132
$node_standby->init_from_backup($node_master, 'my_backup', has_restoring => 1);
133133
$node_standby->append_conf('postgresql.conf', "recovery_target_name = '$recovery_name'
134134
recovery_target_time = '$recovery_time'");
135-
command_fails_like(['postgres', '-D', $node_standby->data_dir],
136-
qr/multiple recovery targets specified/,
137-
'multiple conflicting settings');
135+
136+
my $res = run_log(['pg_ctl', '-D', $node_standby->data_dir,
137+
'-l', $node_standby->logfile, 'start']);
138+
ok(! $res, 'invalid recovery startup fails');
139+
140+
my $logfile = slurp_file($node_standby->logfile());
141+
ok ($logfile =~ qr/multiple recovery targets specified/,
142+
'multiple conflicting settings');

0 commit comments

Comments
 (0)