t/10-minimal.t
changeset 20 112e7c316db9
parent 17 07827090c4fc
child 26 d465c78373ca
equal deleted inserted replaced
19:3ea8010e4fbc 20:112e7c316db9
    17 __
    17 __
    18 $tmp->flush;
    18 $tmp->flush;
    19 
    19 
    20 
    20 
    21 sub dig_serial { (split " ", `dig +short SOA @_`)[2] }
    21 sub dig_serial { (split " ", `dig +short SOA @_`)[2] }
    22 
    22 sub dig_ns { sort map { /(\S+?)\.?$/ } `dig +short NS @_` }
    23 sub dig_ns {
       
    24     sort map { /(\S+?)\.?$/ } `dig +short NS @_`;
       
    25 }
       
    26 
    23 
    27 # we require it, it's not a normal module
    24 # we require it, it's not a normal module
    28 require_ok 'blib/nagios/plugins/ius/check_dns-delegation'
    25 use blib;
       
    26 use_ok('Nagios::Check::DNS::delegation')
    29   or BAIL_OUT q{can't require the module};
    27   or BAIL_OUT q{can't require the module};
    30 
    28 
    31 
    29 
    32 subtest 'tools' => sub {
    30 subtest 'tools' => sub {
    33     is_deeply [sort +uniq(qw(a b a c))], [qw(a b c)] => 'uniq helper';
    31     is_deeply [sort +uniq(qw(a b a c))], [qw(a b c)] => 'uniq helper';
    89     };
    87     };
    90 
    88 
    91 }
    89 }
    92 
    90 
    93 # ns for some domain we're not the master for, should be refused
    91 # ns for some domain we're not the master for, should be refused
    94 throws_ok { ns('example.org', nameservers => [qw/f.nic.de a.nic.de b.nic.de/]) }
    92 throws_ok { ns('example.org', nameservers => [qw/f.nic.de a.nic.de/]) }
    95 qr/^REFUSED/ => 'throws on refused query';
    93 qr/^REFUSED/ => 'throws on refused query';
    96 throws_ok { ns('safasdfasdfrandomadsfefvddeas') }
    94 throws_ok { ns('safasdfasdfrandomadsfefvddeas') }
    97 qr/^NXDOMAIN/ => 'throws on nx domain';
    95 qr/^NXDOMAIN/ => 'throws on nx domain';
    98 
    96 
    99 ok ns_ok('schlittermann.de', '212.80.235.130') => 'ns_ok for schlittermann.de';
    97 ok ns_ok('schlittermann.de', '212.80.235.130') => 'ns_ok for schlittermann.de';