nagios4/t/930-emptygroups.t

27 lines
636 B
Perl
Raw Permalink Normal View History

2017-05-19 22:22:40 +02:00
#!/usr/bin/perl
#
2017-05-19 23:37:19 +02:00
# Check that empty host/service groups pass verification.
2017-05-19 22:22:40 +02:00
# 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");
}