Skip to content

Commit

Permalink
Unit test for NSID support
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandre Pion committed Oct 12, 2022
1 parent 4463084 commit 56ed543
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ t/example.org
t/idn.t
t/load_zonefile.t
t/netldns.t
t/nsid.t
t/packet.t
t/regression.t
t/resolver.t
Expand Down
22 changes: 22 additions & 0 deletions t/nsid.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
use strict;
use warnings;

use Test::More;
use Zonemaster::LDNS;

SKIP: {
skip 'no network', 1 unless $ENV{TEST_WITH_NETWORK};

my $host = '192.134.4.1'; #ns1.nic.fr with nsid: ns1.th3.nic.fr
my $expected_nsid = "ns1.th3.nic.fr";

my $pkt = Zonemaster::LDNS::Packet->new('domain.example');
$pkt->nsid; # set the NSID EDNS option
my $res = Zonemaster::LDNS->new($host)->query_with_pkt($pkt);

my $nsid = $res->get_nsid();

is( $nsid, $expected_nsid, 'Correct NSID' );
};

done_testing();

0 comments on commit 56ed543

Please sign in to comment.