1 #! /usr/bin/perl -w -I ..
2 #
3 # Post Office Protocol (POP) Server Tests via check_pop
4 #
5 #
7 use strict;
8 use Test::More;
9 use NPTest;
11 plan tests => 5;
13 my $host_tcp_smtp = getTestParameter(
14 "NP_HOST_TCP_SMTP",
15 "A host providing an STMP Service (a mail server)",
16 "mailhost"
17 );
19 my $host_tcp_pop = getTestParameter(
20 "NP_HOST_TCP_POP",
21 "A host providing a POP Service (a mail server)",
22 $host_tcp_smtp
23 );
25 my $host_nonresponsive = getTestParameter(
26 "NP_HOST_NONRESPONSIVE",
27 "The hostname of system not responsive to network requests",
28 "10.0.0.1",
29 );
31 my $hostname_invalid = getTestParameter(
32 "NP_HOSTNAME_INVALID",
33 "An invalid (not known to DNS) hostname",
34 "nosuchhost",
35 );
37 my %exceptions = ( 2 => "No POP Server present?" );
39 my $t;
40 my $res;
42 $res = NPTest->testCmd( "./check_pop $host_tcp_pop" );
43 cmp_ok( $res->return_code, '==', 0, "POP server ok");
45 $res = NPTest->testCmd( "./check_pop -H $host_tcp_pop -p 110 -w 9 -c 9 -t 10 -e '+OK'");
46 cmp_ok( $res->return_code, '==', 0, "POP server returned +OK");
48 $res = NPTest->testCmd( "./check_pop $host_tcp_pop -p 110 -wt 9 -ct 9 -to 10 -e '+OK'");
49 cmp_ok( $res->return_code, '==', 0, "Old syntax");
51 $res = NPTest->testCmd( "./check_pop $host_nonresponsive" );
52 cmp_ok( $res->return_code, '==', 2, "Non responsive host");
54 $res = NPTest->testCmd( "./check_pop $hostname_invalid" );
55 cmp_ok( $res->return_code, '==', 2, "Invalid host");