summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Pion <pion@afnic.fr>2022-09-28 18:14:19 +0200
committerAlexandre Pion <pion@afnic.fr>2022-10-12 14:32:14 +0200
commit56ed5438ebe01be1b83b15f7c79177e8015580e0 (patch)
tree701ed48c42f9817dca69215faf064aa36100feb3
parent4463084828de6d632e48fd143126901de52d9536 (diff)
Unit test for NSID support
-rw-r--r--MANIFEST1
-rw-r--r--t/nsid.t22
2 files changed, 23 insertions, 0 deletions
diff --git a/MANIFEST b/MANIFEST
index 2209206..6555fc5 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -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
diff --git a/t/nsid.t b/t/nsid.t
new file mode 100644
index 0000000..f4a5478
--- /dev/null
+++ b/t/nsid.t
@@ -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();