Просмотр исходного кода

Merge pull request #766 from tsadpbb/update-regex-for-test-and-output-of-check_icmp

Fix regex in test suite for updated output and keep output of plugin consistent
dylan-at-nagios 1 год назад
Родитель
Сommit
240e75899b
3 измененных файлов с 7 добавлено и 3 удалено
  1. 4 0
      NEWS
  2. 1 1
      plugins-root/check_icmp.c
  3. 2 2
      plugins-root/t/check_icmp.t

+ 4 - 0
NEWS

@@ -2,6 +2,10 @@ This file documents the major additions and syntax changes between releases.
 2.4.10 2024-04-30
 	FIXES
 	check_mailq: Add config directory option and update pattern matching for exim mailservers (#754)
+	check_icmp: Very minor change to plugin output
+
+	TESTS
+	Update majority of the test suite to working condition
 
 2.4.9 2024-03-21
 	FIXES

+ 1 - 1
plugins-root/check_icmp.c

@@ -1528,7 +1528,7 @@ static void finish(int sig) {
       }
     } else {
       /* !icmp_recv */
-      printf("%s", host->name);
+      printf("%s:", host->name);
       /* rta text output */
       if (rta_mode) {
         if (status == STATE_OK) {

+ 2 - 2
plugins-root/t/check_icmp.t

@@ -18,8 +18,8 @@ if ($allow_sudo eq "yes" or $> == 0) {
 }
 my $sudo = $> == 0 ? '' : 'sudo';
 
-my $successOutput = '/OK - .*?: rta (?:[\d\.]+ms)|(?:nan), lost \d+%/';
-my $failureOutput = '/(WARNING|CRITICAL) - .*?: rta [\d\.]+ms, lost \d%/';
+my $successOutput = '/OK - .*?: rta ((?:[\d\.]+ms)|(?:nan,)) lost \d+%/';
+my $failureOutput = '/(WARNING|CRITICAL) - .*?: ((rta ((?:[\d\.]+ms( >= [\d\.]+ms)?)|(?:nan,)))|(lost \d+%( >= [\d+%])? ))*/';
 
 my $host_responsive    = getTestParameter( "NP_HOST_RESPONSIVE",
 				"The hostname of system responsive to network requests",