diff options
Diffstat (limited to 't/Nagios-Plugin-Performance.t')
-rw-r--r-- | t/Nagios-Plugin-Performance.t | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/t/Nagios-Plugin-Performance.t b/t/Nagios-Plugin-Performance.t index 0dcb800..c4d518c 100644 --- a/t/Nagios-Plugin-Performance.t +++ b/t/Nagios-Plugin-Performance.t | |||
@@ -1,6 +1,6 @@ | |||
1 | 1 | ||
2 | use strict; | 2 | use strict; |
3 | use Test::More tests => 77; | 3 | use Test::More tests => 84; |
4 | BEGIN { use_ok('Nagios::Plugin::Performance') }; | 4 | BEGIN { use_ok('Nagios::Plugin::Performance') }; |
5 | 5 | ||
6 | diag "\nusing Nagios::Plugin::Performance revision ". $Nagios::Plugin::Performance::VERSION . "\n" if $ENV{TEST_VERBOSE}; | 6 | diag "\nusing Nagios::Plugin::Performance revision ". $Nagios::Plugin::Performance::VERSION . "\n" if $ENV{TEST_VERBOSE}; |
@@ -120,5 +120,17 @@ cmp_ok( $p[0]->rrdlabel, "eq", "home_a_m", "changing / to _"); | |||
120 | cmp_ok( $p[1]->rrdlabel, "eq", "shared_folder_big", "replacing bad characters"); | 120 | cmp_ok( $p[1]->rrdlabel, "eq", "shared_folder_big", "replacing bad characters"); |
121 | cmp_ok( $p[2]->rrdlabel, "eq", "1234567890123456789", "shortening rrd label"); | 121 | cmp_ok( $p[2]->rrdlabel, "eq", "1234567890123456789", "shortening rrd label"); |
122 | 122 | ||
123 | # turn off fake_exit and enable use_die so we pick up on errors via nagios_die | ||
124 | Nagios::Plugin::Functions::_use_die(1); | ||
125 | Nagios::Plugin::Functions::_fake_exit(0); | ||
126 | |||
127 | @p = Nagios::Plugin::Performance->parse_perfstring("time=0.002722s;0.000000;0.000000;0.000000;10.000000"); | ||
128 | cmp_ok( $p[0]->label, "eq", "time", "label okay"); | ||
129 | cmp_ok( $p[0]->value, "eq", "0.002722", "value okay"); | ||
130 | cmp_ok( $p[0]->uom, "eq", "s", "uom okay"); | ||
131 | ok( defined $p[0]->threshold->warning->is_set, "Warning range has been set"); | ||
132 | ok( defined $p[0]->threshold->critical->is_set, "Critical range has been set"); | ||
133 | cmp_ok( $p[0]->threshold->warning, 'eq', "0", "warn okay"); | ||
134 | cmp_ok( $p[0]->threshold->critical, 'eq', "0", "crit okay"); | ||
123 | 135 | ||
124 | # add_perfdata tests in t/Nagios-Plugin-01.t | 136 | # add_perfdata tests in t/Nagios-Plugin-01.t |