check_imap.t 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #! /usr/bin/perl -w -I ..
  2. #
  3. # Internet Mail Access Protocol (IMAP) Server Tests via check_imap
  4. #
  5. # $Id$
  6. #
  7. use strict;
  8. use Test;
  9. use NPTest;
  10. use vars qw($tests);
  11. BEGIN {$tests = 5; plan tests => $tests}
  12. my $host_tcp_smtp = getTestParameter( "host_tcp_smtp", "NP_HOST_TCP_SMTP", "mailhost",
  13. "A host providing an STMP Service (a mail server)");
  14. my $host_tcp_imap = getTestParameter( "host_tcp_imap", "NP_HOST_TCP_IMAP", $host_tcp_smtp,
  15. "A host providing an IMAP Service (a mail server)");
  16. my $host_nonresponsive = getTestParameter( "host_nonresponsive", "NP_HOST_NONRESPONSIVE", "10.0.0.1",
  17. "The hostname of system not responsive to network requests" );
  18. my $hostname_invalid = getTestParameter( "hostname_invalid", "NP_HOSTNAME_INVALID", "nosuchhost",
  19. "An invalid (not known to DNS) hostname" );
  20. my %exceptions = ( 2 => "No IMAP Server present?" );
  21. my $t;
  22. $t += checkCmd( "./check_imap $host_tcp_imap", 0, undef, %exceptions );
  23. $t += checkCmd( "./check_imap -H $host_tcp_imap -p 143 -w 9 -c 9 -t 10 -e '* OK'", 0, undef, %exceptions );
  24. $t += checkCmd( "./check_imap $host_tcp_imap -p 143 -wt 9 -ct 9 -to 10 -e '* OK'", 0, undef, %exceptions );
  25. $t += checkCmd( "./check_imap $host_nonresponsive", 2 );
  26. $t += checkCmd( "./check_imap $hostname_invalid", 2 );
  27. exit(0) if defined($Test::Harness::VERSION);
  28. exit($tests - $t);