diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2006-03-22 15:45:49 (GMT) |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2006-03-22 15:45:49 (GMT) |
commit | 7de561c9122315c7974e0b978de0c74bf3b56973 (patch) | |
tree | 9f1a78e5f127c03f6de1cff5328990b744e489c3 /plugins/t | |
parent | 19559b1884084ddd39ba3182d3a16e60e07e54fc (diff) | |
download | monitoring-plugins-7de561c9122315c7974e0b978de0c74bf3b56973.tar.gz |
Convert to new style tests
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1345 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/t')
-rw-r--r-- | plugins/t/check_pop.t | 54 |
1 files changed, 36 insertions, 18 deletions
diff --git a/plugins/t/check_pop.t b/plugins/t/check_pop.t index e78f963..b78291d 100644 --- a/plugins/t/check_pop.t +++ b/plugins/t/check_pop.t | |||
@@ -6,33 +6,51 @@ | |||
6 | # | 6 | # |
7 | 7 | ||
8 | use strict; | 8 | use strict; |
9 | use Test; | 9 | use Test::More; |
10 | use NPTest; | 10 | use NPTest; |
11 | 11 | ||
12 | use vars qw($tests); | 12 | plan tests => 5; |
13 | BEGIN {$tests = 5; plan tests => $tests} | ||
14 | 13 | ||
15 | my $host_tcp_smtp = getTestParameter( "host_tcp_smtp", "NP_HOST_TCP_SMTP", "mailhost", | 14 | my $host_tcp_smtp = getTestParameter( |
16 | "A host providing an STMP Service (a mail server)"); | 15 | "NP_HOST_TCP_SMTP", |
16 | "A host providing an STMP Service (a mail server)", | ||
17 | "mailhost" | ||
18 | ); | ||
17 | 19 | ||
18 | my $host_tcp_pop = getTestParameter( "host_tcp_pop", "NP_HOST_TCP_POP", $host_tcp_smtp, | 20 | my $host_tcp_pop = getTestParameter( |
19 | "A host providing an POP Service (a mail server)"); | 21 | "NP_HOST_TCP_POP", |
22 | "A host providing a POP Service (a mail server)", | ||
23 | $host_tcp_smtp | ||
24 | ); | ||
20 | 25 | ||
21 | my $host_nonresponsive = getTestParameter( "host_nonresponsive", "NP_HOST_NONRESPONSIVE", "10.0.0.1", | 26 | my $host_nonresponsive = getTestParameter( |
22 | "The hostname of system not responsive to network requests" ); | 27 | "NP_HOST_NONRESPONSIVE", |
28 | "The hostname of system not responsive to network requests", | ||
29 | "10.0.0.1", | ||
30 | ); | ||
23 | 31 | ||
24 | my $hostname_invalid = getTestParameter( "hostname_invalid", "NP_HOSTNAME_INVALID", "nosuchhost", | 32 | my $hostname_invalid = getTestParameter( |
25 | "An invalid (not known to DNS) hostname" ); | 33 | "NP_HOSTNAME_INVALID", |
34 | "An invalid (not known to DNS) hostname", | ||
35 | "nosuchhost", | ||
36 | ); | ||
26 | 37 | ||
27 | my %exceptions = ( 2 => "No POP Server present?" ); | 38 | my %exceptions = ( 2 => "No POP Server present?" ); |
28 | 39 | ||
29 | my $t; | 40 | my $t; |
41 | my $res; | ||
30 | 42 | ||
31 | $t += checkCmd( "./check_pop $host_tcp_pop", 0, undef, %exceptions ); | 43 | $res = NPTest->testCmd( "./check_pop $host_tcp_pop" ); |
32 | $t += checkCmd( "./check_pop -H $host_tcp_pop -p 110 -w 9 -c 9 -t 10 -e '+OK'", 0, undef, %exceptions ); | 44 | cmp_ok( $res->return_code, '==', 0, "POP server ok"); |
33 | $t += checkCmd( "./check_pop $host_tcp_pop -p 110 -wt 9 -ct 9 -to 10 -e '+OK'", 0, undef, %exceptions ); | ||
34 | $t += checkCmd( "./check_pop $host_nonresponsive", 2 ); | ||
35 | $t += checkCmd( "./check_pop $hostname_invalid", 2 ); | ||
36 | 45 | ||
37 | exit(0) if defined($Test::Harness::VERSION); | 46 | $res = NPTest->testCmd( "./check_pop -H $host_tcp_pop -p 110 -w 9 -c 9 -t 10 -e '+OK'"); |
38 | exit($tests - $t); | 47 | cmp_ok( $res->return_code, '==', 0, "POP server returned +OK"); |
48 | |||
49 | $res = NPTest->testCmd( "./check_pop $host_tcp_pop -p 110 -wt 9 -ct 9 -to 10 -e '+OK'"); | ||
50 | cmp_ok( $res->return_code, '==', 0, "Old syntax"); | ||
51 | |||
52 | $res = NPTest->testCmd( "./check_pop $host_nonresponsive" ); | ||
53 | cmp_ok( $res->return_code, '==', 2, "Non responsive host"); | ||
54 | |||
55 | $res = NPTest->testCmd( "./check_pop $hostname_invalid" ); | ||
56 | cmp_ok( $res->return_code, '==', 2, "Invalid host"); | ||