-
Notifications
You must be signed in to change notification settings - Fork 120
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
Require network testing enabled for t/redirect.t #351
Conversation
533b490
to
8d0b3b0
Compare
Codecov Report
@@ Coverage Diff @@
## master #351 +/- ##
=======================================
Coverage 59.21% 59.21%
=======================================
Files 15 15
Lines 1378 1378
Branches 384 384
=======================================
Hits 816 816
Misses 380 380
Partials 182 182 Continue to review full report at Codecov.
|
use LWP::UserAgent; | ||
plan tests => 4; | ||
use Test::More; | ||
use Test::RequiresInternet; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be use Test::RequiresInternet '198.51.100.123';
?
(Also, what is this IP? I know, from previous discussions in PRs, but it is not explained in the tests. If it has specific behaviour that the test expects, that should be explicitly stated in case we ever have to find an equivalent replacement.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0$ git diff
diff --git a/t/redirect.t b/t/redirect.t
index 8aa8c09b..004f29f5 100644
--- a/t/redirect.t
+++ b/t/redirect.t
@@ -2,7 +2,7 @@ use strict;
use warnings;
use Test::More;
-use Test::RequiresInternet;
+use Test::RequiresInternet '198.51.100.123';
use LWP::UserAgent ();
# This is a regression test for #171
$ prove -lv t/redirect.t
Must supply server and a port pairs. You supplied 198.51.100.123
With the incantation below, the test just hangs:
$ git diff
diff --git a/t/redirect.t b/t/redirect.t
index 8aa8c09b..a85a8673 100644
--- a/t/redirect.t
+++ b/t/redirect.t
@@ -2,7 +2,7 @@ use strict;
use warnings;
use Test::More;
-use Test::RequiresInternet;
+use Test::RequiresInternet ( '198.51.100.123' => 80 );
use LWP::UserAgent ();
# This is a regression test for #171
With the incantation in this patch:
$ prove -lv t/redirect.t
ok 1 - Timeout gives a client warning
ok 2 - ... and has tells us about the problem
ok 3 - Timeout with no redirects gives a client warning
ok 4 - ... and has tells us about the problem
ok
All tests successful.
Files=1, Tests=4, 2 wallclock secs ( 0.02 usr 0.00 sys + 0.09 cusr 0.02 csys = 0.13 CPU)
Result: PASS
$ NO_NETWORK_TESTING=1 prove -lv t/redirect.t
skipped: NO_NETWORK_TESTING
Files=1, Tests=0, 0 wallclock secs ( 0.01 usr 0.00 sys + 0.05 cusr 0.01 csys = 0.07 CPU)
Result: NOTEST
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding the IP, there's a comment in this commit: 63bbe49
https://tools.ietf.org/html/rfc5737
- Documentation Address Blocks
The blocks 192.0.2.0/24 (TEST-NET-1), 198.51.100.0/24 (TEST-NET-2),
and 203.0.113.0/24 (TEST-NET-3) are provided for use in
documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct me if I'm wrong: 198.51.100.123'
is not in 198.51.100.0/24
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
198.51.100.0/24 should be 192.51.100.0 right through to 192.51.100.255 (/24 encompasses the entire bottom octet).
8d0b3b0
to
826e0b7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Fixes #350