commit 209b41aad5fa2c49ea437ec1528028b741eea487 Author: Nitin Motiani Date: Sat Feb 15 04:29:17 2025 +0000 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. diff --git a/src/bin/pg_dump/t/001_basic.pl b/src/bin/pg_dump/t/001_basic.pl index 84ca25e17d6..3badd335f8c 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/,