]> granicus.if.org Git - postgresql/commitdiff
Allow recovery tests to run on Windows as an admin user
authorAndrew Dunstan <andrew@dunslane.net>
Mon, 4 Mar 2019 20:50:23 +0000 (15:50 -0500)
committerAndrew Dunstan <andrew@dunslane.net>
Mon, 4 Mar 2019 20:54:02 +0000 (15:54 -0500)
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.

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

index b46b318f5a3a413d7c980aa85a9e287adc405418..61482fb4000b11398f0aedfec1d5a463e7d55d0e 100644 (file)
@@ -132,6 +132,11 @@ my $node_standby = get_new_node('standby_7');
 $node_standby->init_from_backup($node_master, 'my_backup', has_restoring => 1);
 $node_standby->append_conf('postgresql.conf', "recovery_target_name = '$recovery_name'
 recovery_target_time = '$recovery_time'");
-command_fails_like(['postgres', '-D', $node_standby->data_dir],
-                                  qr/multiple recovery targets specified/,
-                                  'multiple conflicting settings');
+
+my $res = run_log(['pg_ctl', '-D', $node_standby->data_dir,
+                                  '-l', $node_standby->logfile, 'start']);
+ok(! $res, 'invalid recovery startup fails');
+
+my $logfile = slurp_file($node_standby->logfile());
+ok ($logfile =~  qr/multiple recovery targets specified/,
+       'multiple conflicting settings');