From 89df16e7503539c2b0da7e95375b470559bb94ec Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Thu, 13 Mar 2025 00:44:35 +0100 Subject: Adapt tests --- plugins/t/check_tcp.t | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'plugins/t') diff --git a/plugins/t/check_tcp.t b/plugins/t/check_tcp.t index cb4de53d..b47caab3 100644 --- a/plugins/t/check_tcp.t +++ b/plugins/t/check_tcp.t @@ -21,19 +21,19 @@ my $host_nonresponsive = getTestParameter("NP_HOST_NONRESPONSIVE", "The hostname my $hostname_invalid = getTestParameter("NP_HOSTNAME_INVALID", "An invalid (not known to DNS) hostname", "nosuchhost"); my $internet_access = getTestParameter("NP_INTERNET_ACCESS", "Is this system directly connected to the internet?", "yes"); -my $successOutput = '/^TCP OK\s-\s+[0-9]?\.?[0-9]+ second response time on port [0-9]+/'; +my $successOutput = '/Connection time\s+[0-9]?\.?[0-9]+s is within thresholds+/'; -my $failedExpect = '/^TCP WARNING\s-\sUnexpected response from host/socket on port [0-9]+/'; +my $failedExpect = '/\sUnexpected response from host/socket on port [0-9]+/'; my $t; $tests = $tests - 4 if $internet_access eq "no"; plan tests => $tests; -$t += checkCmd( "./check_tcp $host_tcp_http -p 80 -wt 300 -ct 600", 0, $successOutput ); -$t += checkCmd( "./check_tcp $host_tcp_http -p 81 -wt 0 -ct 0 -to 1", 2 ); # use invalid port for this test -$t += checkCmd( "./check_tcp $host_nonresponsive -p 80 -wt 0 -ct 0 -to 1", 2 ); -$t += checkCmd( "./check_tcp $hostname_invalid -p 80 -wt 0 -ct 0 -to 1", 2 ); +$t += checkCmd( "./check_tcp $host_tcp_http -p 80 -w 300 -c 600", 0, $successOutput ); +$t += checkCmd( "./check_tcp $host_tcp_http -p 81 -w 0 -c 0 -t 1", 2 ); # use invalid port for this test +$t += checkCmd( "./check_tcp $host_nonresponsive -p 80 -w 0 -c 0 -t 1", 2 ); +$t += checkCmd( "./check_tcp $hostname_invalid -p 80 -w 0 -c 0 -t 1", 2 ); if($internet_access ne "no") { $t += checkCmd( "./check_tcp -S -D 1 -H $host_tls_http -p 443", 0 ); $t += checkCmd( "./check_tcp -S -D 9000,1 -H $host_tls_http -p 443", 1 ); -- cgit v1.2.3-74-g34f1 From 44211a672959494849476c45ff761181e62762ff Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Thu, 13 Mar 2025 12:59:40 +0100 Subject: Adapt tests more --- plugins/t/check_ftp.t | 2 +- plugins/t/check_jabber.t | 4 ++-- plugins/t/check_udp.t | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'plugins/t') diff --git a/plugins/t/check_ftp.t b/plugins/t/check_ftp.t index 93a7d7c3..a2f79dca 100644 --- a/plugins/t/check_ftp.t +++ b/plugins/t/check_ftp.t @@ -15,7 +15,7 @@ my $host_tcp_ftp = getTestParameter("NP_HOST_TCP_FTP", "A host providing t my $host_nonresponsive = getTestParameter("NP_HOST_NONRESPONSIVE", "The hostname of system not responsive to network requests", "10.0.0.1"); my $hostname_invalid = getTestParameter("NP_HOSTNAME_INVALID", "An invalid (not known to DNS) hostname", "nosuchhost"); -my $successOutput = '/FTP OK -\s+[0-9]?\.?[0-9]+ second response time/'; +my $successOutput = '/Connection time\s+[0-9]?\.?[0-9]+/'; my $t; diff --git a/plugins/t/check_jabber.t b/plugins/t/check_jabber.t index 08cadcbd..dc46f4c3 100644 --- a/plugins/t/check_jabber.t +++ b/plugins/t/check_jabber.t @@ -15,11 +15,11 @@ my $host_nonresponsive = getTestParameter("NP_HOST_NONRESPONSIVE", "The hostname my $hostname_invalid = getTestParameter("NP_HOSTNAME_INVALID", "An invalid (not known to DNS) hostname", "nosuchhost"); -my $jabberOK = '/JABBER OK\s-\s\d+\.\d+\ssecond response time on '.$host_tcp_jabber.' port 5222/'; +my $jabberOK = '/Connection to '.$host_tcp_jabber.' on port 5222/'; my $jabberUnresponsive = '/Socket timeout after\s\d+\sseconds/'; -my $jabberInvalid = '/JABBER CRITICAL - Invalid hostname, address or socket:\s.+/'; +my $jabberInvalid = '/Invalid hostname, address or socket:\s.+/'; my $r; diff --git a/plugins/t/check_udp.t b/plugins/t/check_udp.t index 6c47d095..5cb9e6dc 100644 --- a/plugins/t/check_udp.t +++ b/plugins/t/check_udp.t @@ -28,7 +28,7 @@ like ( $res->output, '/With UDP checks, a send/expect string must be specified. $res = NPTest->testCmd( "./check_udp -H localhost -p 3333 -s foo -e bar" ); cmp_ok( $res->return_code, '==', 2, "Errors correctly because no udp service running" ); -like ( $res->output, '/No data received from host/', "Output OK"); +like ( $res->output, '/Received no data /', "Output OK"); my $nc; if(system("which nc.traditional >/dev/null 2>&1") == 0) { @@ -48,7 +48,7 @@ SKIP: { sleep 1; $res = NPTest->testCmd( "./check_udp -H localhost -p 3333 -s '' -e barbar -4" ); cmp_ok( $res->return_code, '==', 0, "Got barbar response back" ); - like ( $res->output, '/\[barbar\]/', "Output OK"); + like ( $res->output, '/answer of the server matched/', "Output OK"); close NC; # Start up a udp server listening on port 3333, quit after 3 seconds -- cgit v1.2.3-74-g34f1 From c61b5ef06a83b5fa2d48b256532f30ec5def3658 Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Thu, 13 Mar 2025 13:21:10 +0100 Subject: Update more tests to current output --- plugins/t/check_tcp.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/t') diff --git a/plugins/t/check_tcp.t b/plugins/t/check_tcp.t index b47caab3..5c8fd0be 100644 --- a/plugins/t/check_tcp.t +++ b/plugins/t/check_tcp.t @@ -23,7 +23,7 @@ my $internet_access = getTestParameter("NP_INTERNET_ACCESS", "Is this system my $successOutput = '/Connection time\s+[0-9]?\.?[0-9]+s is within thresholds+/'; -my $failedExpect = '/\sUnexpected response from host/socket on port [0-9]+/'; +my $failedExpect = '/Answer failed to match/'; my $t; -- cgit v1.2.3-74-g34f1