From f63d249984e33030c7e4b3fd97ebe3f034abce3c Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Sat, 8 Mar 2025 23:42:06 +0100 Subject: Adapt further test to changed output --- plugins/t/check_http.t | 2 +- plugins/t/check_jabber.t | 2 +- plugins/t/check_ldap.t | 2 +- plugins/t/check_ntp.t | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/t/check_http.t b/plugins/t/check_http.t index 6ab4a5b6..bb1fd27d 100644 --- a/plugins/t/check_http.t +++ b/plugins/t/check_http.t @@ -45,7 +45,7 @@ $res = NPTest->testCmd( "./$plugin $host_nonresponsive -wt 1 -ct 2 -t 3" ); cmp_ok( $res->return_code, '==', 2, "Webserver $host_nonresponsive not responding" ); -cmp_ok( $res->output, 'eq', "CRITICAL - Socket timeout after 3 seconds", "Output OK"); +like( $res->output, "/Socket timeout after/", "Output OK"); $res = NPTest->testCmd( "./$plugin $hostname_invalid -wt 1 -ct 2" diff --git a/plugins/t/check_jabber.t b/plugins/t/check_jabber.t index fcdae179..08cadcbd 100644 --- a/plugins/t/check_jabber.t +++ b/plugins/t/check_jabber.t @@ -17,7 +17,7 @@ my $hostname_invalid = getTestParameter("NP_HOSTNAME_INVALID", "An invalid (no my $jabberOK = '/JABBER OK\s-\s\d+\.\d+\ssecond response time on '.$host_tcp_jabber.' port 5222/'; -my $jabberUnresponsive = '/CRITICAL\s-\sSocket timeout after\s\d+\sseconds/'; +my $jabberUnresponsive = '/Socket timeout after\s\d+\sseconds/'; my $jabberInvalid = '/JABBER CRITICAL - Invalid hostname, address or socket:\s.+/'; diff --git a/plugins/t/check_ldap.t b/plugins/t/check_ldap.t index b8a4a766..fcba0393 100644 --- a/plugins/t/check_ldap.t +++ b/plugins/t/check_ldap.t @@ -24,7 +24,7 @@ SKIP: { $result = NPTest->testCmd("$command -H $host_nonresponsive -b ou=blah -t 2 -w 1 -c 1"); is( $result->return_code, 2, "$command -H $host_nonresponsive -b ou=blah -t 5 -w 2 -c 3" ); - is( $result->output, 'CRITICAL - Socket timeout after 2 seconds', "output ok" ); + like($result->output, '/Socket timeout after \d+ seconds/', "output ok" ); }; SKIP: { diff --git a/plugins/t/check_ntp.t b/plugins/t/check_ntp.t index b8fc8fdf..e7bb76e3 100644 --- a/plugins/t/check_ntp.t +++ b/plugins/t/check_ntp.t @@ -37,7 +37,7 @@ my $ntp_critmatch1 = '/^NTP\sCRITICAL:\sOffset\s-?[0-9]+(\.[0-9]+)?(e-[0-9]{2})? my $ntp_okmatch2 = '/^NTP\sOK:\sOffset\s-?[0-9]+(\.[0-9]+)?(e-[0-9]{2})?\ssecs,\sjitter=[0-9]+\.[0-9]+,\sstratum=[0-9]{1,2},\struechimers=[0-9]+/'; my $ntp_warnmatch2 = '/^NTP\sWARNING:\sOffset\s-?[0-9]+(\.[0-9]+)?(e-[0-9]{2})?\ssecs,\sjitter=[0-9]+\.[0-9]+,\sstratum=[0-9]{1,2}\s\(WARNING\),\struechimers=[0-9]+/'; my $ntp_critmatch2 = '/^NTP\sCRITICAL:\sOffset\s-?[0-9]+(\.[0-9]+)?(e-[0-9]{2})?\ssecs,\sjitter=[0-9]+\.[0-9]+\s\(CRITICAL\),\sstratum=[0-9]{1,2},\struechimers=[0-9]+/'; -my $ntp_noresponse = '/^(CRITICAL - Socket timeout after 3 seconds)|(NTP CRITICAL: No response from NTP server)$/'; +my $ntp_noresponse = '/^(.*Socket timeout after \d+ seconds.*)|.*No response from NTP server.*)$/'; my $ntp_nosuchhost = '/^check_ntp.*: Invalid hostname/address - ' . $hostname_invalid . '/'; -- cgit v1.2.3-74-g34f1