~ubuntu-branches/ubuntu/trusty/nagios-plugins/trusty-proposed

« back to all changes in this revision

Viewing changes to plugins/t/check_tcp.t

  • Committer: Package Import Robot
  • Author(s): Yolanda Robla
  • Date: 2013-12-11 10:09:01 UTC
  • mfrom: (12.2.22 sid)
  • Revision ID: package-import@ubuntu.com-20131211100901-g0kqwx300l24be53
Tags: 1.5-1ubuntu1
* Merge from Debian unstable (LP: #1259863).  Remaining changes:
  - debian/control, debian/rules, debian/nagios-plugins-extra.dirs
     + add package nagios-plugins-extra
     + Suggest nagios-plugins-contrib in the universe package (-extras).
  - debian/control
     - replaces on nagios-plugins-basic (<< 1.4.16-1ubuntu1)
     - conflicts and replaces on nagios-plugins-extra

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 
7
7
use strict;
8
8
use Test;
9
 
use NPTest;
10
 
 
11
 
use vars qw($tests);
12
 
BEGIN {$tests = 7; plan tests => $tests}
 
9
 
 
10
use vars qw($tests $has_ipv6);
 
11
BEGIN {
 
12
    use NPTest;
 
13
    $has_ipv6 = NPTest::has_ipv6();
 
14
    $tests = $has_ipv6 ? 14 : 11;
 
15
    plan tests => $tests;
 
16
}
 
17
 
13
18
 
14
19
my $host_tcp_http      = getTestParameter( "host_tcp_http",      "NP_HOST_TCP_HTTP",      "localhost",
15
20
                                           "A host providing the HTTP Service (a web server)" );
31
36
$t += checkCmd( "./check_tcp $host_nonresponsive -p 80 -wt   0 -ct   0 -to 1", 2 );
32
37
$t += checkCmd( "./check_tcp $hostname_invalid   -p 80 -wt   0 -ct   0 -to 1", 2 );
33
38
$t += checkCmd( "./check_tcp -S -D 1 -H www.verisign.com -p 443",              0 );
34
 
$t += checkCmd( "./check_tcp -S -D 9000,1    -H www.verisign.com -p 443",      0 );
 
39
$t += checkCmd( "./check_tcp -S -D 9000,1    -H www.verisign.com -p 443",      1 );
35
40
$t += checkCmd( "./check_tcp -S -D 9000      -H www.verisign.com -p 443",      1 );
36
41
$t += checkCmd( "./check_tcp -S -D 9000,8999 -H www.verisign.com -p 443",      2 );
37
42
 
39
44
# so that perl doesn't interpret the \r\n and is passed onto command line correctly
40
45
$t += checkCmd( "./check_tcp $host_tcp_http      -p 80 -E -s ".'"GET / HTTP/1.1\r\n\r\n"'." -e 'ThisShouldntMatch' -j", 1, $failedExpect );
41
46
 
 
47
# IPv6 checks
 
48
if($has_ipv6) {
 
49
  $t += checkCmd( "./check_tcp $host_tcp_http      -p 80 -wt 300 -ct 600 -6 ",   0, $successOutput );
 
50
  $t += checkCmd( "./check_tcp -6 -p 80 www.heise.de",                           0 );
 
51
}
 
52
 
42
53
exit(0) if defined($Test::Harness::VERSION);
43
54
exit($tests - $t);