summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorTon Voon <tonvoon@users.sourceforge.net>2006-06-15 09:11:54 (GMT)
committerTon Voon <tonvoon@users.sourceforge.net>2006-06-15 09:11:54 (GMT)
commitf948ceecba9b5f6cb0aef9aae6f6be18ba6feffe (patch)
tree687e8c72f89ae9cced849754e362f1cde19ae745 /t
parente736a3c2b0a62707f12cf66fbb65ef23eeb01dd6 (diff)
downloadmonitoring-plugin-perl-f948ceecba9b5f6cb0aef9aae6f6be18ba6feffe.tar.gz
is_set method to see if a range has been set
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/Nagios-Plugin/trunk@1429 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 't')
-rw-r--r--t/Nagios-Plugin-Performance.t11
-rw-r--r--t/Nagios-Plugin-Threshold.t8
2 files changed, 10 insertions, 9 deletions
diff --git a/t/Nagios-Plugin-Performance.t b/t/Nagios-Plugin-Performance.t
index aa0ab64..b10a988 100644
--- a/t/Nagios-Plugin-Performance.t
+++ b/t/Nagios-Plugin-Performance.t
@@ -1,6 +1,6 @@
1 1
2use strict; 2use strict;
3use Test::More tests => 43; 3use Test::More tests => 49;
4BEGIN { use_ok('Nagios::Plugin::Performance') }; 4BEGIN { use_ok('Nagios::Plugin::Performance') };
5 5
6use Nagios::Plugin::Base; 6use Nagios::Plugin::Base;
@@ -65,12 +65,13 @@ cmp_ok( $p[0]->threshold->critical, 'eq', "10", "crit okay");
65cmp_ok( $p[1]->label, "eq", "size", "label okay"); 65cmp_ok( $p[1]->label, "eq", "size", "label okay");
66cmp_ok( $p[1]->value, "==", 426, "value okay"); 66cmp_ok( $p[1]->value, "==", 426, "value okay");
67cmp_ok( $p[1]->uom, "eq", "B", "uom okay"); 67cmp_ok( $p[1]->uom, "eq", "B", "uom okay");
68 ok( ! defined $p[1]->threshold->warning, "warn okay"); 68 ok( ! $p[1]->threshold->warning->is_set, "warn okay");
69 ok( ! defined $p[1]->threshold->critical, "crit okay"); 69 ok( ! $p[1]->threshold->critical->is_set, "crit okay");
70 70
71# RRDlabel testing 71# Edge cases
72@p = Nagios::Plugin::Performance->parse_perfstring("/home/a-m=0 shared-folder:big=20 12345678901234567890=20"); 72@p = Nagios::Plugin::Performance->parse_perfstring("/home/a-m=0;0;0 shared-folder:big=20 12345678901234567890=20");
73cmp_ok( $p[0]->rrdlabel, "eq", "home_a_m", "changing / to _"); 73cmp_ok( $p[0]->rrdlabel, "eq", "home_a_m", "changing / to _");
74 ok( $p[0]->threshold->warning->is_set, "Warning range has been set");
74cmp_ok( $p[1]->rrdlabel, "eq", "shared_folder_big", "replacing bad characters"); 75cmp_ok( $p[1]->rrdlabel, "eq", "shared_folder_big", "replacing bad characters");
75cmp_ok( $p[2]->rrdlabel, "eq", "1234567890123456789", "shortening rrd label"); 76cmp_ok( $p[2]->rrdlabel, "eq", "1234567890123456789", "shortening rrd label");
76 77
diff --git a/t/Nagios-Plugin-Threshold.t b/t/Nagios-Plugin-Threshold.t
index 764f7b0..97d4fcc 100644
--- a/t/Nagios-Plugin-Threshold.t
+++ b/t/Nagios-Plugin-Threshold.t
@@ -8,14 +8,14 @@ Nagios::Plugin::Base->print_on_die(0);
8 8
9my $t = Nagios::Plugin::Threshold->set_thresholds(critical => "80"); 9my $t = Nagios::Plugin::Threshold->set_thresholds(critical => "80");
10ok( defined $t, "Threshold ('', '80') set"); 10ok( defined $t, "Threshold ('', '80') set");
11ok( ! defined $t->warning, "Warning not set"); 11ok( ! $t->warning->is_set, "Warning not set");
12cmp_ok( $t->critical->end, '==', 80, "Critical set correctly"); 12cmp_ok( $t->critical->end, '==', 80, "Critical set correctly");
13 13
14$t = Nagios::Plugin::Threshold->set_thresholds(warning => "5:33", critical => ""); 14$t = Nagios::Plugin::Threshold->set_thresholds(warning => "5:33", critical => "");
15ok( defined $t, "Threshold ('5:33', '') set"); 15ok( defined $t, "Threshold ('5:33', '') set");
16cmp_ok( $t->warning->start, '==', 5, "Warning start set"); 16cmp_ok( $t->warning->start, '==', 5, "Warning start set");
17cmp_ok( $t->warning->end, '==', 33, "Warning end set"); 17cmp_ok( $t->warning->end, '==', 33, "Warning end set");
18ok( ! defined $t->critical, "Critical not set"); 18ok( ! $t->critical->is_set, "Critical not set");
19 19
20$t = Nagios::Plugin::Threshold->set_thresholds(warning => "30", critical => "60"); 20$t = Nagios::Plugin::Threshold->set_thresholds(warning => "30", critical => "60");
21ok( defined $t, "Threshold ('30', '60') set"); 21ok( defined $t, "Threshold ('30', '60') set");
@@ -27,6 +27,6 @@ cmp_ok( $t->get_status(69), '==', $ERRORS{CRITICAL}, "69 - critical");
27 27
28$t = Nagios::Plugin::Threshold->set_thresholds(warning => "total", critical => "rubbish"); 28$t = Nagios::Plugin::Threshold->set_thresholds(warning => "total", critical => "rubbish");
29ok( defined $t, "Threshold object created although ..."); 29ok( defined $t, "Threshold object created although ...");
30ok( ! defined $t->warning, "Warning not set"); 30ok( ! $t->warning->is_set, "Warning not set");
31ok( ! defined $t->critical, "Critical not set"); 31ok( ! $t->critical->is_set, "Critical not set");
32 32