|
324 | 324 | ok(-f "$tempdir/tarbackup/base.tar", 'backup tar was created'); |
325 | 325 | rmtree("$tempdir/tarbackup"); |
326 | 326 |
|
327 | | -$node->command_fails( |
| 327 | +$node->command_fails_like( |
328 | 328 | [ |
329 | 329 | @pg_basebackup_defs, |
330 | 330 | '--pgdata' => "$tempdir/backup_foo", |
331 | 331 | '--format' => 'plain', |
332 | 332 | '--tablespace-mapping' => '=/foo' |
333 | 333 | ], |
| 334 | + qr/invalid tablespace mapping format/, |
334 | 335 | '--tablespace-mapping with empty old directory fails'); |
335 | | -$node->command_fails( |
| 336 | +$node->command_fails_like( |
336 | 337 | [ |
337 | 338 | @pg_basebackup_defs, |
338 | 339 | '--pgdata' => "$tempdir/backup_foo", |
339 | 340 | '--format' => 'plain', |
340 | 341 | '--tablespace-mapping' => '/foo=' |
341 | 342 | ], |
| 343 | + qr/invalid tablespace mapping format/, |
342 | 344 | '--tablespace-mapping with empty new directory fails'); |
343 | | -$node->command_fails( |
| 345 | +$node->command_fails_like( |
344 | 346 | [ |
345 | 347 | @pg_basebackup_defs, |
346 | 348 | '--pgdata' => "$tempdir/backup_foo", |
347 | 349 | '--format' => 'plain', |
348 | 350 | '--tablespace-mapping' => '/foo=/bar=/baz' |
349 | 351 | ], |
| 352 | + qr/multiple "=" signs in tablespace mapping/, |
350 | 353 | '--tablespace-mapping with multiple = fails'); |
351 | | -$node->command_fails( |
| 354 | +$node->command_fails_like( |
352 | 355 | [ |
353 | 356 | @pg_basebackup_defs, |
354 | 357 | '--pgdata' => "$tempdir/backup_foo", |
355 | 358 | '--format' => 'plain', |
356 | 359 | '--tablespace-mapping' => 'foo=/bar' |
357 | 360 | ], |
| 361 | + qr/old directory is not an absolute path in tablespace mapping/, |
358 | 362 | '--tablespace-mapping with old directory not absolute fails'); |
359 | | -$node->command_fails( |
| 363 | +$node->command_fails_like( |
360 | 364 | [ |
361 | 365 | @pg_basebackup_defs, |
362 | 366 | '--pgdata' => "$tempdir/backup_foo", |
363 | 367 | '--format' => 'plain', |
364 | 368 | '--tablespace-mapping' => '/foo=bar' |
365 | 369 | ], |
| 370 | + qr/new directory is not an absolute path in tablespace mapping/, |
366 | 371 | '--tablespace-mapping with new directory not absolute fails'); |
367 | | -$node->command_fails( |
| 372 | +$node->command_fails_like( |
368 | 373 | [ |
369 | 374 | @pg_basebackup_defs, |
370 | 375 | '--pgdata' => "$tempdir/backup_foo", |
371 | 376 | '--format' => 'plain', |
372 | 377 | '--tablespace-mapping' => 'foo' |
373 | 378 | ], |
| 379 | + qr/invalid tablespace mapping format/, |
374 | 380 | '--tablespace-mapping with invalid format fails'); |
375 | 381 |
|
376 | 382 | my $superlongname = "superlongname_" . ("x" x 100); |
|
709 | 715 | '--format' => 'tar' |
710 | 716 | ], |
711 | 717 | qr/cannot specify both format and backup target/, |
712 | | - 'backup target and output directory'); |
| 718 | + 'backup target and format'); |
713 | 719 | $node->command_ok( |
714 | 720 | [ |
715 | 721 | @pg_basebackup_defs, |
|
742 | 748 | 'backup tar was created as non-superuser'); |
743 | 749 | rmtree("$tempdir/backuponserver"); |
744 | 750 |
|
745 | | -$node->command_fails( |
| 751 | +$node->command_fails_like( |
746 | 752 | [ |
747 | 753 | @pg_basebackup_defs, |
748 | 754 | '--pgdata' => "$tempdir/backupxs_sl_fail", |
749 | 755 | '--wal-method' => 'stream', |
750 | 756 | '--slot' => 'slot0' |
751 | 757 | ], |
| 758 | + qr/replication slot "slot0" does not exist/, |
752 | 759 | 'pg_basebackup fails with nonexistent replication slot'); |
753 | 760 |
|
754 | | -$node->command_fails( |
| 761 | +$node->command_fails_like( |
755 | 762 | [ |
756 | 763 | @pg_basebackup_defs, |
757 | 764 | '--pgdata' => "$tempdir/backupxs_slot", |
758 | 765 | '--create-slot' |
759 | 766 | ], |
| 767 | + qr/--create-slot needs a slot to be specified using --slot/, |
760 | 768 | 'pg_basebackup --create-slot fails without slot name'); |
761 | 769 |
|
762 | | -$node->command_fails( |
| 770 | +$node->command_fails_like( |
763 | 771 | [ |
764 | 772 | @pg_basebackup_defs, |
765 | 773 | '--pgdata' => "$tempdir/backupxs_slot", |
766 | 774 | '--create-slot', |
767 | 775 | '--slot' => 'slot0', |
768 | 776 | '--no-slot' |
769 | 777 | ], |
| 778 | + qr/--no-slot cannot be used with slot name/, |
770 | 779 | 'pg_basebackup fails with --create-slot --slot --no-slot'); |
771 | 780 | $node->command_fails_like( |
772 | 781 | [ |
|
785 | 794 | ], |
786 | 795 | 'pg_basebackup --wal-method fetch runs'); |
787 | 796 |
|
788 | | -$node->command_fails( |
789 | | - [ |
790 | | - @pg_basebackup_defs, |
791 | | - '--pgdata' => "$tempdir/backupxs_sl_fail", |
792 | | - '--wal-method' => 'stream', |
793 | | - '--slot' => 'slot0' |
794 | | - ], |
795 | | - 'pg_basebackup fails with nonexistent replication slot'); |
796 | | - |
797 | | -$node->command_fails( |
798 | | - [ |
799 | | - @pg_basebackup_defs, |
800 | | - '--pgdata' => "$tempdir/backupxs_slot", |
801 | | - '--create-slot' |
802 | | - ], |
803 | | - 'pg_basebackup --create-slot fails without slot name'); |
804 | | - |
805 | | -$node->command_fails( |
806 | | - [ |
807 | | - @pg_basebackup_defs, |
808 | | - '--pgdata' => "$tempdir/backupxs_slot", |
809 | | - '--create-slot', |
810 | | - '--slot' => 'slot0', |
811 | | - '--no-slot' |
812 | | - ], |
813 | | - 'pg_basebackup fails with --create-slot --slot --no-slot'); |
814 | | - |
815 | 797 | $node->command_ok( |
816 | 798 | [ |
817 | 799 | @pg_basebackup_defs, |
|
836 | 818 | '', |
837 | 819 | 'restart LSN of new slot is not null'); |
838 | 820 |
|
839 | | -$node->command_fails( |
| 821 | +$node->command_fails_like( |
840 | 822 | [ |
841 | 823 | @pg_basebackup_defs, |
842 | 824 | '--pgdata' => "$tempdir/backupxs_slot1", |
843 | 825 | '--create-slot', |
844 | 826 | '--slot' => 'slot0' |
845 | 827 | ], |
| 828 | + qr/replication slot "slot0" already exists/, |
846 | 829 | 'pg_basebackup fails with --create-slot --slot and a previously existing slot' |
847 | 830 | ); |
848 | 831 |
|
|
0 commit comments