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