t/00-basic.t
changeset 24 d98e12e07560
parent 23 c52bb12b3ed0
child 25 e97dd97b582c
--- a/t/00-basic.t	Thu Jun 02 09:15:31 2016 +0200
+++ b/t/00-basic.t	Tue Jun 07 14:36:03 2016 +0200
@@ -4,22 +4,25 @@
 use Test::Exception;
 
 use_ok 'Nagios::Check::DNS::check_tlsa_record' or BAIL_OUT;
-can_ok 'Nagios::Check::DNS::check_tlsa_record', qw(dig_tlsa) or BAIL_OUT;
+can_ok 'Nagios::Check::DNS::check_tlsa_record', qw(get_tlsa_from_dns) or BAIL_OUT;
 
 # The above package doesn't use the Exporter currently, for shortcut
 # reasons we import the relevant subs into *this* module
-*dig_tlsa = \&Nagios::Check::DNS::check_tlsa_record::dig_tlsa;
+*get_tlsa_from_dns = \&Nagios::Check::DNS::check_tlsa_record::get_tlsa_from_dns;
 
 # API conformance
 subtest 'API' => sub {
-    dies_ok { dig_tlsa('example.org') } 'API: dig_tlsa() missing port';
+    dies_ok { get_tlsa_from_dns('example.org') } 'API: get_tlsa_from_dns() missing port';
 };
 
-# get and compare the TLSA records via dig_tlsa with `dig …`
+# get and compare the TLSA records via get_tlsa_from_dns with `dig …`
 subtest 'Data' => sub {
-    foreach (['ssl.schlittermann.de' => 443], ['mx1.mailbox.org' => 25], ['ssl.kugelbus.de' => 443]) {
+    foreach (['ssl.schlittermann.de' => 443], 
+             ['mx1.mailbox.org' => 25], 
+             ['ssl.kugelbus.de' => 443]) {
         my ($domain, $port) = @$_;
-	my (@tlsa) = map { /^_$port._tcp.\S+\s+\d+\s+IN\s+TLSA\s+(.*\n)/i  } `dig tlsa _$port._tcp.$domain`;
-        is dig_tlsa($domain, $port), $tlsa[0] => "TLSA for $domain:$port";
+        my (@tlsa) = map { /^_$port._tcp.\S+\s+\d+\s+IN\s+TLSA\s+(.*\n)/i  } `dig tlsa _$port._tcp.$domain`;
+	#my (@tlsa) = `dig tlsa _$port._tcp.$domain +short`;
+        is get_tlsa_from_dns($domain, $port), $tlsa[0] => "TLSA for $domain:$port";
     }
 };