Skip Menu |

This queue is for tickets about the NNTPClient CPAN distribution.

Report information
The Basics
Id: 118799
Status: new
Priority: 0/
Queue: NNTPClient

People
Owner: Nobody in particular
Requestors: ppisar [...] redhat.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.37
Fixed in: (no value)



Subject: Skip network tests by default
Attached patch skips tests that need NNTP server unless EXTENDED_TESTING environment variable is true.
Subject: 0001-Perform-network-tests-only-if-EXTENDED_TESTING-1.patch
From ad9e80ef93d337497aaad8c0bd58314eefdaa4d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com> Date: Wed, 16 Nov 2016 18:09:48 +0100 Subject: [PATCH] Perform network tests only if EXTENDED_TESTING=1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Many tests require configured NNTP server. This is not true for many cases. This patch skips them if EXTENDED_TESTING environment variable is not true. The variable name is defined by <https://github.com/Perl-Toolchain-Gang/toolchain-site/blob/master/lancaster-consensus.md#environment-variables-for-testing-contexts>. Signed-off-by: Petr Písař <ppisar@redhat.com> --- test.pl | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/test.pl b/test.pl index 26a100c..4d7339b 100644 --- a/test.pl +++ b/test.pl @@ -6,7 +6,11 @@ # Change 1..1 below to 1..last_test_to_print . # (It may become useful if the test is moved to ./t subdirectory.) -BEGIN {print "1..37\n";} +BEGIN { + my $test_plan = 7; + $test_plan += 30 if $ENV{EXTENDED_TESTING}; + print "1..$test_plan\n"; +} END {print "not ok 1\n" unless $loaded;} use News::NNTPClient; $loaded = 1; @@ -50,12 +54,22 @@ $c = new News::NNTPClient; $c->gmt(1); $c->fourdigityear(1); -for $f (qw(version debug eol gmt fourdigityear message code - ok okprint postok mode_reader list help)) { +for $f (qw(version debug eol gmt fourdigityear message)) { + print "not " unless $c->$f(); + print "ok ", $i++, " ($f)\n"; +} + +# All test since here require an existing NNTP server +if (!$ENV{EXTENDED_TESTING}) { + exit 0; +} + +for $f (qw(code ok okprint postok mode_reader list help)) { print "not " unless $c->$f(); print "ok ", $i++, " ($f)\n"; } + # slave not supported by inn skip_500_ok(\$i, $c, 'slave'); -- 2.7.4
From: ppisar [...] redhat.com
Dne St 16.lis.2016 12:15:49, ppisar napsal(a): Show quoted text
> Attached patch skips tests that need NNTP server unless > EXTENDED_TESTING environment variable is true.
A better patch. It hides a warning message about too.
Subject: 0001-Perform-network-tests-only-if-EXTENDED_TESTING-1.patch
From 56ff427e14145772485cf04f174e436298d55836 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com> Date: Wed, 16 Nov 2016 18:09:48 +0100 Subject: [PATCH] Perform network tests only if EXTENDED_TESTING=1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Many tests require configured NNTP server. This is not true for many cases. This patch skips them if EXTENDED_TESTING environment variable is not true. The variable name is defined by <https://github.com/Perl-Toolchain-Gang/toolchain-site/blob/master/lancaster-consensus.md#environment-variables-for-testing-contexts>. Signed-off-by: Petr Písař <ppisar@redhat.com> --- test.pl | 46 ++++++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/test.pl b/test.pl index 26a100c..d8e5e12 100644 --- a/test.pl +++ b/test.pl @@ -6,7 +6,11 @@ # Change 1..1 below to 1..last_test_to_print . # (It may become useful if the test is moved to ./t subdirectory.) -BEGIN {print "1..37\n";} +BEGIN { + my $test_plan = 7; + $test_plan += 30 if $ENV{EXTENDED_TESTING}; + print "1..$test_plan\n"; +} END {print "not ok 1\n" unless $loaded;} use News::NNTPClient; $loaded = 1; @@ -18,19 +22,6 @@ print "ok 1\n"; # (correspondingly "not ok 13") depending on the success of chunk 13 # of the test code): -print <<EOF; - - These tests are as much a test of your news server as they are a - test of News::NNTPClient. Not all of these tests will pass. - - The following tests rely on the existence of an available news - server. If the environment variable NNTPSERVER is not set, then - "news" will be used. If you don't have access to a news server, - ok(), okprint(), code(), and postok() will fail. postok() will - also fail if you don't have permission to post. - -EOF - $i = 2; sub skip_500_ok { @@ -50,12 +41,35 @@ $c = new News::NNTPClient; $c->gmt(1); $c->fourdigityear(1); -for $f (qw(version debug eol gmt fourdigityear message code - ok okprint postok mode_reader list help)) { +for $f (qw(version debug eol gmt fourdigityear message)) { + print "not " unless $c->$f(); + print "ok ", $i++, " ($f)\n"; +} + +# All test since here require an existing NNTP server +if (!$ENV{EXTENDED_TESTING}) { + exit 0; +} + +print <<EOF; + + These tests are as much a test of your news server as they are a + test of News::NNTPClient. Not all of these tests will pass. + + The following tests rely on the existence of an available news + server. If the environment variable NNTPSERVER is not set, then + "news" will be used. If you don't have access to a news server, + ok(), okprint(), code(), and postok() will fail. postok() will + also fail if you don't have permission to post. + +EOF + +for $f (qw(code ok okprint postok mode_reader list help)) { print "not " unless $c->$f(); print "ok ", $i++, " ($f)\n"; } + # slave not supported by inn skip_500_ok(\$i, $c, 'slave'); -- 2.7.4