summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <dermoth@aei.ca>2010-03-10 06:54:06 (GMT)
committerThomas Guyot-Sionnest <dermoth@aei.ca>2010-03-12 13:09:11 (GMT)
commitc128d293b015291c5e45637d9e3d5b1e1fb36c12 (patch)
tree4b406d48f9d21b59a2aa4600b6d52ac11b7da4fd /t
parent58a1764446e5a1a30db360ee7a69555d7f2e8f1a (diff)
downloadmonitoring-plugin-perl-c128d293b015291c5e45637d9e3d5b1e1fb36c12.tar.gz
shortname enhancement
This patch makes shortname use the defined plugin's name if set, otherwise the normal method should prevail. To do so I had to generate shortname during np initialization instead of at use time.
Diffstat (limited to 't')
-rw-r--r--t/Nagios-Plugin-01.t8
1 files changed, 7 insertions, 1 deletions
diff --git a/t/Nagios-Plugin-01.t b/t/Nagios-Plugin-01.t
index 3ada472..947a704 100644
--- a/t/Nagios-Plugin-01.t
+++ b/t/Nagios-Plugin-01.t
@@ -1,7 +1,7 @@
1# Nagios::Plugin original test cases 1# Nagios::Plugin original test cases
2 2
3use strict; 3use strict;
4use Test::More tests => 13; 4use Test::More tests => 15;
5 5
6BEGIN { use_ok('Nagios::Plugin') }; 6BEGIN { use_ok('Nagios::Plugin') };
7 7
@@ -23,6 +23,12 @@ is($p->shortname, "NAGIOS-PLUGIN-01", "shortname should default on new");
23$p = Nagios::Plugin->new( shortname => "SIZE", () ); 23$p = Nagios::Plugin->new( shortname => "SIZE", () );
24is($p->shortname, "SIZE", "shortname set correctly on new"); 24is($p->shortname, "SIZE", "shortname set correctly on new");
25 25
26$p = Nagios::Plugin->new( plugin => "check_stuff", () );
27is($p->shortname, "STUFF", "shortname uses plugin name as default");
28
29$p = Nagios::Plugin->new( shortname => "SIZE", plugin => "check_stuff", () );
30is($p->shortname, "SIZE", "shortname is not overriden by default");
31
26diag "warn if < 10, critical if > 25 " if $ENV{TEST_VERBOSE}; 32diag "warn if < 10, critical if > 25 " if $ENV{TEST_VERBOSE};
27my $t = $p->set_thresholds( warning => "10:25", critical => "~:25" ); 33my $t = $p->set_thresholds( warning => "10:25", critical => "~:25" );
28 34