nagios4/t/930-emptygroups.t

27 lines
635 B
Perl
Raw Normal View History

2017-05-19 22:22:40 +02:00
#!/usr/bin/perl
#
# Check that empty host/service groups pass verfication.
# Likely error on non-patched version:
# "Error: Host 'r' specified in host group 'generic-pc' is not defined anywhere!"
use warnings;
use strict;
use Test::More;
use FindBin qw($Bin);
chdir $Bin or die "Cannot chdir";
my $topdir = "$Bin/..";
my $nagios = "$topdir/base/nagios";
my $etc = "$Bin/etc";
plan tests => 1;
my @output = `$nagios -v "$etc/nagios-empty-groups.cfg"`;
if ($? == 0) {
pass("Nagios validated empty host/service-group successfully");
} else {
@output = grep(/^Error: .+$/g, @output);
fail("Nagios validation failed:\n@output");
}