Skip to content

Commit

Permalink
Fixed so rr.t so it matches current Internet and changed so that test…
Browse files Browse the repository at this point in the history
…s that depend on network are not run by default (issue zonemaster#26)
  • Loading branch information
matsduf committed Dec 6, 2017
1 parent 3f7ab3e commit b84925c
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 22 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
env:
- TEST_WITH_NETWORK=1

language: perl
perl:
- "5.24"
Expand Down
2 changes: 1 addition & 1 deletion t/axfr.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use Test::Fatal;
BEGIN { use_ok( 'Zonemaster::LDNS' ) }

SKIP: {
skip 'no network', 3 if $ENV{TEST_NO_NETWORK};
skip 'no network', 3 unless $ENV{TEST_WITH_NETWORK};

my $res = Zonemaster::LDNS->new( '46.21.106.227' );
my $res2 = Zonemaster::LDNS->new( '192.36.144.107' );
Expand Down
2 changes: 1 addition & 1 deletion t/dnssec.t
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ isa_ok($nsec3, 'Zonemaster::LDNS::RR::NSEC3');
ok($nsec3->covers('xx-example.com'), 'Covers xx-example.com');

SKIP: {
skip 'no network', 3 if $ENV{TEST_NO_NETWORK};
skip 'no network', 3 unless $ENV{TEST_WITH_NETWORK};

$res = Zonemaster::LDNS->new( '212.247.7.228' );
$res->dnssec( 1 );
Expand Down
2 changes: 1 addition & 1 deletion t/netldns.t
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ my $lib_v = version->parse(Zonemaster::LDNS::lib_version());
ok( $lib_v >= v1.6.16, 'ldns version at least 1.6.16' );

SKIP: {
skip 'no network', 59 if $ENV{TEST_NO_NETWORK};
skip 'no network', 59 unless $ENV{TEST_WITH_NETWORK};

my $s = Zonemaster::LDNS->new( '8.8.8.8' );
isa_ok( $s, 'Zonemaster::LDNS' );
Expand Down
2 changes: 1 addition & 1 deletion t/regression.t
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use warnings;
BEGIN { use_ok("Zonemaster::LDNS")}

SKIP: {
skip 'no network', 2 if $ENV{TEST_NO_NETWORK};
skip 'no network', 2 unless $ENV{TEST_WITH_NETWORK};

my $s = Zonemaster::LDNS->new( '8.8.8.8' );
isa_ok( $s, 'Zonemaster::LDNS' );
Expand Down
6 changes: 3 additions & 3 deletions t/resolver.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use Test::More;
use Zonemaster::LDNS;

SKIP: {
skip 'no network', 20 if $ENV{TEST_NO_NETWORK};
skip 'no network', 20 unless $ENV{TEST_WITH_NETWORK};

my $r = Zonemaster::LDNS->new( '8.8.8.8' );

Expand Down Expand Up @@ -59,7 +59,7 @@ SKIP: {

subtest 'recursion' => sub {
SKIP: {
skip 'no network', 3 if $ENV{TEST_NO_NETWORK};
skip 'no network', 3 unless $ENV{TEST_WITH_NETWORK};

my $r = Zonemaster::LDNS->new( '8.8.4.4' );
my $p1 = $r->query( 'www.iis.se' );
Expand All @@ -73,7 +73,7 @@ subtest 'recursion' => sub {

subtest 'global' => sub {
SKIP: {
skip 'no network', 3 if $ENV{TEST_NO_NETWORK};
skip 'no network', 3 unless $ENV{TEST_WITH_NETWORK};

my $res = new_ok( 'Zonemaster::LDNS' );
my $p = eval { $res->query( 'www.iis.se' ) } ;
Expand Down
27 changes: 15 additions & 12 deletions t/rr.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ use MIME::Base64;
BEGIN { use_ok( 'Zonemaster::LDNS' ) }

my $s;
$s = Zonemaster::LDNS->new( '8.8.8.8' ) unless $ENV{TEST_NO_NETWORK};
$s = Zonemaster::LDNS->new( '8.8.8.8' ) if $ENV{TEST_WITH_NETWORK};

subtest 'rdf' => sub {
SKIP: {
skip 'no network', 1 if $ENV{TEST_NO_NETWORK};
skip 'no network', 1 unless $ENV{TEST_WITH_NETWORK};

my $p = $s->query( 'iis.se', 'SOA' );
plan skip_all => 'No response, cannot test' if not $p;
Expand All @@ -27,7 +27,7 @@ subtest 'rdf' => sub {

subtest 'SOA' => sub {
SKIP: {
skip 'no network', 1 if $ENV{TEST_NO_NETWORK};
skip 'no network', 1 unless $ENV{TEST_WITH_NETWORK};

my $p = $s->query( 'iis.se', 'SOA' );
plan skip_all => 'No response, cannot test' if not $p;
Expand All @@ -47,7 +47,7 @@ subtest 'SOA' => sub {

subtest 'A' => sub {
SKIP: {
skip 'no network', 1 if $ENV{TEST_NO_NETWORK};
skip 'no network', 1 unless $ENV{TEST_WITH_NETWORK};

my $p = $s->query( 'a.ns.se' );
plan skip_all => 'No response, cannot test' if not $p;
Expand All @@ -63,7 +63,7 @@ subtest 'A' => sub {

subtest 'AAAA' => sub {
SKIP: {
skip 'no network', 1 if $ENV{TEST_NO_NETWORK};
skip 'no network', 1 unless $ENV{TEST_WITH_NETWORK};

$p = $s->query( 'a.ns.se', 'AAAA' );
plan skip_all => 'No response, cannot test' if not $p;
Expand All @@ -78,7 +78,7 @@ subtest 'AAAA' => sub {

subtest 'TXT' => sub {
SKIP: {
skip 'no network', 1 if $ENV{TEST_NO_NETWORK};
skip 'no network', 1 unless $ENV{TEST_WITH_NETWORK};

my $se = Zonemaster::LDNS->new( '192.36.144.107' );
my $pt = $se->query( 'se', 'TXT' );
Expand All @@ -93,7 +93,7 @@ subtest 'TXT' => sub {

subtest 'DNSKEY' => sub {
SKIP: {
skip 'no network', 1 if $ENV{TEST_NO_NETWORK};
skip 'no network', 1 unless $ENV{TEST_WITH_NETWORK};

my $se = Zonemaster::LDNS->new( '192.36.144.107' );
my $pk = $se->query( 'se', 'DNSKEY' );
Expand All @@ -103,14 +103,15 @@ subtest 'DNSKEY' => sub {
isa_ok( $rr, 'Zonemaster::LDNS::RR::DNSKEY' );
ok( $rr->flags == 256 or $rr->flags == 257 );
is( $rr->protocol, 3 );
is( $rr->algorithm, 5 );
# Alg 8 will replace 5. Now (December 2017) both are used.
is( $rr->algorithm, 5 ) or is( $rr->algorithm, 8 );
}
}
};

subtest 'RRSIG' => sub {
SKIP: {
skip 'no network', 1 if $ENV{TEST_NO_NETWORK};
skip 'no network', 1 unless $ENV{TEST_WITH_NETWORK};

my $se = Zonemaster::LDNS->new( '192.36.144.107' );
my $pr = $se->query( 'se', 'RRSIG' );
Expand All @@ -121,15 +122,17 @@ subtest 'RRSIG' => sub {
is( $rr->signer, 'se.' );
is( $rr->labels, 1 );
if ( $rr->typecovered eq 'DNSKEY' ) {
is( $rr->keytag, 59747 ); # .SE KSK should not change very often
# .SE KSK should not change very often. 59407 will replace 59747.
# Now (December 2017) both are used.
is( $rr->keytag, 59747 ) or is( $rr->keytag, 59407 );
}
}
}
};

subtest 'NSEC' => sub {
SKIP: {
skip 'no network', 1 if $ENV{TEST_NO_NETWORK};
skip 'no network', 1 unless $ENV{TEST_WITH_NETWORK};

my $se = Zonemaster::LDNS->new( '192.36.144.107' );
my $pn = $se->query( 'se', 'NSEC' );
Expand Down Expand Up @@ -163,7 +166,7 @@ subtest 'From string' => sub {

subtest 'DS' => sub {
SKIP: {
skip 'no network', 1 if $ENV{TEST_NO_NETWORK};
skip 'no network', 1 unless $ENV{TEST_WITH_NETWORK};

my $se = Zonemaster::LDNS->new( '192.36.144.107' );
my $pd = $se->query( 'nic.se', 'DS' );
Expand Down
2 changes: 1 addition & 1 deletion t/rrlist.t
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ my $rrl = Zonemaster::LDNS::Packet->new( 'foo.com', 'SOA', 'IN' )->all;
$rrl->pop;

SKIP: {
skip 'no network', 3 if $ENV{TEST_NO_NETWORK};
skip 'no network', 3 unless $ENV{TEST_WITH_NETWORK};

my $s = Zonemaster::LDNS->new( '8.8.8.8' );
my $p = $s->query( 'iis.se', 'SOA' );
Expand Down
2 changes: 1 addition & 1 deletion t/threads.t
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use_ok('Zonemaster::LDNS');
SKIP: {
my $can_use_threads = eval 'use threads; 1';

skip 'no network or no threads', 4 if ( $ENV{TEST_NO_NETWORK} || !$can_use_threads );
skip 'no network or no threads', 4 unless $ENV{TEST_WITH_NETWORK} and $can_use_threads;

my $resolver = Zonemaster::LDNS->new('8.8.8.8');
isa_ok($resolver, 'Zonemaster::LDNS');
Expand Down
2 changes: 1 addition & 1 deletion t/utils.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use Test::More;
BEGIN { use_ok( 'Zonemaster::LDNS' ) }

SKIP: {
skip 'no network', 5 if $ENV{TEST_NO_NETWORK};
skip 'no network', 5 unless $ENV{TEST_WITH_NETWORK};

my $res = new_ok( 'Zonemaster::LDNS', ['8.8.4.4'] );

Expand Down

0 comments on commit b84925c

Please sign in to comment.