21 |
22 |
22 # we require it, it's not a normal module |
23 # we require it, it's not a normal module |
23 require_ok 'blib/nagios/plugins/ius/check_dns-serial' |
24 require_ok 'blib/nagios/plugins/ius/check_dns-serial' |
24 or BAIL_OUT q{can't require the module}; |
25 or BAIL_OUT q{can't require the module}; |
25 |
26 |
26 is_deeply [sort +uniq(qw(a b a c))], [qw(a b c)] => 'uniq helper'; |
27 |
|
28 subtest 'tools' => sub { |
|
29 is_deeply [sort +uniq(qw(a b a c))], [qw(a b c)] => 'uniq helper'; |
|
30 |
|
31 my %google = ( nameservers => [qw/8.8.8.8 8.8.4.4/]); |
|
32 my %level3 = ( nameservers => [qw/209.244.0.3 209.244.0.4/]); |
|
33 |
|
34 my $r1a = Net::DNS::Resolver->new(%google); |
|
35 my $r1b = Net::DNS::Resolver->new(%google); |
|
36 |
|
37 my $r2a = Net::DNS::Resolver->new(%level3); |
|
38 my $r2b = Net::DNS::Resolver->new(%level3); |
|
39 |
|
40 is $r1a, $r1b => 'same google'; |
|
41 is $r2a, $r2b => 'same level3'; |
|
42 isnt $r1a, $r2a => 'not same google/level3'; |
|
43 |
|
44 my @a; |
|
45 @a = qw[8.8.8.8]; |
|
46 my $r3a = Net::DNS::Resolver->new(nameservers => \@a); |
|
47 @a = qw[8.8.4.4]; |
|
48 my $r3b = Net::DNS::Resolver->new(nameservers => \@a); |
|
49 |
|
50 isnt $r3a, $r3b => 'same ref, but not same object'; |
|
51 |
|
52 }; |
|
53 |
27 |
54 |
28 # get_domains should read a list of names, either from a file |
55 # get_domains should read a list of names, either from a file |
29 # or from the arguments, or from a combination of both |
56 # or from the arguments, or from a combination of both |
30 is_deeply [get_domains(qw(a b c))], [qw(a b c)] => 'domains from list'; |
57 is_deeply [get_domains(qw(a b c))], [qw(a b c)] => 'domains from list'; |
31 is_deeply [get_domains("$tmp")], [qw(a b c)] => 'domains from file'; |
58 is_deeply [get_domains("$tmp")], [qw(a b c)] => 'domains from file'; |