Subject: [PATCH 2/3] pg_resetwal TAP test: more long options

From: Dagfinn Ilmari Mannsåker <[email-masked]>
Date: Wed, 22 Jan 2025 15:25:05 +0000

Use --dry-run in the initial test, and include the long option in the
comment for the error cases.

The actual error tests are kept short, because the error message uses
the short spelling even though the invocation used the long one.
---
 src/bin/pg_resetwal/t/001_basic.pl | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/bin/pg_resetwal/t/001_basic.pl b/src/bin/pg_resetwal/t/001_basic.pl
index 323cd483cf3..4e406dc9aa8 100644
--- a/src/bin/pg_resetwal/t/001_basic.pl
+++ b/src/bin/pg_resetwal/t/001_basic.pl
@@ -16,8 +16,8 @@
 $node->init;
 $node->append_conf('postgresql.conf', 'track_commit_timestamp = on');
 
-command_like([ 'pg_resetwal', '-n', $node->data_dir ],
-	qr/checkpoint/, 'pg_resetwal -n produces output');
+command_like([ 'pg_resetwal', '--dry-run', $node->data_dir ],
+	qr/checkpoint/, 'pg_resetwal --dry-run produces output');

 # Permissions on PGDATA should be default
@@ -79,7 +79,7 @@
 	'fails with too few command-line arguments');
 
 # error cases
-# -c
+# -c / --commit-timestamp-ids=xid,xid
 command_fails_like(
 	[ 'pg_resetwal', '-c' => 'foo', $node->data_dir ],
 	qr/error: invalid argument for option -c/,
@@ -96,7 +96,7 @@
 	[ 'pg_resetwal', '-c' => '10,1', $node->data_dir ],
 	qr/greater than/,
 	'fails with -c value 1 part 2');
-# -e
+# -e / --epoch=xid_epoch
 command_fails_like(
 	[ 'pg_resetwal', '-e' => 'foo', $node->data_dir ],
 	qr/error: invalid argument for option -e/,
@@ -105,12 +105,12 @@
 	[ 'pg_resetwal', '-e' => '-1', $node->data_dir ],
 	qr/must not be -1/,
 	'fails with -e value -1');
-# -l
+# -l / --next-wal-file=walfile
 command_fails_like(
 	[ 'pg_resetwal', '-l' => 'foo', $node->data_dir ],
 	qr/error: invalid argument for option -l/,
 	'fails with incorrect -l option');
-# -m
+# -m / --multixact-ids=mxid,mxid
 command_fails_like(
 	[ 'pg_resetwal', '-m' => 'foo', $node->data_dir ],
 	qr/error: invalid argument for option -m/,
@@ -127,7 +127,7 @@
 	[ 'pg_resetwal', '-m' => '10,0', $node->data_dir ],
 	qr/must not be 0/,
 	'fails with -m value 0 part 2');
-# -o
+# -o / --next-oid=oid
 command_fails_like(
 	[ 'pg_resetwal', '-o' => 'foo', $node->data_dir ],
 	qr/error: invalid argument for option -o/,
@@ -136,7 +136,7 @@
 	[ 'pg_resetwal', '-o' => '0', $node->data_dir ],
 	qr/must not be 0/,
 	'fails with -o value 0');
-# -O
+# -O / --multixact-offset=mxoff
 command_fails_like(
 	[ 'pg_resetwal', '-O' => 'foo', $node->data_dir ],
 	qr/error: invalid argument for option -O/,
@@ -154,7 +154,7 @@
 	[ 'pg_resetwal', '--wal-segsize' => '13', $node->data_dir ],
 	qr/must be a power/,
 	'fails with invalid --wal-segsize value');
-# -u
+# -u / --oldest-transaction-id=xid
 command_fails_like(
 	[ 'pg_resetwal', '-u' => 'foo', $node->data_dir ],
 	qr/error: invalid argument for option -u/,
@@ -163,7 +163,7 @@
 	[ 'pg_resetwal', '-u' => '1', $node->data_dir ],
 	qr/must be greater than/,
 	'fails with -u value too small');
-# -x
+# -x / --next-transaction-id=xid
 command_fails_like(
 	[ 'pg_resetwal', '-x' => 'foo', $node->data_dir ],
 	qr/error: invalid argument for option -x/,
-- 
2.48.1

--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline;
 filename=0003-TAP-tests-consistently-specify-the-pg_ctl-action-bef.patch