Skip to content

Commit

Permalink
Update obsolete unit test
Browse files Browse the repository at this point in the history
Running make test with TEST_WITH_NETWORK=1 in the environment fails
because the mail exchange (MX) records for iis.se were changed. Now,
it’s a single record of preference 0 pointing to something within the
“microsoft” TLD.

I tried to retain the spirit of the original test by picking another
domain with 2 MX records with non-zero preference values and whose MX
records have a reasonable expectation of stability.
  • Loading branch information
marc-vanderwal committed Jan 29, 2025
1 parent 46c92bb commit 1ac9085
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions t/netldns.t
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ SKIP: {

my $s = Zonemaster::LDNS->new( '8.8.8.8' );
isa_ok( $s, 'Zonemaster::LDNS' );
my $p = $s->query( 'nic.se', 'MX' );
isa_ok( $p, 'Zonemaster::LDNS::Packet' );
is( $p->rcode, 'NOERROR', 'expected rcode' );

my $p2 = $s->query( 'iis.se', 'NS', 'IN' );
isa_ok( $p2, 'Zonemaster::LDNS::Packet' );
Expand Down Expand Up @@ -68,11 +65,15 @@ SKIP: {
ok( $known_ns{ lc($rr->nsdname) }, 'known nsdname (' . $rr->nsdname . ')' );
}

my %known_mx = map { $_ => 1 } qw[mx1.iis.se. mx2.iis.se. ];
foreach my $rr ( $p->answer ) {
is( $rr->preference, 10, 'expected MX preference' );
ok( $known_mx{ lc($rr->exchange) }, 'known MX exchange (' . $rr->exchange . ')' );
}
my $p = $s->query( 'zonemaster.fr', 'MX' );
isa_ok( $p, 'Zonemaster::LDNS::Packet' );
is( $p->rcode, 'NOERROR', 'expected rcode' );

@answer = sort { $a->preference cmp $b->preference } $p->answer;
is( $answer[0]->preference, 7, 'expected MX preference 7' );
is( lc($answer[0]->exchange), 'mx1.nic.fr.', 'known MX exchange mx1.nic.fr' );
is( $answer[1]->preference, 8, 'expected MX preference 8' );
is( lc($answer[1]->exchange), 'mx2.nic.fr.', 'known MX exchange mx2.nic.fr' );

my $lroot = Zonemaster::LDNS->new( '199.7.83.42' );
my $se = $lroot->query( 'se', 'NS' );
Expand Down

0 comments on commit 1ac9085

Please sign in to comment.