Code

Fix bug #1632072 pointer error in plugins/netutils.c. Add changelog entry for previou...
[nagiosplug.git] / plugins / t / check_tcp.t
1 #! /usr/bin/perl -w -I ..
2 #
3 # TCP Connection Based Tests via check_tcp
4 #
5 # $Id$
6 #
8 use strict;
9 use Test;
10 use NPTest;
12 use vars qw($tests);
13 BEGIN {$tests = 5; plan tests => $tests}
15 my $host_tcp_http      = getTestParameter( "host_tcp_http",      "NP_HOST_TCP_HTTP",      "localhost",
16                                            "A host providing the HTTP Service (a web server)" );
18 my $host_nonresponsive = getTestParameter( "host_nonresponsive", "NP_HOST_NONRESPONSIVE", "10.0.0.1",
19                                            "The hostname of system not responsive to network requests" );
21 my $hostname_invalid   = getTestParameter( "hostname_invalid",   "NP_HOSTNAME_INVALID",   "nosuchhost",
22                                            "An invalid (not known to DNS) hostname" );
24 my $successOutput = '/^TCP OK\s-\s+[0-9]?\.?[0-9]+ second response time on port [0-9]+/';
26 my $t;
28 $t += checkCmd( "./check_tcp $host_tcp_http      -p 80 -wt 300 -ct 600",       0, $successOutput );
29 $t += checkCmd( "./check_tcp $host_tcp_http      -p 81 -wt   0 -ct   0 -to 1", 2 ); # use invalid port for this test
30 $t += checkCmd( "./check_tcp $host_nonresponsive -p 80 -wt   0 -ct   0 -to 1", 2 );
31 $t += checkCmd( "./check_tcp $hostname_invalid   -p 80 -wt   0 -ct   0 -to 1", 2 );
33 exit(0) if defined($Test::Harness::VERSION);
34 exit($tests - $t);