diff options
author | Nathan Vonnahme <n8v@users.sourceforge.net> | 2006-11-10 01:26:16 +0000 |
---|---|---|
committer | Nathan Vonnahme <n8v@users.sourceforge.net> | 2006-11-10 01:26:16 +0000 |
commit | d84da4e2ec8569b8ff15356b6881df307c7333ca (patch) | |
tree | 16dd035b8a5aaaec75f7571eb78e21069f200049 /t/Nagios-Plugin-01.t | |
parent | 2d5e416592ff2fab507bd4ebfacab3a66a3b8e46 (diff) | |
download | monitoring-plugin-perl-d84da4e2ec8569b8ff15356b6881df307c7333ca.tar.gz |
* exposed Getopt and Threshold functionality from top level Nagios::Plugin
* exchanged Class::Struct for Class::Accessor
* POD is not updated yet.
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/Nagios-Plugin/trunk@1536 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 't/Nagios-Plugin-01.t')
-rw-r--r-- | t/Nagios-Plugin-01.t | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/t/Nagios-Plugin-01.t b/t/Nagios-Plugin-01.t index 9de5009..a73fce4 100644 --- a/t/Nagios-Plugin-01.t +++ b/t/Nagios-Plugin-01.t | |||
@@ -11,21 +11,26 @@ Nagios::Plugin::Functions::_fake_exit(1); | |||
11 | diag "\nusing Nagios::Plugin revision ". $Nagios::Plugin::VERSION . "\n" | 11 | diag "\nusing Nagios::Plugin revision ". $Nagios::Plugin::VERSION . "\n" |
12 | if $ENV{TEST_VERBOSE}; | 12 | if $ENV{TEST_VERBOSE}; |
13 | 13 | ||
14 | my $p = Nagios::Plugin->new; | 14 | my $p = Nagios::Plugin->new (usage => "dummy usage"); |
15 | isa_ok( $p, "Nagios::Plugin"); | 15 | isa_ok( $p, "Nagios::Plugin"); |
16 | 16 | ||
17 | $p->shortname("PAGESIZE"); | 17 | $p->shortname("PAGESIZE"); |
18 | is($p->shortname, "PAGESIZE", "shortname set correctly"); | 18 | is($p->shortname, "PAGESIZE", "shortname explicitly set correctly"); |
19 | 19 | ||
20 | $p = Nagios::Plugin->new; | 20 | $p = Nagios::Plugin->new (usage => "dummy usage"); |
21 | is($p->shortname, "NAGIOS-PLUGIN-01", "shortname should default on new"); | 21 | is($p->shortname, "NAGIOS-PLUGIN-01", "shortname should default on new"); |
22 | 22 | ||
23 | $p = Nagios::Plugin->new( shortname => "SIZE" ); | 23 | $p = Nagios::Plugin->new( shortname => "SIZE", usage => "dummy usage" ); |
24 | is($p->shortname, "SIZE", "shortname set correctly on new"); | 24 | is($p->shortname, "SIZE", "shortname set correctly on new"); |
25 | 25 | ||
26 | diag "warn if < 10, critical if > 25 " if $ENV{TEST_VERBOSE}; | 26 | diag "warn if < 10, critical if > 25 " if $ENV{TEST_VERBOSE}; |
27 | my $t = $p->set_thresholds( warning => "10:25", critical => "~:25" ); | 27 | my $t = $p->set_thresholds( warning => "10:25", critical => "~:25" ); |
28 | 28 | ||
29 | use Data::Dumper; | ||
30 | #diag "dumping p: ". Dumper $p; | ||
31 | #diag "dumping perfdata: ". Dumper $p->perfdata; | ||
32 | |||
33 | |||
29 | $p->add_perfdata( | 34 | $p->add_perfdata( |
30 | label => "size", | 35 | label => "size", |
31 | value => 1, | 36 | value => 1, |
@@ -34,6 +39,7 @@ $p->add_perfdata( | |||
34 | ); | 39 | ); |
35 | 40 | ||
36 | cmp_ok( $p->all_perfoutput, 'eq', "size=1kB;10:25;~:25", "Perfdata correct"); | 41 | cmp_ok( $p->all_perfoutput, 'eq', "size=1kB;10:25;~:25", "Perfdata correct"); |
42 | #diag "dumping perfdata: ". Dumper ($p->perfdata); | ||
37 | 43 | ||
38 | my $expected = {qw( | 44 | my $expected = {qw( |
39 | -1 WARNING | 45 | -1 WARNING |