From 1a7588b3057dca5d65cfcdad59b96ebee746bc40 Mon Sep 17 00:00:00 2001 From: Nitin Motiani Date: Sat, 15 Feb 2025 04:29:17 +0000 Subject: [PATCH v10 3/5] Add basic tests for pipe-command * This currently only adds a few basic tests for pg_dump with --pipe-command. * These tests include the invalid usages of --pipe-command with other flags. * We are still working on adding other tests in pg_dump.pl. But we ran into some issues which might be related to setup. --- src/bin/pg_dump/t/001_basic.pl | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/bin/pg_dump/t/001_basic.pl b/src/bin/pg_dump/t/001_basic.pl index 509f4f9ce7d..9f49a1fbc32 100644 --- a/src/bin/pg_dump/t/001_basic.pl +++ b/src/bin/pg_dump/t/001_basic.pl @@ -74,6 +74,42 @@ command_fails_like( 'pg_dump: options --statistics-only and --no-statistics cannot be used together' ); +command_fails_like( + [ 'pg_dump', '-Fd', '--pipe-command="cat"', '-f', 'testdir', 'test'], + qr/\Qpg_dump: hint: Only one of [--file, --pipe-command] allowed\E/, + 'pg_dump: hint: Only one of [--file, --pipe-command] allowed' +); + +command_fails_like( + [ 'pg_dump', '-Fd', '--pipe-command="cat"', '-Z', 'gzip', 'test'], + qr/\Qpg_dump: hint: Option --pipe-command is not supported with any compression type\E/, + 'pg_dump: hint: Option --pipe-command is not supported with any compression type' +); + +command_fails_like( + [ 'pg_dump', '-Fd', '--pipe-command="cat"', '--compress=lz4', 'test'], + qr/\Qpg_dump: hint: Option --pipe-command is not supported with any compression type\E/, + 'pg_dump: hint: Option --pipe-command is not supported with any compression type' +); + +command_fails_like( + [ 'pg_dump', '-Fd', '--pipe-command="cat"', '-Z', '1', 'test'], + qr/\Qpg_dump: hint: Option --pipe-command is not supported with any compression type\E/, + 'pg_dump: hint: Option --pipe-command is not supported with any compression type' +); + +command_fails_like( + [ 'pg_dump', '-Fc', '--pipe-command="cat"', 'test'], + qr/\Qpg_dump: hint: Option --pipe-command is only supported with directory format.\E/, + 'pg_dump: hint: Option --pipe-command is only supported with directory format.' +); + +command_fails_like( + [ 'pg_dump', '--format=tar', '--pipe-command="cat"', 'test'], + qr/\Qpg_dump: hint: Option --pipe-command is only supported with directory format.\E/, + 'pg_dump: hint: Option --pipe-command is only supported with directory format.' +); + command_fails_like( [ 'pg_dump', '-j2', '--include-foreign-data=xxx' ], qr/\Qpg_dump: error: option --include-foreign-data is not supported with parallel backup\E/, -- 2.54.0.545.g6539524ca2-goog