Old versions of Test::More

Started by Andrew Dunstanover 8 years ago9 messages
#1Andrew Dunstan
andrew.dunstan@2ndquadrant.com
1 attachment(s)

As we discovered yesterday via jacana, very old versions of Test::More
don't support the note() function. It therefore seems prudent to specify
a minimum version number for the module in those scripts that use the
function. According to the changelog, version 0.82 (released in Oct
2008) should be sufficient. So I suggest the attached patch.

cheers

andrew

--
Andrew Dunstan https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachments:

test-more-version.patchtext/x-diff; name=test-more-version.patchDownload
diff --git a/src/test/recovery/t/001_stream_rep.pl b/src/test/recovery/t/001_stream_rep.pl
index ccd5943..29e648e 100644
--- a/src/test/recovery/t/001_stream_rep.pl
+++ b/src/test/recovery/t/001_stream_rep.pl
@@ -3,7 +3,7 @@ use strict;
 use warnings;
 use PostgresNode;
 use TestLib;
-use Test::More tests => 28;
+use Test::More 0.82 tests => 28;
 
 # Initialize master node
 my $node_master = get_new_node('master');
diff --git a/src/test/recovery/t/010_logical_decoding_timelines.pl b/src/test/recovery/t/010_logical_decoding_timelines.pl
index cdddb4d..bd353ca 100644
--- a/src/test/recovery/t/010_logical_decoding_timelines.pl
+++ b/src/test/recovery/t/010_logical_decoding_timelines.pl
@@ -23,7 +23,7 @@ use warnings;
 
 use PostgresNode;
 use TestLib;
-use Test::More tests => 13;
+use Test::More 0.82 tests => 13;
 use RecursiveCopy;
 use File::Copy;
 use IPC::Run ();
diff --git a/src/test/ssl/t/001_ssltests.pl b/src/test/ssl/t/001_ssltests.pl
index 0c69bf0..4bd905d 100644
--- a/src/test/ssl/t/001_ssltests.pl
+++ b/src/test/ssl/t/001_ssltests.pl
@@ -2,7 +2,7 @@ use strict;
 use warnings;
 use PostgresNode;
 use TestLib;
-use Test::More tests => 40;
+use Test::More 0.82 tests => 40;
 use ServerSetup;
 use File::Copy;
 
#2Daniel Gustafsson
daniel@yesql.se
In reply to: Andrew Dunstan (#1)
1 attachment(s)
Re: Old versions of Test::More

On 21 Apr 2017, at 15:08, Andrew Dunstan <andrew.dunstan@2ndquadrant.com> wrote:

As we discovered yesterday via jacana, very old versions of Test::More
don't support the note() function. It therefore seems prudent to specify
a minimum version number for the module in those scripts that use the
function. According to the changelog, version 0.82 (released in Oct
2008) should be sufficient. So I suggest the attached patch.

+1 for specifying version (0.82 was replaced with 0.84 within hours but it
doesn’t really matter for this). However, since src/test/ssl/ServerSetup.pm
also invoke note() doesn’t it make sense to add the version requirement there
as well as a guard in case a testscript using ServerSetup isn’t explicitly
specifying the Test::More version?

cheers ./daniel

Attachments:

test-more-version-v2.diffapplication/octet-stream; name=test-more-version-v2.diffDownload
diff --git a/src/test/recovery/t/001_stream_rep.pl b/src/test/recovery/t/001_stream_rep.pl
index ccd5943..29e648e 100644
--- a/src/test/recovery/t/001_stream_rep.pl
+++ b/src/test/recovery/t/001_stream_rep.pl
@@ -3,7 +3,7 @@ use strict;
 use warnings;
 use PostgresNode;
 use TestLib;
-use Test::More tests => 28;
+use Test::More 0.82 tests => 28;
 
 # Initialize master node
 my $node_master = get_new_node('master');
diff --git a/src/test/recovery/t/010_logical_decoding_timelines.pl b/src/test/recovery/t/010_logical_decoding_timelines.pl
index cdddb4d..bd353ca 100644
--- a/src/test/recovery/t/010_logical_decoding_timelines.pl
+++ b/src/test/recovery/t/010_logical_decoding_timelines.pl
@@ -23,7 +23,7 @@ use warnings;
 
 use PostgresNode;
 use TestLib;
-use Test::More tests => 13;
+use Test::More 0.82 tests => 13;
 use RecursiveCopy;
 use File::Copy;
 use IPC::Run ();
diff --git a/src/test/ssl/ServerSetup.pm b/src/test/ssl/ServerSetup.pm
index 72d60e8..0e66a62 100644
--- a/src/test/ssl/ServerSetup.pm
+++ b/src/test/ssl/ServerSetup.pm
@@ -22,7 +22,7 @@ use PostgresNode;
 use TestLib;
 use File::Basename;
 use File::Copy;
-use Test::More;
+use Test::More 0.82;
 
 use Exporter 'import';
 our @EXPORT = qw(
diff --git a/src/test/ssl/t/001_ssltests.pl b/src/test/ssl/t/001_ssltests.pl
index 0c69bf0..4bd905d 100644
--- a/src/test/ssl/t/001_ssltests.pl
+++ b/src/test/ssl/t/001_ssltests.pl
@@ -2,7 +2,7 @@ use strict;
 use warnings;
 use PostgresNode;
 use TestLib;
-use Test::More tests => 40;
+use Test::More 0.82 tests => 40;
 use ServerSetup;
 use File::Copy;
 
#3Andrew Dunstan
andrew.dunstan@2ndquadrant.com
In reply to: Daniel Gustafsson (#2)
Re: Old versions of Test::More

On 04/21/2017 10:36 AM, Daniel Gustafsson wrote:

On 21 Apr 2017, at 15:08, Andrew Dunstan <andrew.dunstan@2ndquadrant.com> wrote:

As we discovered yesterday via jacana, very old versions of Test::More
don't support the note() function. It therefore seems prudent to specify
a minimum version number for the module in those scripts that use the
function. According to the changelog, version 0.82 (released in Oct
2008) should be sufficient. So I suggest the attached patch.

+1 for specifying version (0.82 was replaced with 0.84 within hours but it
doesn’t really matter for this). However, since src/test/ssl/ServerSetup.pm
also invoke note() doesn’t it make sense to add the version requirement there
as well as a guard in case a testscript using ServerSetup isn’t explicitly
specifying the Test::More version?

Yeah, good catch. Will do.

cheers

andrew

--
Andrew Dunstan https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andrew Dunstan (#1)
Re: Old versions of Test::More

Andrew Dunstan <andrew.dunstan@2ndquadrant.com> writes:

As we discovered yesterday via jacana, very old versions of Test::More
don't support the note() function. It therefore seems prudent to specify
a minimum version number for the module in those scripts that use the
function. According to the changelog, version 0.82 (released in Oct
2008) should be sufficient. So I suggest the attached patch.

Maybe it'd be better to put the minimum-version check somewhere central,
like PostgresNode.pm? I suppose that our use of "note" will expand,
and I can't see us remembering to put this into all and only the specific
tests that use "note". Especially if there's no comment about it.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#5Andrew Dunstan
andrew.dunstan@2ndquadrant.com
In reply to: Tom Lane (#4)
Re: Old versions of Test::More

On 04/21/2017 10:45 AM, Tom Lane wrote:

Andrew Dunstan <andrew.dunstan@2ndquadrant.com> writes:

As we discovered yesterday via jacana, very old versions of Test::More
don't support the note() function. It therefore seems prudent to specify
a minimum version number for the module in those scripts that use the
function. According to the changelog, version 0.82 (released in Oct
2008) should be sufficient. So I suggest the attached patch.

Maybe it'd be better to put the minimum-version check somewhere central,
like PostgresNode.pm? I suppose that our use of "note" will expand,
and I can't see us remembering to put this into all and only the specific
tests that use "note". Especially if there's no comment about it.

I'll add a comment, but doing it in PostgresNode.pm would mean jacana
(for instance) couldn't run any of the TAP tests. I'mm looking at
installing a sufficiently modern Test::Simple package (includes
Test::More and test::Build) there, but other oldish machines could also
be affected.

cheers

andrew

--
Andrew Dunstan https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#6Peter Eisentraut
peter.eisentraut@2ndquadrant.com
In reply to: Andrew Dunstan (#5)
Re: Old versions of Test::More

On 4/21/17 14:49, Andrew Dunstan wrote:

I'll add a comment, but doing it in PostgresNode.pm would mean jacana
(for instance) couldn't run any of the TAP tests. I'mm looking at
installing a sufficiently modern Test::Simple package (includes
Test::More and test::Build) there, but other oldish machines could also
be affected.

Or you could define note() as an empty function if it doesn't exist.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#7Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter Eisentraut (#6)
Re: Old versions of Test::More

Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:

On 4/21/17 14:49, Andrew Dunstan wrote:

I'll add a comment, but doing it in PostgresNode.pm would mean jacana
(for instance) couldn't run any of the TAP tests. I'mm looking at
installing a sufficiently modern Test::Simple package (includes
Test::More and test::Build) there, but other oldish machines could also
be affected.

Or you could define note() as an empty function if it doesn't exist.

+1. I'm really not at all happy with the prospect that every time
somebody adds a use of "note" to some new TAP test, we're going to
get a complaint later that that test no longer works on jacana.
We need to either decide that non-ancient Test::More is a hard
requirement for all the tests, or fix things with a centralized
solution. A dummy (or not so dummy?) implementation would serve
for the latter.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#8Craig Ringer
craig.ringer@2ndquadrant.com
In reply to: Tom Lane (#7)
Re: Old versions of Test::More

On 22 Apr. 2017 4:23 am, "Tom Lane" <tgl@sss.pgh.pa.us> wrote:

Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:

On 4/21/17 14:49, Andrew Dunstan wrote:

I'll add a comment, but doing it in PostgresNode.pm would mean jacana
(for instance) couldn't run any of the TAP tests. I'mm looking at
installing a sufficiently modern Test::Simple package (includes
Test::More and test::Build) there, but other oldish machines could also
be affected.

Or you could define note() as an empty function if it doesn't exist.

+1. I'm really not at all happy with the prospect that every time
somebody adds a use of "note" to some new TAP test, we're going to
get a complaint later that that test no longer works on jacana.
We need to either decide that non-ancient Test::More is a hard
requirement for all the tests

That seems like a no-brainer TBH. Why are we bothering with backwards
compat with ancient versions of test frameworks? It seems like a colossal
waste of time for no benefit.

or fix things with a centralized
solution. A dummy (or not so dummy?) implementation would serve
for the latter.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#9Andrew Dunstan
andrew.dunstan@2ndquadrant.com
In reply to: Craig Ringer (#8)
Re: Old versions of Test::More

On 04/21/2017 09:22 PM, Craig Ringer wrote:

On 22 Apr. 2017 4:23 am, "Tom Lane" <tgl@sss.pgh.pa.us
<mailto:tgl@sss.pgh.pa.us>> wrote:

Peter Eisentraut <peter.eisentraut@2ndquadrant.com
<mailto:peter.eisentraut@2ndquadrant.com>> writes:

On 4/21/17 14:49, Andrew Dunstan wrote:

I'll add a comment, but doing it in PostgresNode.pm would mean

jacana

(for instance) couldn't run any of the TAP tests. I'mm looking at
installing a sufficiently modern Test::Simple package (includes
Test::More and test::Build) there, but other oldish machines

could also

be affected.

Or you could define note() as an empty function if it doesn't exist.

+1. I'm really not at all happy with the prospect that every time
somebody adds a use of "note" to some new TAP test, we're going to
get a complaint later that that test no longer works on jacana.
We need to either decide that non-ancient Test::More is a hard
requirement for all the tests

That seems like a no-brainer TBH. Why are we bothering with backwards
compat with ancient versions of test frameworks? It seems like a
colossal waste of time for no benefit.

OK, I have pushed a requirement for a minimum version of Test::More into
TestLib.pm, a better place for it than PostgresNode.pm as not all tests
use the latter.

jacana has been upgraded to use a sufficiently modern Test::More.

cheers

andrew

--
Andrew Dunstan https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers