diff options
author | Ton Voon <tonvoon@macbook.local> | 2009-01-05 22:24:44 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@macbook.local> | 2009-01-05 22:24:44 +0000 |
commit | 67a45638154221708da7f92451143475bdc229ac (patch) | |
tree | 65917e7a12893ca1df3ea446864169d6c6076747 /t | |
parent | 91047f17af0454e94fbd30615f4a6959a593f48e (diff) | |
download | monitoring-plugin-perl-67a45638154221708da7f92451143475bdc229ac.tar.gz |
Check for valid numerical value before returning perfdata object
Diffstat (limited to 't')
-rw-r--r-- | t/Nagios-Plugin-Performance.t | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/t/Nagios-Plugin-Performance.t b/t/Nagios-Plugin-Performance.t index e3fac07..8426828 100644 --- a/t/Nagios-Plugin-Performance.t +++ b/t/Nagios-Plugin-Performance.t | |||
@@ -16,7 +16,7 @@ my @test = ( | |||
16 | }, | 16 | }, |
17 | ); | 17 | ); |
18 | 18 | ||
19 | plan tests => (8 * scalar @test) + 132; | 19 | plan tests => (8 * scalar @test) + 135; |
20 | 20 | ||
21 | use_ok('Nagios::Plugin::Performance'); | 21 | use_ok('Nagios::Plugin::Performance'); |
22 | diag "\nusing Nagios::Plugin::Performance revision ". $Nagios::Plugin::Performance::VERSION . "\n" if $ENV{TEST_VERBOSE}; | 22 | diag "\nusing Nagios::Plugin::Performance revision ". $Nagios::Plugin::Performance::VERSION . "\n" if $ENV{TEST_VERBOSE}; |
@@ -250,4 +250,10 @@ is( $p[0]->threshold->warning, 60, "warn okay"); | |||
250 | is( $p[0]->threshold->critical->is_set, 1, "Critical range has been set"); | 250 | is( $p[0]->threshold->critical->is_set, 1, "Critical range has been set"); |
251 | is( $p[0]->threshold->critical, 120, "warn okay"); | 251 | is( $p[0]->threshold->critical, 120, "warn okay"); |
252 | 252 | ||
253 | # Some values with funny commas | ||
254 | @p = Nagios::Plugin::Performance->parse_perfstring("time=1800,600,300,0,3600 other=45.6"); | ||
255 | is( $p[0]->label, "other", "Ignored time=1800,600,300,0,3600, but allowed other=45.6"); | ||
256 | is( $p[0]->value, 45.6, "value okay"); | ||
257 | is( $p[0]->uom, "", "uom okay"); | ||
258 | |||
253 | # add_perfdata tests in t/Nagios-Plugin-01.t | 259 | # add_perfdata tests in t/Nagios-Plugin-01.t |