[monitoring-plugins] Enhance regex in test to be more tolerant to ...

Lorenz Kästle git at monitoring-plugins.org
Tue Aug 29 08:30:12 CEST 2023


 Module: monitoring-plugins
 Branch: master
 Commit: c6abf11e021ded0592bd6697040bde93cf64b022
 Author: Lorenz Kästle <lorenz.kaestle at netways.de>
   Date: Mon Aug 28 09:58:27 2023 +0200
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=c6abf11

Enhance regex in test to be more tolerant to follow up text

---

 plugins/t/check_snmp.t | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/t/check_snmp.t b/plugins/t/check_snmp.t
index 7d5abc2..576cc50 100644
--- a/plugins/t/check_snmp.t
+++ b/plugins/t/check_snmp.t
@@ -172,5 +172,5 @@ SKIP: {
     skip "no non invalid host defined", 2 if ( ! $hostname_invalid );
     $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");
 }



More information about the Commits mailing list