From 07d3eb9e2c729b6ab5effc0f664b6d5d9958fa72 Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Tue, 25 Nov 2025 12:31:00 +0100 Subject: check_ldap: modern output implementation --- plugins/t/check_ldap.t | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'plugins/t/check_ldap.t') diff --git a/plugins/t/check_ldap.t b/plugins/t/check_ldap.t index fcba0393..f3162ebb 100644 --- a/plugins/t/check_ldap.t +++ b/plugins/t/check_ldap.t @@ -32,7 +32,7 @@ SKIP: { $result = NPTest->testCmd("$command -H $hostname_invalid -b ou=blah -t 5"); is( $result->return_code, 2, "$command -H $hostname_invalid -b ou=blah -t 5" ); - is( $result->output, 'Could not bind to the LDAP server', "output ok" ); + like( $result->output, '/could not bind to the LDAP server/', "output ok" ); }; SKIP: { @@ -42,30 +42,30 @@ SKIP: { $cmd = "$command -H $host_tcp_ldap -b $ldap_base_dn -t 5 -w 2 -c 3 -3"; $result = NPTest->testCmd($cmd); is( $result->return_code, 0, $cmd ); - like( $result->output, '/^LDAP OK - \d+.\d+ seconds response time\|time=\d+\.\d+s;2\.0+;3\.0+;0\.0+$/', "output ok" ); + like( $result->output, '/connection time \d+.\d+s/', "output ok" ); $cmd = "$command -H $host_tcp_ldap -b $ldap_base_dn -t 5 -w 2 -c 3 -3 -W 10000000 -C 10000001"; $result = NPTest->testCmd($cmd); is( $result->return_code, 0, $cmd ); - like( $result->output, '/^LDAP OK - found \d+ entries in \d+\.\d+ seconds\|time=\d\.\d+s;2\.0+;3\.0+;0\.0+ entries=\d+\.0+;10000000;10000001;0\.0+$/', "output ok" ); + like( $result->output, '/found \d+ entries/', "output ok" ); $cmd = "$command -H $host_tcp_ldap -b $ldap_base_dn -t 5 -w 2 -c 3 -3 -W 10000000: -C 10000001:"; $result = NPTest->testCmd($cmd); is( $result->return_code, 2, $cmd ); - like( $result->output, '/^LDAP CRITICAL - found \d+ entries in \d+\.\d+ seconds\|time=\d\.\d+s;2\.0+;3\.0+;0\.0+ entries=\d+\.0+;10000000:;10000001:;0\.0+$/', "output ok" ); + like( $result->output, '/found \d+ entries/', "output ok" ); $cmd = "$command -H $host_tcp_ldap -b $ldap_base_dn -t 5 -w 2 -c 3 -3 -W 0 -C 0"; $result = NPTest->testCmd($cmd); is( $result->return_code, 2, $cmd ); - like( $result->output, '/^LDAP CRITICAL - found \d+ entries in \d+\.\d+ seconds\|time=\d\.\d+s;2\.0+;3\.0+;0\.0+ entries=\d+\.0+;0;0;0\.0+$/', "output ok" ); + like( $result->output, '/found \d+ entries/', "output ok" ); $cmd = "$command -H $host_tcp_ldap -b $ldap_base_dn -t 5 -w 2 -c 3 -3 -W 10000000: -C 10000001"; $result = NPTest->testCmd($cmd); is( $result->return_code, 1, $cmd ); - like( $result->output, '/^LDAP WARNING - found \d+ entries in \d+\.\d+ seconds\|time=\d\.\d+s;2\.0+;3\.0+;0\.0+ entries=\d+\.0+;10000000:;10000001;0\.0+$/', "output ok" ); + like( $result->output, '/found \d+ entries/', "output ok" ); $cmd = "$command -H $host_tcp_ldap -b $ldap_base_dn -t 5 -w 2 -c 3 -3 -C 10000001"; $result = NPTest->testCmd($cmd); is( $result->return_code, 0, $cmd ); - like( $result->output, '/^LDAP OK - found \d+ entries in \d+\.\d+ seconds\|time=\d\.\d+s;2\.0+;3\.0+;0\.0+ entries=\d+\.0+;;10000001;0\.0+$/', "output ok" ); + like( $result->output, '/found \d+ entries/', "output ok" ); }; -- cgit v1.2.3-74-g34f1