1 #! /usr/bin/perl -w -I ..
2 #
3 # Post Office Protocol (POP) Server Tests via check_pop
4 #
5 # $Id$
6 #
8 use strict;
9 use Test::More;
10 use NPTest;
12 plan tests => 5;
14 my $host_tcp_smtp = getTestParameter(
15 "NP_HOST_TCP_SMTP",
16 "A host providing an STMP Service (a mail server)",
17 "mailhost"
18 );
20 my $host_tcp_pop = getTestParameter(
21 "NP_HOST_TCP_POP",
22 "A host providing a POP Service (a mail server)",
23 $host_tcp_smtp
24 );
26 my $host_nonresponsive = getTestParameter(
27 "NP_HOST_NONRESPONSIVE",
28 "The hostname of system not responsive to network requests",
29 "10.0.0.1",
30 );
32 my $hostname_invalid = getTestParameter(
33 "NP_HOSTNAME_INVALID",
34 "An invalid (not known to DNS) hostname",
35 "nosuchhost",
36 );
38 my %exceptions = ( 2 => "No POP Server present?" );
40 my $t;
41 my $res;
43 $res = NPTest->testCmd( "./check_pop $host_tcp_pop" );
44 cmp_ok( $res->return_code, '==', 0, "POP server ok");
46 $res = NPTest->testCmd( "./check_pop -H $host_tcp_pop -p 110 -w 9 -c 9 -t 10 -e '+OK'");
47 cmp_ok( $res->return_code, '==', 0, "POP server returned +OK");
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");
52 $res = NPTest->testCmd( "./check_pop $host_nonresponsive" );
53 cmp_ok( $res->return_code, '==', 2, "Non responsive host");
55 $res = NPTest->testCmd( "./check_pop $hostname_invalid" );
56 cmp_ok( $res->return_code, '==', 2, "Invalid host");