diff options
| author | Daniel Gustafsson | 2022-02-11 19:54:44 +0000 |
|---|---|---|
| committer | Daniel Gustafsson | 2022-02-11 19:54:44 +0000 |
| commit | 549ec201d6132b7c7ee11ee90a4e02119259ba5b (patch) | |
| tree | 44c1669ef24c66233c16b2fa77aff148596f67a7 /src/bin/scripts | |
| parent | 751b8d23b788580bbff7463e3959f9a92a95b28a (diff) | |
Replace Test::More plans with done_testing
Rather than doing manual book keeping to plan the number of tests to run
in each TAP suite, conclude each run with done_testing() summing up the
the number of tests that ran. This removes the need for maintaning and
updating the plan count at the expense of an accurate count of remaining
during the test suite runtime.
This patch has been discussed a number of times, often in the context of
other patches which updates tests, so a larger number of discussions can
be found in the archives.
Reviewed-by: Julien Rouhaud <rjuju123@gmail.com>
Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Discussion: https://postgr.es/m/DD399313-3D56-4666-8079-88949DAC870F@yesql.se
Diffstat (limited to 'src/bin/scripts')
| -rw-r--r-- | src/bin/scripts/t/010_clusterdb.pl | 4 | ||||
| -rw-r--r-- | src/bin/scripts/t/011_clusterdb_all.pl | 4 | ||||
| -rw-r--r-- | src/bin/scripts/t/020_createdb.pl | 4 | ||||
| -rw-r--r-- | src/bin/scripts/t/040_createuser.pl | 4 | ||||
| -rw-r--r-- | src/bin/scripts/t/050_dropdb.pl | 4 | ||||
| -rw-r--r-- | src/bin/scripts/t/070_dropuser.pl | 4 | ||||
| -rw-r--r-- | src/bin/scripts/t/080_pg_isready.pl | 4 | ||||
| -rw-r--r-- | src/bin/scripts/t/090_reindexdb.pl | 4 | ||||
| -rw-r--r-- | src/bin/scripts/t/091_reindexdb_all.pl | 4 | ||||
| -rw-r--r-- | src/bin/scripts/t/100_vacuumdb.pl | 4 | ||||
| -rw-r--r-- | src/bin/scripts/t/101_vacuumdb_all.pl | 4 | ||||
| -rw-r--r-- | src/bin/scripts/t/102_vacuumdb_stages.pl | 4 | ||||
| -rw-r--r-- | src/bin/scripts/t/200_connstr.pl | 4 |
13 files changed, 39 insertions, 13 deletions
diff --git a/src/bin/scripts/t/010_clusterdb.pl b/src/bin/scripts/t/010_clusterdb.pl index 0878d9fcbb1..3d9abbbcc39 100644 --- a/src/bin/scripts/t/010_clusterdb.pl +++ b/src/bin/scripts/t/010_clusterdb.pl @@ -6,7 +6,7 @@ use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 14; +use Test::More; program_help_ok('clusterdb'); program_version_ok('clusterdb'); @@ -34,3 +34,5 @@ $node->issues_sql_like( $node->command_ok([qw(clusterdb --echo --verbose dbname=template1)], 'clusterdb with connection string'); + +done_testing(); diff --git a/src/bin/scripts/t/011_clusterdb_all.pl b/src/bin/scripts/t/011_clusterdb_all.pl index 81e03a20d03..7818988976c 100644 --- a/src/bin/scripts/t/011_clusterdb_all.pl +++ b/src/bin/scripts/t/011_clusterdb_all.pl @@ -6,7 +6,7 @@ use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 2; +use Test::More; my $node = PostgreSQL::Test::Cluster->new('main'); $node->init; @@ -20,3 +20,5 @@ $node->issues_sql_like( [ 'clusterdb', '-a' ], qr/statement: CLUSTER.*statement: CLUSTER/s, 'cluster all databases'); + +done_testing(); diff --git a/src/bin/scripts/t/020_createdb.pl b/src/bin/scripts/t/020_createdb.pl index c54c291b7ad..639245466e8 100644 --- a/src/bin/scripts/t/020_createdb.pl +++ b/src/bin/scripts/t/020_createdb.pl @@ -6,7 +6,7 @@ use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 25; +use Test::More; program_help_ok('createdb'); program_version_ok('createdb'); @@ -75,3 +75,5 @@ $node->command_checks_all( qr/^createdb: error: database creation failed: ERROR: invalid locale name|^createdb: error: database creation failed: ERROR: new LC_CTYPE \(foo'; SELECT '1\) is incompatible with the LC_CTYPE of the template database/s ], 'createdb with incorrect --lc-ctype'); + +done_testing(); diff --git a/src/bin/scripts/t/040_createuser.pl b/src/bin/scripts/t/040_createuser.pl index e31e5b0c623..2a34be81cf6 100644 --- a/src/bin/scripts/t/040_createuser.pl +++ b/src/bin/scripts/t/040_createuser.pl @@ -6,7 +6,7 @@ use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 17; +use Test::More; program_help_ok('createuser'); program_version_ok('createuser'); @@ -35,3 +35,5 @@ $node->issues_sql_like( $node->command_fails([ 'createuser', 'regress_user1' ], 'fails if role already exists'); + +done_testing(); diff --git a/src/bin/scripts/t/050_dropdb.pl b/src/bin/scripts/t/050_dropdb.pl index 1e08cbbf7f9..4e946667d5e 100644 --- a/src/bin/scripts/t/050_dropdb.pl +++ b/src/bin/scripts/t/050_dropdb.pl @@ -6,7 +6,7 @@ use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 13; +use Test::More; program_help_ok('dropdb'); program_version_ok('dropdb'); @@ -30,3 +30,5 @@ $node->issues_sql_like( $node->command_fails([ 'dropdb', 'nonexistent' ], 'fails with nonexistent database'); + +done_testing(); diff --git a/src/bin/scripts/t/070_dropuser.pl b/src/bin/scripts/t/070_dropuser.pl index c4fb6329bae..e4eac2186de 100644 --- a/src/bin/scripts/t/070_dropuser.pl +++ b/src/bin/scripts/t/070_dropuser.pl @@ -6,7 +6,7 @@ use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 11; +use Test::More; program_help_ok('dropuser'); program_version_ok('dropuser'); @@ -24,3 +24,5 @@ $node->issues_sql_like( $node->command_fails([ 'dropuser', 'regress_nonexistent' ], 'fails with nonexistent user'); + +done_testing(); diff --git a/src/bin/scripts/t/080_pg_isready.pl b/src/bin/scripts/t/080_pg_isready.pl index 951c0e069c4..e8436dc7e8a 100644 --- a/src/bin/scripts/t/080_pg_isready.pl +++ b/src/bin/scripts/t/080_pg_isready.pl @@ -6,7 +6,7 @@ use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 10; +use Test::More; program_help_ok('pg_isready'); program_version_ok('pg_isready'); @@ -21,3 +21,5 @@ $node->start; # use a long timeout for the benefit of very slow buildfarm machines $node->command_ok([qw(pg_isready --timeout=60)], 'succeeds with server running'); + +done_testing(); diff --git a/src/bin/scripts/t/090_reindexdb.pl b/src/bin/scripts/t/090_reindexdb.pl index 1306fb12341..70cd7606dd9 100644 --- a/src/bin/scripts/t/090_reindexdb.pl +++ b/src/bin/scripts/t/090_reindexdb.pl @@ -6,7 +6,7 @@ use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 58; +use Test::More; program_help_ok('reindexdb'); program_version_ok('reindexdb'); @@ -199,3 +199,5 @@ $node->command_checks_all( qr/^reindexdb: warning: cannot reindex system catalogs concurrently, skipping all/s ], 'parallel reindexdb for system with --concurrently skips catalogs'); + +done_testing(); diff --git a/src/bin/scripts/t/091_reindexdb_all.pl b/src/bin/scripts/t/091_reindexdb_all.pl index 47e8341de3f..378bf9060e9 100644 --- a/src/bin/scripts/t/091_reindexdb_all.pl +++ b/src/bin/scripts/t/091_reindexdb_all.pl @@ -5,7 +5,7 @@ use strict; use warnings; use PostgreSQL::Test::Cluster; -use Test::More tests => 2; +use Test::More; my $node = PostgreSQL::Test::Cluster->new('main'); $node->init; @@ -17,3 +17,5 @@ $node->issues_sql_like( [ 'reindexdb', '-a' ], qr/statement: REINDEX.*statement: REINDEX/s, 'reindex all databases'); + +done_testing(); diff --git a/src/bin/scripts/t/100_vacuumdb.pl b/src/bin/scripts/t/100_vacuumdb.pl index ee3bfdb6d05..96a818a3c16 100644 --- a/src/bin/scripts/t/100_vacuumdb.pl +++ b/src/bin/scripts/t/100_vacuumdb.pl @@ -6,7 +6,7 @@ use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 58; +use Test::More; program_help_ok('vacuumdb'); program_version_ok('vacuumdb'); @@ -146,3 +146,5 @@ $node->issues_sql_like( [ 'vacuumdb', '--min-xid-age', '2147483001', 'postgres' ], qr/GREATEST.*relfrozenxid.*2147483001/, 'vacuumdb --table --min-xid-age'); + +done_testing(); diff --git a/src/bin/scripts/t/101_vacuumdb_all.pl b/src/bin/scripts/t/101_vacuumdb_all.pl index 6e8962154ca..1dcf4117671 100644 --- a/src/bin/scripts/t/101_vacuumdb_all.pl +++ b/src/bin/scripts/t/101_vacuumdb_all.pl @@ -5,7 +5,7 @@ use strict; use warnings; use PostgreSQL::Test::Cluster; -use Test::More tests => 2; +use Test::More; my $node = PostgreSQL::Test::Cluster->new('main'); $node->init; @@ -15,3 +15,5 @@ $node->issues_sql_like( [ 'vacuumdb', '-a' ], qr/statement: VACUUM.*statement: VACUUM/s, 'vacuum all databases'); + +done_testing(); diff --git a/src/bin/scripts/t/102_vacuumdb_stages.pl b/src/bin/scripts/t/102_vacuumdb_stages.pl index c94e9e1d642..caff3a3a0da 100644 --- a/src/bin/scripts/t/102_vacuumdb_stages.pl +++ b/src/bin/scripts/t/102_vacuumdb_stages.pl @@ -5,7 +5,7 @@ use strict; use warnings; use PostgreSQL::Test::Cluster; -use Test::More tests => 4; +use Test::More; my $node = PostgreSQL::Test::Cluster->new('main'); $node->init; @@ -36,3 +36,5 @@ $node->issues_sql_like( .*statement:\ RESET\ default_statistics_target; .*statement:\ ANALYZE/sx, 'analyze more than one database in stages'); + +done_testing(); diff --git a/src/bin/scripts/t/200_connstr.pl b/src/bin/scripts/t/200_connstr.pl index 6d75af1d6cb..c865146a6f8 100644 --- a/src/bin/scripts/t/200_connstr.pl +++ b/src/bin/scripts/t/200_connstr.pl @@ -6,7 +6,7 @@ use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 3; +use Test::More; # Tests to check connection string handling in utilities @@ -40,3 +40,5 @@ $node->command_ok([qw(reindexdb --all --echo)], $node->command_ok( [qw(clusterdb --all --echo --verbose)], 'clusterdb --all with unusual database names'); + +done_testing(); |
