During the development of an unrelated feature, I have experienced failures in a pg_dump test case, specifically
t/002_pg_dump.pl ....... 1825/6052 # Failed test 'defaults_parallel: should not dump COPY fk_reference_test_table second' # at t/002_pg_dump.pl line 3454. This test sets up two tables connected by a foreign key and checks that a data_only dump dumps them ordered so that the primary key table comes first. But because of the way the tests are set up, it also checks that in all other dumps (i.e., non-data_only) it does *not* dump them in that order. This is kind of irrelevant to the test, but there is no way to express in the pg_dump tests to not check certain scenarios. In a non-data_only dump, the order of the tables doesn't matter, because the foreign keys are added at the very end. In parallel dumps, the tables are in addition sorted by size, so the resultant order is different from a single-threaded dump. This can be seen by comparing the dumped TOCs of the defaults_dir_format and defaults_parallel cases. But it all happens to pass the tests right now. In my hacking I have added another test table to the pg_dump test set, which seems to have thrown off the sorting and scheduling, so that the two tables now happen to come out in primary-key-first order anyway, which causes the test to fail. I have developed the attached rough patch to add a third option to pg_dump test cases: besides like and unlike, add a "skip" option to disregard the result of the test. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From 27196fc3a315d44891f2711bbfd90d72ebe4364f Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <pete...@gmx.net> Date: Mon, 27 Aug 2018 08:22:10 +0200 Subject: [PATCH] Add option to skip certain pg_dump tests --- src/bin/pg_dump/t/002_pg_dump.pl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl index 1dd859f1c5..356a7a3f7a 100644 --- a/src/bin/pg_dump/t/002_pg_dump.pl +++ b/src/bin/pg_dump/t/002_pg_dump.pl @@ -1223,6 +1223,7 @@ \n(?:\d\n){5}\\\.\n /xms, like => { data_only => 1, }, + skip => { defaults => 1, }, }, 'COPY test_second_table' => { @@ -3254,6 +3255,7 @@ # Then count all the tests run against each run foreach my $test (sort keys %tests) { + next if $tests{$test}->{skip}->{$test_key}; # postgres is the default database, if it isn't overridden my $test_db = 'postgres'; @@ -3415,6 +3417,8 @@ foreach my $test (sort keys %tests) { + next if $tests{$test}->{skip}->{$test_key}; + my $test_db = 'postgres'; if (defined($pgdump_runs{$run}->{database})) -- 2.18.0