monitoring-plugins/lib/tests/test_ini3.t

35 lines
852 B
Perl
Raw Normal View History

2009-01-23 02:39:45 -05:00
#!/usr/bin/perl
use Test::More;
use strict;
use warnings;
2009-01-24 00:41:00 -05:00
if (! -e "./test_ini3") {
plan skip_all => "./test_ini not compiled - please enable libtap library and/or extra-opts to test";
2009-01-23 02:39:45 -05:00
}
# array of argument arrays
# - First value is the expected return code
# - 2nd value is the NAGIOS_CONFIG_PATH
# TODO: looks like we look in default path after looking through this variable - shall we?
2009-01-23 02:39:45 -05:00
# - 3rd value is the plugin name
# - 4th is the ini locator
my @TESTS = (
[3, undef, "section", "section_unknown@./config-tiny.ini"],
);
plan tests => scalar(@TESTS);
my $count=1;
foreach my $args (@TESTS) {
my $rc = shift(@$args);
if (my $env = shift(@$args)) {
$ENV{"NAGIOS_CONFIG_PATH"} = $env;
} else {
delete($ENV{"NAGIOS_CONFIG_PATH"});
}
2009-01-24 00:41:00 -05:00
system {'./test_ini3'} @$args;
2009-01-23 02:39:45 -05:00
cmp_ok($?>>8, '==', $rc, "Parse-ini die " . $count++);
}