New upstream version 2.3.4
This commit is contained in:
		
							parent
							
								
									7c86d65dc2
								
							
						
					
					
						commit
						30f882762f
					
				
					 556 changed files with 90432 additions and 53391 deletions
				
			
		| 
						 | 
				
			
			@ -19,19 +19,19 @@ plan skip_all => "SSH_HOST and SSH_IDENTITY must be defined" unless ($ssh_servic
 | 
			
		|||
plan tests => 42;
 | 
			
		||||
 | 
			
		||||
# Some random check strings/response
 | 
			
		||||
my @responce = ('OK: Everything is fine',
 | 
			
		||||
my @response = ('OK: Everything is fine',
 | 
			
		||||
                'WARNING: Hey, pick me, pick me',
 | 
			
		||||
                'CRITICAL: Shit happens',
 | 
			
		||||
                'UNKNOWN: What can I do for ya',
 | 
			
		||||
                'WOOPS: What did I smoke',
 | 
			
		||||
);
 | 
			
		||||
my @responce_re;
 | 
			
		||||
my @response_re;
 | 
			
		||||
my @check;
 | 
			
		||||
for (@responce) {
 | 
			
		||||
for (@response) {
 | 
			
		||||
	push(@check, "echo $_");
 | 
			
		||||
	my $re_str = $_;
 | 
			
		||||
	$re_str =~ s{(.)} { "\Q$1" }ge;
 | 
			
		||||
	push(@responce_re, $re_str);
 | 
			
		||||
	push(@response_re, $re_str);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
my $result;
 | 
			
		||||
| 
						 | 
				
			
			@ -47,7 +47,7 @@ for (my $i=0; $i<4; $i++) {
 | 
			
		|||
		"./check_by_ssh -i $ssh_key -H $ssh_service -C '$check[$i]; exit $i'"
 | 
			
		||||
		);
 | 
			
		||||
	cmp_ok($result->return_code, '==', $i, "Exit with return code $i");
 | 
			
		||||
	is($result->output, $responce[$i], "Status text is correct for check $i");
 | 
			
		||||
	is($result->output, $response[$i], "Status text is correct for check $i");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
$result = NPTest->testCmd(
 | 
			
		||||
| 
						 | 
				
			
			@ -84,7 +84,7 @@ $result = NPTest->testCmd(
 | 
			
		|||
	"./check_by_ssh -i $ssh_key -H $ssh_service -C '$check[4]; exit 8'"
 | 
			
		||||
	);
 | 
			
		||||
cmp_ok($result->return_code, '==', 8, "Exit with return code 8 (out of bounds)");
 | 
			
		||||
is($result->output, $responce[4], "Return proper status text even with unknown status codes");
 | 
			
		||||
is($result->output, $response[4], "Return proper status text even with unknown status codes");
 | 
			
		||||
 | 
			
		||||
$result = NPTest->testCmd(
 | 
			
		||||
	"./check_by_ssh -i $ssh_key -H $ssh_service -F $ssh_conf -C 'exit 0'"
 | 
			
		||||
| 
						 | 
				
			
			@ -108,7 +108,7 @@ my %linemap = (
 | 
			
		|||
foreach my $line (0, 2, 4, 6) {
 | 
			
		||||
	my $code = $linemap{$line};
 | 
			
		||||
	my $statline = $line+1;
 | 
			
		||||
	is($lines[$line], "$responce[$code]", "multiple checks status text is correct for line $line");
 | 
			
		||||
	is($lines[$line], "$response[$code]", "multiple checks status text is correct for line $line");
 | 
			
		||||
	is($lines[$statline], "STATUS CODE: $code", "multiple check status code is correct for line $line");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -124,7 +124,7 @@ close(PASV) or die("Unable to close '/tmp/check_by_ssh.$$': $!");
 | 
			
		|||
cmp_ok(scalar(@pasv), '==', 1, 'One passive result for one check performed');
 | 
			
		||||
for (0) {
 | 
			
		||||
	if ($pasv[$_]) {
 | 
			
		||||
		like($pasv[$_], '/^\[\d+\] PROCESS_SERVICE_CHECK_RESULT;flint;serv;2;' . $responce_re[2] . '$/', 'proper result for passive check');
 | 
			
		||||
		like($pasv[$_], '/^\[\d+\] PROCESS_SERVICE_CHECK_RESULT;flint;serv;2;' . $response_re[2] . '$/', 'proper result for passive check');
 | 
			
		||||
	} else {
 | 
			
		||||
		fail('proper result for passive check');
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -144,7 +144,7 @@ for (0, 1, 2, 3, 4) {
 | 
			
		|||
	if ($pasv[$_]) {
 | 
			
		||||
		my $ret = $_;
 | 
			
		||||
		$ret = 9 if ($_ == 4);
 | 
			
		||||
		like($pasv[$_], '/^\[\d+\] PROCESS_SERVICE_CHECK_RESULT;flint;c' . $_ . ';' . $ret . ';' . $responce_re[$_] . '$/', "proper result for passive check $_");
 | 
			
		||||
		like($pasv[$_], '/^\[\d+\] PROCESS_SERVICE_CHECK_RESULT;flint;c' . $_ . ';' . $ret . ';' . $response_re[$_] . '$/', "proper result for passive check $_");
 | 
			
		||||
	} else {
 | 
			
		||||
		fail("proper result for passive check $_");
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,7 +23,7 @@ my $mountpoint2_valid = getTestParameter( "NP_MOUNTPOINT2_VALID", "Path to anoth
 | 
			
		|||
if ($mountpoint_valid eq "" or $mountpoint2_valid eq "") {
 | 
			
		||||
	plan skip_all => "Need 2 mountpoints to test";
 | 
			
		||||
} else {
 | 
			
		||||
	plan tests => 78;
 | 
			
		||||
	plan tests => 88;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
$result = NPTest->testCmd( 
 | 
			
		||||
| 
						 | 
				
			
			@ -326,19 +326,19 @@ cmp_ok( $result->return_code, '==', 0, "grouping: exit ok if the sum of free meg
 | 
			
		|||
$result = NPTest->testCmd( "./check_disk -w ". ($free_mb_on_all - 1) ." -c ". ($free_mb_on_all - 1) ." -p $mountpoint_valid -g group -p $mountpoint2_valid" );
 | 
			
		||||
cmp_ok( $result->return_code, '==', 3, "Invalid options: -p must come after groupname");
 | 
			
		||||
 | 
			
		||||
# regex: exit unknown if given regex is not compileable
 | 
			
		||||
# regex: exit unknown if given regex is not compilable
 | 
			
		||||
$result = NPTest->testCmd( "./check_disk -w 1 -c 1 -r '('" );
 | 
			
		||||
cmp_ok( $result->return_code, '==', 3, "Exit UNKNOWN if regex is not compileable");
 | 
			
		||||
cmp_ok( $result->return_code, '==', 3, "Exit UNKNOWN if regex is not compilable");
 | 
			
		||||
 | 
			
		||||
# ignore: exit unknown, if all pathes are deselected using -i
 | 
			
		||||
# ignore: exit unknown, if all paths are deselected using -i
 | 
			
		||||
$result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p $mountpoint_valid -p $mountpoint2_valid -i '$mountpoint_valid' -i '$mountpoint2_valid'" );
 | 
			
		||||
cmp_ok( $result->return_code, '==', 3, "ignore-ereg: Unknown if all fs are ignored (case sensitive)");
 | 
			
		||||
 | 
			
		||||
# ignore: exit unknown, if all pathes are deselected using -I
 | 
			
		||||
# ignore: exit unknown, if all paths are deselected using -I
 | 
			
		||||
$result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p $mountpoint_valid -p $mountpoint2_valid -I '".uc($mountpoint_valid)."' -I '".uc($mountpoint2_valid)."'" );
 | 
			
		||||
cmp_ok( $result->return_code, '==', 3, "ignore-ereg: Unknown if all fs are ignored (case insensitive)");
 | 
			
		||||
 | 
			
		||||
# ignore: exit unknown, if all pathes are deselected using -i
 | 
			
		||||
# ignore: exit unknown, if all paths are deselected using -i
 | 
			
		||||
$result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p $mountpoint_valid -p $mountpoint2_valid -i '.*'" );
 | 
			
		||||
cmp_ok( $result->return_code, '==', 3, "ignore-ereg: Unknown if all fs are ignored using -i '.*'");
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -347,7 +347,32 @@ $result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p $mountpoint_valid -p $mo
 | 
			
		|||
like( $result->output, qr/$mountpoint_valid/, "output data does have $mountpoint_valid in it");
 | 
			
		||||
unlike( $result->output, qr/$mountpoint2_valid/, "output data does not have $mountpoint2_valid in it");
 | 
			
		||||
 | 
			
		||||
# ignore: test if all pathes are listed when ignore regex doesn't match
 | 
			
		||||
# ignore: test if all paths are listed when ignore regex doesn't match
 | 
			
		||||
$result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p $mountpoint_valid -p $mountpoint2_valid -i '^barbazJodsf\$'");
 | 
			
		||||
like( $result->output, qr/$mountpoint_valid/, "ignore: output data does have $mountpoint_valid when regex doesn't match");
 | 
			
		||||
like( $result->output, qr/$mountpoint2_valid/,"ignore: output data does have $mountpoint2_valid when regex doesn't match");
 | 
			
		||||
 | 
			
		||||
# ignore-missing: exit okay, when fs is not accessible
 | 
			
		||||
$result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -p /bob");
 | 
			
		||||
cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay for not existing filesystem /bob");
 | 
			
		||||
like( $result->output, '/^DISK OK - No disks were found for provided parameters; - ignored paths: /bob;.*$/', 'Output OK');
 | 
			
		||||
 | 
			
		||||
# ignore-missing: exit okay, when regex does not match
 | 
			
		||||
$result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -r /bob");
 | 
			
		||||
cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay for regular expression not matching");
 | 
			
		||||
like( $result->output, '/^DISK OK - No disks were found for provided parameters;.*$/', 'Output OK');
 | 
			
		||||
 | 
			
		||||
# ignore-missing: exit okay, when fs with exact match (-E) is not found
 | 
			
		||||
$result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -E -p /etc");
 | 
			
		||||
cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay when exact match does not find fs");
 | 
			
		||||
like( $result->output, '/^DISK OK - No disks were found for provided parameters; - ignored paths: /etc;.*$/', 'Output OK');
 | 
			
		||||
 | 
			
		||||
# ignore-missing: exit okay, when checking one existing fs and one non-existing fs (regex)
 | 
			
		||||
$result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -r '/bob' -r '^/\$'");
 | 
			
		||||
cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay for regular expression not matching");
 | 
			
		||||
like( $result->output, '/^DISK OK - free space: \/ .*$/', 'Output OK');
 | 
			
		||||
 | 
			
		||||
# ignore-missing: exit okay, when checking one existing fs and one non-existing fs (path)
 | 
			
		||||
$result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -p '/bob' -p '/'");
 | 
			
		||||
cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay for regular expression not matching");
 | 
			
		||||
like( $result->output, '/^DISK OK - free space: / .*; - ignored paths: /bob;.*$/', 'Output OK');
 | 
			
		||||
| 
						 | 
				
			
			@ -178,13 +178,13 @@ SKIP: {
 | 
			
		|||
 | 
			
		||||
        $res = NPTest->testCmd( "./$plugin -I $host_tcp_proxy -p $port_tcp_proxy -u http://$host_tcp_http -e 200,301,302");
 | 
			
		||||
        is( $res->return_code, 0, "Proxy HTTP works");
 | 
			
		||||
        like($res->output, qr/OK: Status line output matched/, "Proxy HTTP Output is sufficent");
 | 
			
		||||
        like($res->output, qr/OK: Status line output matched/, "Proxy HTTP Output is sufficient");
 | 
			
		||||
 | 
			
		||||
        $res = NPTest->testCmd( "./$plugin -I $host_tcp_proxy -p $port_tcp_proxy -H $host_tls_http -S -j CONNECT");
 | 
			
		||||
        is( $res->return_code, 0, "Proxy HTTP CONNECT works");
 | 
			
		||||
        like($res->output, qr/HTTP OK:/, "Proxy HTTP CONNECT output sufficent");
 | 
			
		||||
        like($res->output, qr/HTTP OK:/, "Proxy HTTP CONNECT output sufficient");
 | 
			
		||||
 | 
			
		||||
        $res = NPTest->testCmd( "./$plugin -I $host_tcp_proxy -p $port_tcp_proxy -H $host_tls_http -S -j CONNECT:HEAD");
 | 
			
		||||
        is( $res->return_code, 0, "Proxy HTTP CONNECT works with override method");
 | 
			
		||||
        like($res->output, qr/HTTP OK:/, "Proxy HTTP CONNECT output sufficent");
 | 
			
		||||
        like($res->output, qr/HTTP OK:/, "Proxy HTTP CONNECT output sufficient");
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -25,7 +25,7 @@ $t = NPTest->testCmd( "./check_imap $host_tcp_imap -p 143 -wt 9 -ct 9 -to 10 -e
 | 
			
		|||
cmp_ok( $t->return_code, '==', 0, "Check old parameter options" );
 | 
			
		||||
 | 
			
		||||
$t = NPTest->testCmd( "./check_imap $host_nonresponsive" );
 | 
			
		||||
cmp_ok( $t->return_code, '==', 2, "Get error with non reponsive host" );
 | 
			
		||||
cmp_ok( $t->return_code, '==', 2, "Get error with non responsive host" );
 | 
			
		||||
 | 
			
		||||
$t = NPTest->testCmd( "./check_imap $hostname_invalid" );
 | 
			
		||||
cmp_ok( $t->return_code, '==', 2, "Invalid hostname" );
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,7 @@
 | 
			
		|||
#
 | 
			
		||||
#
 | 
			
		||||
# These are the database permissions required for this test:
 | 
			
		||||
#  GRANT SELECT ON $db.* TO $user@$host INDENTIFIED BY '$password';
 | 
			
		||||
#  GRANT SELECT ON $db.* TO $user@$host IDENTIFIED BY '$password';
 | 
			
		||||
#  GRANT SUPER, REPLICATION CLIENT ON *.* TO $user@$host;
 | 
			
		||||
# Check with:
 | 
			
		||||
#  mysql -u$user -p$password -h$host $db
 | 
			
		||||
| 
						 | 
				
			
			@ -23,9 +23,9 @@ plan tests => 15;
 | 
			
		|||
my $bad_login_output = '/Access denied for user /';
 | 
			
		||||
my $mysqlserver         = getTestParameter("NP_MYSQL_SERVER", "A MySQL Server hostname or IP with no slaves setup");
 | 
			
		||||
my $mysqlsocket         = getTestParameter("NP_MYSQL_SOCKET", "Full path to a MySQL Server socket with no slaves setup");
 | 
			
		||||
my $mysql_login_details = getTestParameter("NP_MYSQL_LOGIN_DETAILS", "Command line parameters to specify login access (requires REPLICATION CLIENT privleges)", "-u test -ptest");
 | 
			
		||||
my $mysql_login_details = getTestParameter("NP_MYSQL_LOGIN_DETAILS", "Command line parameters to specify login access (requires REPLICATION CLIENT privileges)", "-u test -ptest");
 | 
			
		||||
my $with_slave          = getTestParameter("NP_MYSQL_WITH_SLAVE", "MySQL server with slaves setup");
 | 
			
		||||
my $with_slave_login    = getTestParameter("NP_MYSQL_WITH_SLAVE_LOGIN", "Login details for server with slave (requires REPLICATION CLIENT privleges)", $mysql_login_details || "-u test -ptest");
 | 
			
		||||
my $with_slave_login    = getTestParameter("NP_MYSQL_WITH_SLAVE_LOGIN", "Login details for server with slave (requires REPLICATION CLIENT privileges)", $mysql_login_details || "-u test -ptest");
 | 
			
		||||
 | 
			
		||||
my $result;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -31,7 +31,7 @@ $result = NPTest->testCmd("./check_mysql_query -q 'SELECT 1+1' -H $mysqlserver $
 | 
			
		|||
cmp_ok( $result->return_code, '==', 0, "Can run query");
 | 
			
		||||
 | 
			
		||||
$result = NPTest->testCmd("./check_mysql_query -H $mysqlserver $mysql_login_details");
 | 
			
		||||
cmp_ok( $result->return_code, '==', 3, "Missing query parmeter");
 | 
			
		||||
cmp_ok( $result->return_code, '==', 3, "Missing query parameter");
 | 
			
		||||
like( $result->output, "/Must specify a SQL query to run/", "Missing query error message");
 | 
			
		||||
 | 
			
		||||
$result = NPTest->testCmd("./check_mysql_query -q 'SELECT 1+1' -H $mysqlserver -u dummy -d mysql");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -36,7 +36,7 @@ cmp_ok( $result->return_code, '==', 1, "Log over 5 minutes old" );
 | 
			
		|||
like  ( $result->output, $warningOutput, "Output for warning correct" );
 | 
			
		||||
 | 
			
		||||
my $now = time;
 | 
			
		||||
# This substitution is dependant on the testcase
 | 
			
		||||
# This substitution is dependent on the testcase
 | 
			
		||||
system( "perl -pe 's/1133537544/$now/' $nagios1 > $nagios1.tmp" ) == 0 or die "Problem with munging $nagios1";
 | 
			
		||||
 | 
			
		||||
$result = NPTest->testCmd(
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,12 +8,14 @@ use strict;
 | 
			
		|||
use Test::More;
 | 
			
		||||
use NPTest;
 | 
			
		||||
 | 
			
		||||
my $host_tcp_smtp      = getTestParameter( "NP_HOST_TCP_SMTP", 
 | 
			
		||||
my $host_tcp_smtp            = getTestParameter( "NP_HOST_TCP_SMTP",
 | 
			
		||||
					   "A host providing an SMTP Service (a mail server)", "mailhost");
 | 
			
		||||
my $host_tcp_smtp_tls  = getTestParameter( "NP_HOST_TCP_SMTP_TLS",
 | 
			
		||||
my $host_tcp_smtp_starttls   = getTestParameter( "NP_HOST_TCP_SMTP_STARTTLS",
 | 
			
		||||
					   "A host providing SMTP with STARTTLS", $host_tcp_smtp);
 | 
			
		||||
my $host_tcp_smtp_nostarttls = getTestParameter( "NP_HOST_TCP_SMTP_NOSTARTTLS",
 | 
			
		||||
					   "A host providing SMTP without STARTTLS", "");
 | 
			
		||||
my $host_tcp_smtp_tls        = getTestParameter( "NP_HOST_TCP_SMTP_TLS",
 | 
			
		||||
					   "A host providing SMTP with TLS", $host_tcp_smtp);
 | 
			
		||||
my $host_tcp_smtp_notls = getTestParameter( "NP_HOST_TCP_SMTP_NOTLS",
 | 
			
		||||
					   "A host providing SMTP without TLS", "");
 | 
			
		||||
 | 
			
		||||
my $host_nonresponsive = getTestParameter( "NP_HOST_NONRESPONSIVE", 
 | 
			
		||||
					   "The hostname of system not responsive to network requests", "10.0.0.1" );
 | 
			
		||||
| 
						 | 
				
			
			@ -22,7 +24,7 @@ my $hostname_invalid   = getTestParameter( "NP_HOSTNAME_INVALID",
 | 
			
		|||
                                           "An invalid (not known to DNS) hostname", "nosuchhost" );
 | 
			
		||||
my $res;
 | 
			
		||||
 | 
			
		||||
plan tests => 10;
 | 
			
		||||
plan tests => 16;
 | 
			
		||||
 | 
			
		||||
SKIP: {
 | 
			
		||||
	skip "No SMTP server defined", 4 unless $host_tcp_smtp;
 | 
			
		||||
| 
						 | 
				
			
			@ -42,22 +44,38 @@ SKIP: {
 | 
			
		|||
		local $TODO = "Output is over two lines";
 | 
			
		||||
		like ( $res->output, qr/^SMTP WARNING/, "Correct error message" );
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	$res = NPTest->testCmd( "./check_smtp -H $host_tcp_smtp --ssl -p 25" );
 | 
			
		||||
	is ($res->return_code, 2, "Check rc of connecting to $host_tcp_smtp with TLS on standard SMTP port" );
 | 
			
		||||
	like ($res->output, qr/^CRITICAL - Cannot make SSL connection\./, "Check output of connecting to $host_tcp_smtp with TLS on standard SMTP port");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SKIP: {
 | 
			
		||||
	skip "No SMTP server with TLS defined", 1 unless $host_tcp_smtp_tls;
 | 
			
		||||
	# SSL connection for TLS
 | 
			
		||||
	$res = NPTest->testCmd( "./check_smtp -H $host_tcp_smtp_tls -p 25 -S" );
 | 
			
		||||
	skip "No SMTP server with STARTTLS defined", 1 unless $host_tcp_smtp_starttls;
 | 
			
		||||
	# SSL connection for STARTTLS
 | 
			
		||||
	$res = NPTest->testCmd( "./check_smtp -H $host_tcp_smtp_starttls -p 25 -S" );
 | 
			
		||||
	is ($res->return_code, 0, "OK, with STARTTLS" );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SKIP: {
 | 
			
		||||
	skip "No SMTP server without TLS defined", 2 unless $host_tcp_smtp_notls;
 | 
			
		||||
	$res = NPTest->testCmd( "./check_smtp -H $host_tcp_smtp_notls -p 25 -S" );
 | 
			
		||||
	is ($res->return_code, 1, "OK, got warning from server without TLS");
 | 
			
		||||
	skip "No SMTP server without STARTTLS defined", 2 unless $host_tcp_smtp_nostarttls;
 | 
			
		||||
	$res = NPTest->testCmd( "./check_smtp -H $host_tcp_smtp_nostarttls -p 25 -S" );
 | 
			
		||||
	is ($res->return_code, 1, "OK, got warning from server without STARTTLS");
 | 
			
		||||
	is ($res->output, "WARNING - TLS not supported by server", "Right error message" );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SKIP: {
 | 
			
		||||
	skip "No SMTP server with TLS defined", 1 unless $host_tcp_smtp_tls;
 | 
			
		||||
	$res = NPTest->testCmd( "./check_smtp -H $host_tcp_smtp_tls --ssl" );
 | 
			
		||||
	is ($res->return_code, 0, "Check rc of connecting to $host_tcp_smtp_tls with TLS" );
 | 
			
		||||
	like ($res->output, qr/^SMTP OK - /, "Check output of connecting to $host_tcp_smtp_tls with TLS" );
 | 
			
		||||
 | 
			
		||||
	my $unused_port = 4465;
 | 
			
		||||
	$res = NPTest->testCmd( "./check_smtp -H $host_tcp_smtp_tls -p $unused_port --ssl" );
 | 
			
		||||
	is ($res->return_code, 2, "Check rc of connecting to $host_tcp_smtp_tls with TLS on unused port $unused_port" );
 | 
			
		||||
	like ($res->output, qr/^connect to address $host_tcp_smtp_tls and port $unused_port: Connection refused/, "Check output of connecting to $host_tcp_smtp_tls with TLS on unused port $unused_port");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
$res = NPTest->testCmd( "./check_smtp $host_nonresponsive" );
 | 
			
		||||
is ($res->return_code, 2, "CRITICAL - host non responding" );
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,22 +26,22 @@ $res = NPTest->testCmd( "./check_snmp -t 1" );
 | 
			
		|||
is( $res->return_code, 3, "No host name" );
 | 
			
		||||
is( $res->output, "No host specified" );
 | 
			
		||||
 | 
			
		||||
$res = NPTest->testCmd( "./check_snmp -H fakehostname" );
 | 
			
		||||
$res = NPTest->testCmd( "./check_snmp -H fakehostname --ignore-mib-parsing-errors" );
 | 
			
		||||
is( $res->return_code, 3, "No OIDs specified" );
 | 
			
		||||
is( $res->output, "No OIDs specified" );
 | 
			
		||||
 | 
			
		||||
$res = NPTest->testCmd( "./check_snmp -H fakehost -o oids -P 3 -U not_a_user --seclevel=rubbish" );
 | 
			
		||||
$res = NPTest->testCmd( "./check_snmp -H fakehost --ignore-mib-parsing-errors -o oids -P 3 -U not_a_user --seclevel=rubbish" );
 | 
			
		||||
is( $res->return_code, 3, "Invalid seclevel" );
 | 
			
		||||
like( $res->output, "/check_snmp: Invalid seclevel - rubbish/" );
 | 
			
		||||
 | 
			
		||||
$res = NPTest->testCmd( "./check_snmp -H fakehost -o oids -P 3c" );
 | 
			
		||||
$res = NPTest->testCmd( "./check_snmp -H fakehost --ignore-mib-parsing-errors -o oids -P 3c" );
 | 
			
		||||
is( $res->return_code, 3, "Invalid protocol" );
 | 
			
		||||
like( $res->output, "/check_snmp: Invalid SNMP version - 3c/" );
 | 
			
		||||
 | 
			
		||||
SKIP: {
 | 
			
		||||
    skip "no snmp host defined", 50 if ( ! $host_snmp );
 | 
			
		||||
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysUpTime.0 -w 1: -c 1:");
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp --ignore-mib-parsing-errors -C $snmp_community -o system.sysUpTime.0 -w 1: -c 1:");
 | 
			
		||||
    cmp_ok( $res->return_code, '==', 0, "Exit OK when querying uptime" );
 | 
			
		||||
    like($res->output, '/^SNMP OK - (\d+)/', "String contains SNMP OK");
 | 
			
		||||
    $res->output =~ /^SNMP OK - (\d+)/;
 | 
			
		||||
| 
						 | 
				
			
			@ -51,111 +51,111 @@ SKIP: {
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
    # some more threshold tests
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysUpTime.0 -c 1");
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp --ignore-mib-parsing-errors -C $snmp_community -o system.sysUpTime.0 -c 1");
 | 
			
		||||
    cmp_ok( $res->return_code, '==', 2, "Threshold test -c 1" );
 | 
			
		||||
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysUpTime.0 -c 1:");
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp --ignore-mib-parsing-errors -C $snmp_community -o system.sysUpTime.0 -c 1:");
 | 
			
		||||
    cmp_ok( $res->return_code, '==', 0, "Threshold test -c 1:" );
 | 
			
		||||
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysUpTime.0 -c ~:1");
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp --ignore-mib-parsing-errors -C $snmp_community -o system.sysUpTime.0 -c ~:1");
 | 
			
		||||
    cmp_ok( $res->return_code, '==', 2, "Threshold test -c ~:1" );
 | 
			
		||||
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysUpTime.0 -c 1:10");
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp --ignore-mib-parsing-errors -C $snmp_community -o system.sysUpTime.0 -c 1:10");
 | 
			
		||||
    cmp_ok( $res->return_code, '==', 2, "Threshold test -c 1:10" );
 | 
			
		||||
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysUpTime.0 -c \@1:10");
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp --ignore-mib-parsing-errors -C $snmp_community -o system.sysUpTime.0 -c \@1:10");
 | 
			
		||||
    cmp_ok( $res->return_code, '==', 0, "Threshold test -c \@1:10" );
 | 
			
		||||
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysUpTime.0 -c 10:1");
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp --ignore-mib-parsing-errors -C $snmp_community -o system.sysUpTime.0 -c 10:1");
 | 
			
		||||
    cmp_ok( $res->return_code, '==', 0, "Threshold test -c 10:1" );
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o .1.3.6.1.2.1.1.3.0 -w 1: -c 1:");
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp --ignore-mib-parsing-errors -C $snmp_community -o .1.3.6.1.2.1.1.3.0 -w 1: -c 1:");
 | 
			
		||||
    cmp_ok( $res->return_code, '==', 0, "Test with numeric OID (no mibs loaded)" );
 | 
			
		||||
    like($res->output, '/^SNMP OK - \d+/', "String contains SNMP OK");
 | 
			
		||||
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysDescr.0");
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp --ignore-mib-parsing-errors -C $snmp_community -o system.sysDescr.0");
 | 
			
		||||
    cmp_ok( $res->return_code, '==', 0, "Exit OK when querying sysDescr" );
 | 
			
		||||
    unlike($res->perf_output, '/sysDescr/', "Perfdata doesn't contain string values");
 | 
			
		||||
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysDescr.0,system.sysDescr.0");
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp --ignore-mib-parsing-errors -C $snmp_community -o system.sysDescr.0,system.sysDescr.0");
 | 
			
		||||
    cmp_ok( $res->return_code, '==', 0, "Exit OK when querying two string OIDs, comma-separated" );
 | 
			
		||||
    like($res->output, '/^SNMP OK - /', "String contains SNMP OK");
 | 
			
		||||
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysDescr.0 -o system.sysDescr.0");
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp --ignore-mib-parsing-errors -C $snmp_community -o system.sysDescr.0 -o system.sysDescr.0");
 | 
			
		||||
    cmp_ok( $res->return_code, '==', 0, "Exit OK when querying two string OIDs, repeated option" );
 | 
			
		||||
    like($res->output, '/^SNMP OK - /', "String contains SNMP OK");
 | 
			
		||||
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunIndex.1 -w 1:1 -c 1:1");
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp --ignore-mib-parsing-errors -C $snmp_community -o host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunIndex.1 -w 1:1 -c 1:1");
 | 
			
		||||
    cmp_ok( $res->return_code, '==', 0, "Exit OK when querying hrSWRunIndex.1" );
 | 
			
		||||
    like($res->output, '/^SNMP OK - 1\s.*$/', "String fits SNMP OK and output format");
 | 
			
		||||
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunIndex.1 -w 0   -c 1:");
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp --ignore-mib-parsing-errors -C $snmp_community -o host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunIndex.1 -w 0   -c 1:");
 | 
			
		||||
    cmp_ok( $res->return_code, '==', 1, "Exit WARNING when querying hrSWRunIndex.1 and warn-th doesn't apply " );
 | 
			
		||||
    like($res->output, '/^SNMP WARNING - \*1\*\s.*$/', "String matches SNMP WARNING and output format");
 | 
			
		||||
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunIndex.1 -w  :0 -c 0");
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp --ignore-mib-parsing-errors -C $snmp_community -o host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunIndex.1 -w  :0 -c 0");
 | 
			
		||||
    cmp_ok( $res->return_code, '==', 2, "Exit CRITICAL when querying hrSWRunIndex.1 and crit-th doesn't apply" );
 | 
			
		||||
    like($res->output, '/^SNMP CRITICAL - \*1\*\s.*$/', "String matches SNMP CRITICAL and output format");
 | 
			
		||||
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o ifIndex.2,ifIndex.1 -w 1:2 -c 1:2");
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp --ignore-mib-parsing-errors -C $snmp_community -o ifIndex.2,ifIndex.1 -w 1:2 -c 1:2");
 | 
			
		||||
    cmp_ok( $res->return_code, '==', 0, "Checking two OIDs at once" );
 | 
			
		||||
    like($res->output, "/^SNMP OK - 2 1/", "Got two values back" );
 | 
			
		||||
    like( $res->perf_output, "/ifIndex.2=2/", "Got 1st perf data" );
 | 
			
		||||
    like( $res->perf_output, "/ifIndex.1=1/", "Got 2nd perf data" );
 | 
			
		||||
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o ifIndex.2,ifIndex.1 -w 1:2,1:2 -c 2:2,2:2");
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp --ignore-mib-parsing-errors -C $snmp_community -o ifIndex.2,ifIndex.1 -w 1:2,1:2 -c 2:2,2:2");
 | 
			
		||||
    cmp_ok( $res->return_code, '==', 2, "Checking critical threshold is passed if any one value crosses" );
 | 
			
		||||
    like($res->output, "/^SNMP CRITICAL - 2 *1*/", "Got two values back" );
 | 
			
		||||
    like( $res->perf_output, "/ifIndex.2=2/", "Got 1st perf data" );
 | 
			
		||||
    like( $res->perf_output, "/ifIndex.1=1/", "Got 2nd perf data" );
 | 
			
		||||
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o host.hrStorage.hrMemorySize.0,host.hrSystem.hrSystemProcesses.0 -w 1:,1: -c 1:,1:");
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp --ignore-mib-parsing-errors -C $snmp_community -o host.hrStorage.hrMemorySize.0,host.hrSystem.hrSystemProcesses.0 -w 1:,1: -c 1:,1:");
 | 
			
		||||
    cmp_ok( $res->return_code, '==', 0, "Exit OK when querying hrMemorySize and hrSystemProcesses");
 | 
			
		||||
    like($res->output, '/^SNMP OK - \d+ \d+/', "String contains hrMemorySize and hrSystemProcesses");
 | 
			
		||||
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunIndex.1 -w \@:0 -c \@0");
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp --ignore-mib-parsing-errors -C $snmp_community -o host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunIndex.1 -w \@:0 -c \@0");
 | 
			
		||||
    cmp_ok( $res->return_code, '==', 0, "Exit OK with inside-range thresholds");
 | 
			
		||||
    like($res->output, '/^SNMP OK - 1\s.*$/', "String matches SNMP OK and output format");
 | 
			
		||||
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o enterprises.ucdavis.laTable.laEntry.laLoad.3");
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp --ignore-mib-parsing-errors -C $snmp_community -o enterprises.ucdavis.laTable.laEntry.laLoad.3");
 | 
			
		||||
    $res->output =~ m/^SNMP OK - (\d+\.\d{2})\s.*$/;
 | 
			
		||||
    my $lower = $1 - 0.05;
 | 
			
		||||
    my $higher = $1 + 0.05;
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o enterprises.ucdavis.laTable.laEntry.laLoad.3 -w $lower -c $higher");
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp --ignore-mib-parsing-errors -C $snmp_community -o enterprises.ucdavis.laTable.laEntry.laLoad.3 -w $lower -c $higher");
 | 
			
		||||
    cmp_ok( $res->return_code, '==', 1, "Exit WARNING with fractionnal arguments");
 | 
			
		||||
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysUpTime.0,host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunIndex.1 -w ,:0 -c ,:2");
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp --ignore-mib-parsing-errors -C $snmp_community -o system.sysUpTime.0,host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunIndex.1 -w ,:0 -c ,:2");
 | 
			
		||||
    cmp_ok( $res->return_code, '==', 1, "Exit WARNING on 2nd threshold");
 | 
			
		||||
    like($res->output, '/^SNMP WARNING - Timeticks:\s\(\d+\)\s+(?:\d+ days?,\s+)?\d+:\d+:\d+\.\d+\s+\*1\*\s.*$/', "First OID returned as string, 2nd checked for thresholds");
 | 
			
		||||
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunIndex.1 -w '' -c ''");
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp --ignore-mib-parsing-errors -C $snmp_community -o host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunIndex.1 -w '' -c ''");
 | 
			
		||||
    cmp_ok( $res->return_code, '==', 0, "Empty thresholds doesn't crash");
 | 
			
		||||
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o host.hrStorage.hrMemorySize.0,host.hrSystem.hrSystemProcesses.0 -w ,,1 -c ,,2");
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp --ignore-mib-parsing-errors -C $snmp_community -o host.hrStorage.hrMemorySize.0,host.hrSystem.hrSystemProcesses.0 -w ,,1 -c ,,2");
 | 
			
		||||
    cmp_ok( $res->return_code, '==', 0, "Skipping first two thresholds on 2 OID check");
 | 
			
		||||
    like($res->output, '/^SNMP OK - \d+ \w+ \d+\s.*$/', "Skipping first two thresholds, result printed rather than parsed");
 | 
			
		||||
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o host.hrStorage.hrMemorySize.0,host.hrSystem.hrSystemProcesses.0 -w ,, -c ,,");
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp --ignore-mib-parsing-errors -C $snmp_community -o host.hrStorage.hrMemorySize.0,host.hrSystem.hrSystemProcesses.0 -w ,, -c ,,");
 | 
			
		||||
    cmp_ok( $res->return_code, '==', 0, "Skipping all thresholds");
 | 
			
		||||
    like($res->output, '/^SNMP OK - \d+ \w+ \d+\s.*$/', "Skipping all thresholds, result printed rather than parsed");
 | 
			
		||||
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysUpTime.0 -c 1000000000000: -u '1/100 sec'");
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp --ignore-mib-parsing-errors -C $snmp_community -o system.sysUpTime.0 -c 1000000000000: -u '1/100 sec'");
 | 
			
		||||
    cmp_ok( $res->return_code, '==', 2, "Timetick used as a threshold");
 | 
			
		||||
    like($res->output, '/^SNMP CRITICAL - \*\d+\* 1\/100 sec.*$/', "Timetick used as a threshold, parsed as numeric");
 | 
			
		||||
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysUpTime.0");
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp --ignore-mib-parsing-errors -C $snmp_community -o system.sysUpTime.0");
 | 
			
		||||
    cmp_ok( $res->return_code, '==', 0, "Timetick used as a string");
 | 
			
		||||
    like($res->output, '/^SNMP OK - Timeticks:\s\(\d+\)\s+(?:\d+ days?,\s+)?\d+:\d+:\d+\.\d+\s.*$/', "Timetick used as a string, result printed rather than parsed");
 | 
			
		||||
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o HOST-RESOURCES-MIB::hrSWRunName.1");
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp --ignore-mib-parsing-errors -C $snmp_community -o HOST-RESOURCES-MIB::hrSWRunName.1");
 | 
			
		||||
    cmp_ok( $res->return_code, '==', 0, "snmp response without datatype");
 | 
			
		||||
    like( $res->output, '/^SNMP OK - "(systemd|init)" \| $/', "snmp response without datatype" );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SKIP: {
 | 
			
		||||
    skip "no SNMP user defined", 1 if ( ! $user_snmp );
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp -o HOST-RESOURCES-MIB::hrSystemUptime.0 -P 3 -U $user_snmp -L noAuthNoPriv");
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_snmp --ignore-mib-parsing-errors -o HOST-RESOURCES-MIB::hrSystemUptime.0 -P 3 -U $user_snmp -L noAuthNoPriv");
 | 
			
		||||
    like( $res->output, '/^SNMP OK - Timeticks:\s\(\d+\)\s+(?:\d+ days?,\s+)?\d+:\d+:\d+\.\d+\s.*$/', "noAuthNoPriv security level works properly" );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -163,14 +163,14 @@ SKIP: {
 | 
			
		|||
# the tests can run on hosts w/o snmp host/community in NPTest.cache. Execution will fail anyway
 | 
			
		||||
SKIP: {
 | 
			
		||||
    skip "no non responsive host defined", 2 if ( ! $host_nonresponsive );
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_nonresponsive -C np_foobar -o system.sysUpTime.0 -w 1: -c 1:");
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $host_nonresponsive --ignore-mib-parsing-errors -C np_foobar -o system.sysUpTime.0 -w 1: -c 1:");
 | 
			
		||||
    cmp_ok( $res->return_code, '==', 2, "Exit CRITICAL with non responsive host" );
 | 
			
		||||
    like($res->output, '/Plugin timed out while executing system call/', "String matches timeout problem");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SKIP: {
 | 
			
		||||
    skip "no non invalid host defined", 2 if ( ! $hostname_invalid );
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $hostname_invalid   -C np_foobar -o system.sysUpTime.0 -w 1: -c 1:");
 | 
			
		||||
    $res = NPTest->testCmd( "./check_snmp -H $hostname_invalid --ignore-mib-parsing-errors -C np_foobar -o system.sysUpTime.0 -w 1: -c 1:");
 | 
			
		||||
    cmp_ok( $res->return_code, '==', 3, "Exit UNKNOWN with non responsive host" );
 | 
			
		||||
    like($res->output, '/External command error: .*(nosuchhost|Name or service not known|Unknown host)/', "String matches invalid host");
 | 
			
		||||
    like($res->output, '/External command error: .*(nosuchhost|Name or service not known|Unknown host).*/s', "String matches invalid host");
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,7 +2,7 @@
 | 
			
		|||
#
 | 
			
		||||
# Logged in Users Tests via check_users
 | 
			
		||||
#
 | 
			
		||||
# Trick: This ckeck requires at least 1 user logged in. These commands should
 | 
			
		||||
# Trick: This check requires at least 1 user logged in. These commands should
 | 
			
		||||
#        leave a session open forever in the background:
 | 
			
		||||
#
 | 
			
		||||
#   $ ssh -tt localhost </dev/null >/dev/null 2>/dev/null &
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -84,7 +84,7 @@ foreach my $current_state (keys(%state)) {
 | 
			
		|||
	foreach my $new_state (keys(%state)) {
 | 
			
		||||
		$res = NPTest->testCmd( "./negate -s --$current_state=$new_state ./check_dummy ".$state{$current_state}." 'Fake $new_state'" );
 | 
			
		||||
		is( $res->return_code, $state{$new_state}, "Got fake $new_state (with substitute)" );
 | 
			
		||||
		is( $res->output, uc($new_state).": Fake $new_state", "Substitued fake $new_state output");
 | 
			
		||||
		is( $res->output, uc($new_state).": Fake $new_state", "Substituted fake $new_state output");
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue