Skip to content

Commit

Permalink
RT#120113: Fix sitecheck.opera.com test
Browse files Browse the repository at this point in the history
Service has been modified and as a result, the old check code failed.
Should work more reliably now.
  • Loading branch information
cosimo committed Feb 11, 2017
1 parent f6c26f3 commit 1ec8de7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
4 changes: 2 additions & 2 deletions dist.ini
Expand Up @@ -2,9 +2,9 @@ name = Net-Prober
author = Cosimo Streppone <cosimo@cpan.org>
license = Perl_5
copyright_holder = Cosimo Streppone
copyright_year = 2016
copyright_year = 2017

version = 0.15
version = 0.16

[@Basic]
[PkgVersion]
Expand Down
17 changes: 6 additions & 11 deletions t/http.t
Expand Up @@ -15,28 +15,24 @@ use warnings;

use Data::Dumper;
use LWP::Online ':skip_all';
use Test::More tests => 7;
use Test::More tests => 6;

use Net::Prober;

my $result = Net::Prober::probe_http({
host => 'sitecheck.opera.com',
url => '/ping.html',
md5 => 'f5a3cf5f5891652a2b148d40fb400a84',
timeout => 3.0,
host => 'sitecheck2.opera.com',
url => '/ping',
match => 'pong',
timeout => 5.0,
});

ok($result && ref $result eq 'HASH', 'probe_http() returns a hashref');
ok(exists $result->{ok} && $result->{ok}, 'Page downloaded and MD5 verified');
ok(exists $result->{time}
&& $result->{time} > 0.0
&& $result->{time} <= 3.0,
&& $result->{time} <= 5.0,
"Got an elapsed time too ($result->{time}s)",
);
ok(exists $result->{md5}
&& $result->{md5} eq 'f5a3cf5f5891652a2b148d40fb400a84',
"Got the correct 'md5' value")
or diag($result->{reason});

$result = Net::Prober::probe({
class => 'http',
Expand Down Expand Up @@ -68,4 +64,3 @@ ok(exists $result->{ok} && $result->{ok} == 1,
ok(($t1 - $t0) <= 2,
"Probe of unavailable service should honor timeout"
);

0 comments on commit 1ec8de7

Please sign in to comment.