1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
# -*- cperl -*-
use warnings;
use strict;
use Test::More 'no_plan';
use POSIX ();
use Data::Dumper;
require_ok('sbin/munin-node-configure');
use Munin::Node::Config;
my $config = Munin::Node::Config->instance();
my $PWD = POSIX::getcwd();
$config->reinitialize({
libdir => "$PWD/t/plugins",
timeout => 10,
});
### fetch_plugin_autoconf
{
my @tests = (
[
'bad-exit1',
{ default => 'no' },
'Plugin replied "no", but returns non-zero', # FIXME: test for the error it emits!
],
[
'bad-no-answer',
{ default => 'no' },
"Plugin exits without printing anything",
],
[
'bad-cruft-stderr',
{ default => 'no' },
"Plugin replied 'yes', but with junk to stderr",
],
[
'bad-signal',
{ default => 'no' },
"Plugin replied yes, but died due to a signal",
],
[
'bad-timeout',
{ default => 'no' },
"Plugin timed out",
],
);
}
### fetch_plugin_suggest
{
my @tests = (
[
'good',
{
default => 'yes',
suggestions => [
qw/one two three/
],
},
"Plugin provided a list of valid suggestions",
],
[
'good-no-autoconf',
{ default => 'no' },
"Plugin didn't pass autoconf",
],
[
'bad-empty',
{ suggestions => [], default => 'yes' },
"Plugin provided no suggestions",
],
[
'bad-illegal-chars',
{
default => 'yes',
suggestions => [
qw/one two/
],
},
"Plugin produced a suggestion containing illegal characters",
],
[
'bad-junk',
{ suggestions => [], default => 'yes' },
"Plugin wrote junk to stderr -- all suggestions voided",
],
[
'bad-exit1',
{ suggestions => [], default => 'yes' },
"Plugin returned non-zero -- all suggestions voided",
],
# [
# '',
# { suggestions => [], default => 'yes' },
# "",
# ],
);
}
|