mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-02 15:41:17 +02:00
Fix some issues with TAP tests for postgres -C
This addresses two issues with the tests added in0c39c292
for runtime GUCs: - Re-enable the test on Msys. The test could fail because of \r\n generated by Msys perl.0d91c52a
has taken care of this issue. - Allow the test to run in the context of a privileged account. CIs running under privileged accounts would fail on permission failures, as reported by Andres Freund. This issue is fixed by wrapping the postgres command within pg_ctl as the latter will take care of any permissions needed. The test checking a failure of postgres -C for a runtime parameter with an instance running is removed, as pg_ctl produces an unstable error code (no need for a CI to reproduce that). Discussion: https://postgr.es/m/20210921032040.lyl4lcax37aedx2x@alap3.anarazel.de
This commit is contained in:
parent
0d91c52a8f
commit
1a9d802828
@ -11,7 +11,7 @@ use PostgresNode;
|
|||||||
use TestLib;
|
use TestLib;
|
||||||
|
|
||||||
use Fcntl qw(:seek);
|
use Fcntl qw(:seek);
|
||||||
use Test::More tests => 69;
|
use Test::More tests => 66;
|
||||||
|
|
||||||
|
|
||||||
# Utility routine to create and check a table with corrupted checksums
|
# Utility routine to create and check a table with corrupted checksums
|
||||||
@ -181,34 +181,25 @@ command_fails(
|
|||||||
|
|
||||||
# Test postgres -C for an offline cluster.
|
# Test postgres -C for an offline cluster.
|
||||||
# Run-time GUCs are safe to query here. Note that a lock file is created,
|
# Run-time GUCs are safe to query here. Note that a lock file is created,
|
||||||
# then unlinked, leading to an extra LOG entry showing in stderr.
|
# then removed, leading to an extra LOG entry showing in stderr. This uses
|
||||||
SKIP:
|
# log_min_messages=fatal to remove any noise. This test uses a startup
|
||||||
{
|
# wrapped with pg_ctl to allow the case where this runs under a privileged
|
||||||
skip "unstable output generated with Msys", 3
|
# account on Windows.
|
||||||
if ($Config{osname} eq 'msys');
|
command_checks_all(
|
||||||
command_checks_all(
|
[
|
||||||
[ 'postgres', '-D', $pgdata, '-C', 'data_checksums' ],
|
'pg_ctl', 'start', '-D', $pgdata, '-s', '-o',
|
||||||
0,
|
'-C data_checksums -c log_min_messages=fatal'
|
||||||
[qr/^on$/],
|
],
|
||||||
# LOG entry when unlinking lock file.
|
1,
|
||||||
[qr/database system is shut down/],
|
[qr/^on$/],
|
||||||
'data_checksums=on is reported on an offline cluster');
|
[qr/could not start server/],
|
||||||
}
|
'data_checksums=on is reported on an offline cluster');
|
||||||
|
|
||||||
# Checks cannot happen with an online cluster
|
# Checks cannot happen with an online cluster
|
||||||
$node->start;
|
$node->start;
|
||||||
command_fails([ 'pg_checksums', '--check', '-D', $pgdata ],
|
command_fails([ 'pg_checksums', '--check', '-D', $pgdata ],
|
||||||
"fails with online cluster");
|
"fails with online cluster");
|
||||||
|
|
||||||
# Test postgres -C on an online cluster.
|
|
||||||
command_fails_like(
|
|
||||||
[ 'postgres', '-D', $pgdata, '-C', 'data_checksums' ],
|
|
||||||
qr/lock file .* already exists/,
|
|
||||||
'data_checksums is not reported on an online cluster');
|
|
||||||
command_ok(
|
|
||||||
[ 'postgres', '-D', $pgdata, '-C', 'work_mem' ],
|
|
||||||
'non-runtime parameter is reported on an online cluster');
|
|
||||||
|
|
||||||
# Check corruption of table on default tablespace.
|
# Check corruption of table on default tablespace.
|
||||||
check_relation_corruption($node, 'corrupt1', 'pg_default');
|
check_relation_corruption($node, 'corrupt1', 'pg_default');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user