diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2006-03-22 15:45:49 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2006-03-22 15:45:49 +0000 |
commit | 7de561c9122315c7974e0b978de0c74bf3b56973 (patch) | |
tree | 9f1a78e5f127c03f6de1cff5328990b744e489c3 /plugins | |
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')
-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 e78f963e..b78291da 100644 --- a/plugins/t/check_pop.t +++ b/plugins/t/check_pop.t @@ -6,33 +6,51 @@ # use strict; -use Test; +use Test::More; use NPTest; -use vars qw($tests); -BEGIN {$tests = 5; plan tests => $tests} +plan tests => 5; -my $host_tcp_smtp = getTestParameter( "host_tcp_smtp", "NP_HOST_TCP_SMTP", "mailhost", - "A host providing an STMP Service (a mail server)"); +my $host_tcp_smtp = getTestParameter( + "NP_HOST_TCP_SMTP", + "A host providing an STMP Service (a mail server)", + "mailhost" + ); -my $host_tcp_pop = getTestParameter( "host_tcp_pop", "NP_HOST_TCP_POP", $host_tcp_smtp, - "A host providing an POP Service (a mail server)"); +my $host_tcp_pop = getTestParameter( + "NP_HOST_TCP_POP", + "A host providing a POP Service (a mail server)", + $host_tcp_smtp + ); -my $host_nonresponsive = getTestParameter( "host_nonresponsive", "NP_HOST_NONRESPONSIVE", "10.0.0.1", - "The hostname of system not responsive to network requests" ); +my $host_nonresponsive = getTestParameter( + "NP_HOST_NONRESPONSIVE", + "The hostname of system not responsive to network requests", + "10.0.0.1", + ); -my $hostname_invalid = getTestParameter( "hostname_invalid", "NP_HOSTNAME_INVALID", "nosuchhost", - "An invalid (not known to DNS) hostname" ); +my $hostname_invalid = getTestParameter( + "NP_HOSTNAME_INVALID", + "An invalid (not known to DNS) hostname", + "nosuchhost", + ); my %exceptions = ( 2 => "No POP Server present?" ); my $t; +my $res; -$t += checkCmd( "./check_pop $host_tcp_pop", 0, undef, %exceptions ); -$t += checkCmd( "./check_pop -H $host_tcp_pop -p 110 -w 9 -c 9 -t 10 -e '+OK'", 0, undef, %exceptions ); -$t += checkCmd( "./check_pop $host_tcp_pop -p 110 -wt 9 -ct 9 -to 10 -e '+OK'", 0, undef, %exceptions ); -$t += checkCmd( "./check_pop $host_nonresponsive", 2 ); -$t += checkCmd( "./check_pop $hostname_invalid", 2 ); +$res = NPTest->testCmd( "./check_pop $host_tcp_pop" ); +cmp_ok( $res->return_code, '==', 0, "POP server ok"); -exit(0) if defined($Test::Harness::VERSION); -exit($tests - $t); +$res = NPTest->testCmd( "./check_pop -H $host_tcp_pop -p 110 -w 9 -c 9 -t 10 -e '+OK'"); +cmp_ok( $res->return_code, '==', 0, "POP server returned +OK"); + +$res = NPTest->testCmd( "./check_pop $host_tcp_pop -p 110 -wt 9 -ct 9 -to 10 -e '+OK'"); +cmp_ok( $res->return_code, '==', 0, "Old syntax"); + +$res = NPTest->testCmd( "./check_pop $host_nonresponsive" ); +cmp_ok( $res->return_code, '==', 2, "Non responsive host"); + +$res = NPTest->testCmd( "./check_pop $hostname_invalid" ); +cmp_ok( $res->return_code, '==', 2, "Invalid host"); |