New upstream version 2.3.4

This commit is contained in:
Jan Wagner 2023-10-18 07:29:37 +00:00
parent e7bdd1c6c6
commit de72f6f588
556 changed files with 90432 additions and 53391 deletions

View file

@ -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 $_");
}