Skip to content

Commit 1a9d802

Browse files
committed
Fix some issues with TAP tests for postgres -C
This addresses two issues with the tests added in 0c39c29 for runtime GUCs: - Re-enable the test on Msys. The test could fail because of \r\n generated by Msys perl. 0d91c52 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
1 parent 0d91c52 commit 1a9d802

File tree

1 file changed

+14
-23
lines changed

1 file changed

+14
-23
lines changed

src/bin/pg_checksums/t/002_actions.pl

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use TestLib;
1212

1313
use Fcntl qw(:seek);
14-
use Test::More tests => 69;
14+
use Test::More tests => 66;
1515

1616

1717
# Utility routine to create and check a table with corrupted checksums
@@ -181,34 +181,25 @@ sub check_relation_corruption
181181

182182
# Test postgres -C for an offline cluster.
183183
# Run-time GUCs are safe to query here. Note that a lock file is created,
184-
# then unlinked, leading to an extra LOG entry showing in stderr.
185-
SKIP:
186-
{
187-
skip "unstable output generated with Msys", 3
188-
if ($Config{osname} eq 'msys');
189-
command_checks_all(
190-
[ 'postgres', '-D', $pgdata, '-C', 'data_checksums' ],
191-
0,
192-
[qr/^on$/],
193-
# LOG entry when unlinking lock file.
194-
[qr/database system is shut down/],
195-
'data_checksums=on is reported on an offline cluster');
196-
}
184+
# then removed, leading to an extra LOG entry showing in stderr. This uses
185+
# log_min_messages=fatal to remove any noise. This test uses a startup
186+
# wrapped with pg_ctl to allow the case where this runs under a privileged
187+
# account on Windows.
188+
command_checks_all(
189+
[
190+
'pg_ctl', 'start', '-D', $pgdata, '-s', '-o',
191+
'-C data_checksums -c log_min_messages=fatal'
192+
],
193+
1,
194+
[qr/^on$/],
195+
[qr/could not start server/],
196+
'data_checksums=on is reported on an offline cluster');
197197

198198
# Checks cannot happen with an online cluster
199199
$node->start;
200200
command_fails([ 'pg_checksums', '--check', '-D', $pgdata ],
201201
"fails with online cluster");
202202

203-
# Test postgres -C on an online cluster.
204-
command_fails_like(
205-
[ 'postgres', '-D', $pgdata, '-C', 'data_checksums' ],
206-
qr/lock file .* already exists/,
207-
'data_checksums is not reported on an online cluster');
208-
command_ok(
209-
[ 'postgres', '-D', $pgdata, '-C', 'work_mem' ],
210-
'non-runtime parameter is reported on an online cluster');
211-
212203
# Check corruption of table on default tablespace.
213204
check_relation_corruption($node, 'corrupt1', 'pg_default');
214205

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy