[Nagiosplug-checkins] Nagios-Plugin/t Nagios-Plugin-Performance.t, 1.3, 1.4 Nagios-Plugin-Threshold.t, 1.1.1.1, 1.2

Ton Voon tonvoon at users.sourceforge.net
Thu Jun 15 11:11:56 CEST 2006


Update of /cvsroot/nagiosplug/Nagios-Plugin/t
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv3484/t

Modified Files:
	Nagios-Plugin-Performance.t Nagios-Plugin-Threshold.t 
Log Message:
is_set method to see if a range has been set


Index: Nagios-Plugin-Threshold.t
===================================================================
RCS file: /cvsroot/nagiosplug/Nagios-Plugin/t/Nagios-Plugin-Threshold.t,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- Nagios-Plugin-Threshold.t	8 Jun 2006 12:27:45 -0000	1.1.1.1
+++ Nagios-Plugin-Threshold.t	15 Jun 2006 09:11:54 -0000	1.2
@@ -8,14 +8,14 @@
 
 my $t = Nagios::Plugin::Threshold->set_thresholds(critical => "80");
 ok( defined $t, "Threshold ('', '80') set");
-ok( ! defined $t->warning, "Warning not set");
+ok( ! $t->warning->is_set, "Warning not set");
 cmp_ok( $t->critical->end, '==', 80, "Critical set correctly");
 
 $t = Nagios::Plugin::Threshold->set_thresholds(warning => "5:33", critical => "");
 ok( defined $t, "Threshold ('5:33', '') set");
 cmp_ok( $t->warning->start, '==', 5, "Warning start set");
 cmp_ok( $t->warning->end, '==',   33, "Warning end set");
-ok( ! defined $t->critical, "Critical not set");
+ok( ! $t->critical->is_set, "Critical not set");
 
 $t = Nagios::Plugin::Threshold->set_thresholds(warning => "30", critical => "60");
 ok( defined $t, "Threshold ('30', '60') set");
@@ -27,6 +27,6 @@
 
 $t = Nagios::Plugin::Threshold->set_thresholds(warning => "total", critical => "rubbish");
 ok( defined $t, "Threshold object created although ...");
-ok( ! defined $t->warning, "Warning not set");
-ok( ! defined $t->critical, "Critical not set");
+ok( ! $t->warning->is_set, "Warning not set");
+ok( ! $t->critical->is_set, "Critical not set");
 

Index: Nagios-Plugin-Performance.t
===================================================================
RCS file: /cvsroot/nagiosplug/Nagios-Plugin/t/Nagios-Plugin-Performance.t,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Nagios-Plugin-Performance.t	15 Jun 2006 08:38:18 -0000	1.3
+++ Nagios-Plugin-Performance.t	15 Jun 2006 09:11:54 -0000	1.4
@@ -1,6 +1,6 @@
 
 use strict;
-use Test::More tests => 43;
+use Test::More tests => 49;
 BEGIN { use_ok('Nagios::Plugin::Performance') };
 
 use Nagios::Plugin::Base;
@@ -65,12 +65,13 @@
 cmp_ok( $p[1]->label, "eq", "size", "label okay");
 cmp_ok( $p[1]->value, "==", 426, "value okay");
 cmp_ok( $p[1]->uom, "eq", "B", "uom okay");
-    ok( ! defined $p[1]->threshold->warning, "warn okay");
-    ok( ! defined $p[1]->threshold->critical, "crit okay");
+    ok( ! $p[1]->threshold->warning->is_set, "warn okay");
+    ok( ! $p[1]->threshold->critical->is_set, "crit okay");
 
-# RRDlabel testing
- at p = Nagios::Plugin::Performance->parse_perfstring("/home/a-m=0 shared-folder:big=20 12345678901234567890=20");
+# Edge cases
+ at p = Nagios::Plugin::Performance->parse_perfstring("/home/a-m=0;0;0 shared-folder:big=20 12345678901234567890=20");
 cmp_ok( $p[0]->rrdlabel, "eq", "home_a_m", "changing / to _");
+    ok( $p[0]->threshold->warning->is_set, "Warning range has been set");
 cmp_ok( $p[1]->rrdlabel, "eq", "shared_folder_big", "replacing bad characters");
 cmp_ok( $p[2]->rrdlabel, "eq", "1234567890123456789", "shortening rrd label");
 





More information about the Commits mailing list