Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Net::Ping 2.61 test failures #16211

Open
p5pRT opened this issue Oct 27, 2017 · 5 comments
Open

Net::Ping 2.61 test failures #16211

p5pRT opened this issue Oct 27, 2017 · 5 comments

Comments

@p5pRT
Copy link

p5pRT commented Oct 27, 2017

Migrated from rt.perl.org#132363 (status was 'open')

Searchable as RT132363$

@p5pRT
Copy link
Author

p5pRT commented Oct 27, 2017

From mhasch-cpanbugs@cozap.com

Created by mhasch-cpanbugs@cozap.com

As of version 2.61, the Net​::Ping test suite makes assumptions
about the IPv4 address 172.29.249.249. This is an RFC 1918
address that may or may not be reachable in any local area
network. Making tests fail based on its reachability is
therefore non-portable and should be avoided.

While replacing the RFC 1918 address by an RFC 5737 address
might reduce the risk of it actually being connected there
is no guarantee any address usage convention at all will be
met within private networks. Therefore, in the test suite,
(non-)reachability of a particular address should always be
tolerated.

Interestingly, some tests against "known" internet hosts are
already skipped if an initial ping of "google.com" fails for
some reason. Giving up this particular trigger and making all
connectivity-related checks report skip reasons rather than
failures could be a way to cope with most private and firewalled
network situations.

Even better though would be a test strategy aiming for code
quality criteria independent of outside conditions. This might
be achieved using mock-up interfaces or at most localhost.

If nothing else, at least provide an opt-out configuration
parameter for remote network-aware tests. Currently, PERL_CORE
in the environment will have that effect. Unfortunately, this
parameter usually is a MakeMaker constant not under control
of the user (through distroprefs, say). But not only core may
need to skip those tests.

Regards,
-Martin

Perl Info

Flags:
    category=library
    severity=high
    module=Net::Ping

Site configuration information for perl 5.26.1:

(stripped by reporter, considered irrelevant)

@p5pRT
Copy link
Author

p5pRT commented Oct 28, 2017

From @jkeenan

On Fri, 27 Oct 2017 09​:52​:32 GMT, mhasch-cpanbugs@​cozap.com wrote​:

This is a bug report for perl from mhasch-cpanbugs@​cozap.com,
generated with the help of perlbug 1.40 running under perl 5.26.1.

-----------------------------------------------------------------
[Please describe your issue here]

As of version 2.61, the Net​::Ping test suite makes assumptions
about the IPv4 address 172.29.249.249. This is an RFC 1918
address that may or may not be reachable in any local area
network. Making tests fail based on its reachability is
therefore non-portable and should be avoided.

For the record, I note that Net​::Ping tests using 172.29.249.249 were introduced long before 2.61. They date at least to commit f569508 in October 2002.

While replacing the RFC 1918 address by an RFC 5737 address
might reduce the risk of it actually being connected there
is no guarantee any address usage convention at all will be
met within private networks. Therefore, in the test suite,
(non-)reachability of a particular address should always be
tolerated.

Interestingly, some tests against "known" internet hosts are
already skipped if an initial ping of "google.com" fails for
some reason. Giving up this particular trigger and making all
connectivity-related checks report skip reasons rather than
failures could be a way to cope with most private and firewalled
network situations.

Even better though would be a test strategy aiming for code
quality criteria independent of outside conditions. This might
be achieved using mock-up interfaces or at most localhost.

If nothing else, at least provide an opt-out configuration
parameter for remote network-aware tests. Currently, PERL_CORE
in the environment will have that effect. Unfortunately, this
parameter usually is a MakeMaker constant not under control
of the user (through distroprefs, say). But not only core may
need to skip those tests.

Regards,
-Martin

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags​:
category=library
severity=high
module=Net​::Ping
---
Site configuration information for perl 5.26.1​:

(stripped by reporter, considered irrelevant)

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Oct 28, 2017

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Oct 30, 2017

From mhasch-p5p@cozap.com

On Fri, 27 Oct 2017 02​:52​:32 -0700, I wrote​:

If nothing else, at least provide an opt-out configuration
parameter for remote network-aware tests. Currently, PERL_CORE
in the environment will have that effect. Unfortunately, this
parameter usually is a MakeMaker constant not under control
of the user (through distroprefs, say). But not only core may
need to skip those tests.

Here is a patch introducing another environment variable,
SKIP_NETWORK_TESTS, to skip the same tests that perl core would.

It can be used as a workaround to avoid test failures in private
or firewalled networks, where assumptions about "google.com" or
"172.29.249.249" don't hold. I would still like to see a generally
more portable test strategy though.

-Martin

@p5pRT
Copy link
Author

p5pRT commented Oct 30, 2017

From mhasch-p5p@cozap.com

Net-Ping-2.61-MHASCH-01.patch
diff -Nrup Net-Ping-2.61.orig/t/190_alarm.t Net-Ping-2.61/t/190_alarm.t
--- Net-Ping-2.61.orig/t/190_alarm.t	2016-09-15 10:57:50.000000000 +0200
+++ Net-Ping-2.61/t/190_alarm.t	2017-10-30 09:02:45.249094171 +0100
@@ -4,7 +4,7 @@
 # Based on code written by radu@netsoft.ro (Radu Greab).
 
 BEGIN {
-  if ($ENV{PERL_CORE}) {
+  if ($ENV{PERL_CORE} || $ENV{SKIP_NETWORK_TESTS}) {
     unless ($ENV{PERL_TEST_Net_Ping}) {
       print "1..0 \# Skip: network dependent test\n";
         exit;
diff -Nrup Net-Ping-2.61.orig/t/200_ping_tcp.t Net-Ping-2.61/t/200_ping_tcp.t
--- Net-Ping-2.61.orig/t/200_ping_tcp.t	2017-06-05 12:42:30.000000000 +0200
+++ Net-Ping-2.61/t/200_ping_tcp.t	2017-10-30 09:06:22.261097533 +0100
@@ -1,7 +1,7 @@
 use strict;
 
 BEGIN {
-  if ($ENV{PERL_CORE}) {
+  if ($ENV{PERL_CORE} || $ENV{SKIP_NETWORK_TESTS}) {
     unless ($ENV{PERL_TEST_Net_Ping}) {
       print "1..0 # Skip: network dependent test\n";
         exit;
diff -Nrup Net-Ping-2.61.orig/t/250_ping_hires.t Net-Ping-2.61/t/250_ping_hires.t
--- Net-Ping-2.61.orig/t/250_ping_hires.t	2016-09-15 10:57:50.000000000 +0200
+++ Net-Ping-2.61/t/250_ping_hires.t	2017-10-30 09:06:08.409097317 +0100
@@ -3,7 +3,7 @@
 use strict;
 
 BEGIN {
-  if ($ENV{PERL_CORE}) {
+  if ($ENV{PERL_CORE} || $ENV{SKIP_NETWORK_TESTS}) {
     unless ($ENV{PERL_TEST_Net_Ping}) {
       print "1..0 # Skip: network dependent test\n";
         exit;
diff -Nrup Net-Ping-2.61.orig/t/300_ping_stream.t Net-Ping-2.61/t/300_ping_stream.t
--- Net-Ping-2.61.orig/t/300_ping_stream.t	2016-09-15 10:57:50.000000000 +0200
+++ Net-Ping-2.61/t/300_ping_stream.t	2017-10-30 09:04:08.345095456 +0100
@@ -1,6 +1,6 @@
 use strict; 
 BEGIN {
-  if ($ENV{PERL_CORE}) {
+  if ($ENV{PERL_CORE} || $ENV{SKIP_NETWORK_TESTS}) {
     unless ($ENV{PERL_TEST_Net_Ping}) {
       print "1..0 # Skip: network dependent test\n";
         exit;
diff -Nrup Net-Ping-2.61.orig/t/400_ping_syn.t Net-Ping-2.61/t/400_ping_syn.t
--- Net-Ping-2.61.orig/t/400_ping_syn.t	2017-06-08 07:51:22.000000000 +0200
+++ Net-Ping-2.61/t/400_ping_syn.t	2017-10-30 09:06:51.029097977 +0100
@@ -1,7 +1,7 @@
 use strict;
 
 BEGIN {
-  if ($ENV{PERL_CORE}) {
+  if ($ENV{PERL_CORE} || $ENV{SKIP_NETWORK_TESTS}) {
     unless ($ENV{PERL_TEST_Net_Ping}) {
       print "1..0 # Skip: network dependent test\n";
       exit;
diff -Nrup Net-Ping-2.61.orig/t/410_syn_host.t Net-Ping-2.61/t/410_syn_host.t
--- Net-Ping-2.61.orig/t/410_syn_host.t	2017-01-19 07:34:30.000000000 +0100
+++ Net-Ping-2.61/t/410_syn_host.t	2017-10-30 09:03:49.161095161 +0100
@@ -2,7 +2,7 @@
 use strict;
 
 BEGIN {
-  if ($ENV{PERL_CORE}) {
+  if ($ENV{PERL_CORE} || $ENV{SKIP_NETWORK_TESTS}) {
     unless ($ENV{PERL_TEST_Net_Ping}) {
       print "1..0 # Skip: network dependent test\n";
         exit;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants