diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2006-06-09 10:53:22 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2006-06-09 10:53:22 +0000 |
commit | 4f0eadbd97ead5726b35843537dcce6d585b1164 (patch) | |
tree | c0d5e0f66f68e8996f2bbeddb7087103b1ff22ab /t | |
parent | 2c6651034f76e2bccb549a867485f8fabbf07cb1 (diff) | |
download | monitoring-plugin-perl-4f0eadbd97ead5726b35843537dcce6d585b1164.tar.gz |
Fixed problems parsing in nagiosgraph
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/Nagios-Plugin/trunk@1423 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 't')
-rw-r--r-- | t/Nagios-Plugin-Performance.t | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/t/Nagios-Plugin-Performance.t b/t/Nagios-Plugin-Performance.t index 2fe2326..a00b2db 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 => 42; | 3 | use Test::More tests => 43; |
4 | BEGIN { use_ok('Nagios::Plugin::Performance') }; | 4 | BEGIN { use_ok('Nagios::Plugin::Performance') }; |
5 | 5 | ||
6 | use Nagios::Plugin::Base; | 6 | use Nagios::Plugin::Base; |
@@ -21,8 +21,9 @@ cmp_ok( $p[1]->uom, 'eq', "MB", "uom okay"); | |||
21 | cmp_ok( $p[1]->threshold->warning->end, "==", 9443, "warn okay"); | 21 | cmp_ok( $p[1]->threshold->warning->end, "==", 9443, "warn okay"); |
22 | cmp_ok( $p[1]->threshold->critical->end, "==", 9448, "crit okay"); | 22 | cmp_ok( $p[1]->threshold->critical->end, "==", 9448, "crit okay"); |
23 | 23 | ||
24 | ok( ! defined Nagios::Plugin::Performance->parse_perfstring("rubbish"), "Errors correctly"); | 24 | @p = Nagios::Plugin::Performance->parse_perfstring("rubbish"); |
25 | ok( ! defined Nagios::Plugin::Performance->parse_perfstring(""), "Errors on empty string"); | 25 | ok( ! @p, "Errors correctly"); |
26 | ok( ! Nagios::Plugin::Performance->parse_perfstring(""), "Errors on empty string"); | ||
26 | 27 | ||
27 | @p = Nagios::Plugin::Performance->parse_perfstring( | 28 | @p = Nagios::Plugin::Performance->parse_perfstring( |
28 | "time=0.001229s;0.000000;0.000000;0.000000;10.000000"); | 29 | "time=0.001229s;0.000000;0.000000;0.000000;10.000000"); |
@@ -49,6 +50,9 @@ cmp_ok( $p[0]->uom, "eq", "", "uom empty"); | |||
49 | cmp_ok( $p[0]->threshold->warning, 'eq', "20", "warn okay"); | 50 | cmp_ok( $p[0]->threshold->warning, 'eq', "20", "warn okay"); |
50 | cmp_ok( $p[0]->threshold->critical, 'eq', "50", "crit okay"); | 51 | cmp_ok( $p[0]->threshold->critical, 'eq', "50", "crit okay"); |
51 | 52 | ||
53 | @p = Nagios::Plugin::Performance->parse_perfstring( "users=4;20;50;0\n" ); | ||
54 | ok( @p, "parse correctly with linefeed at end (nagiosgraph)"); | ||
55 | |||
52 | @p = Nagios::Plugin::Performance->parse_perfstring( | 56 | @p = Nagios::Plugin::Performance->parse_perfstring( |
53 | "time=0.215300s;5.000000;10.000000;0.000000 size=426B;;;0" ); | 57 | "time=0.215300s;5.000000;10.000000;0.000000 size=426B;;;0" ); |
54 | cmp_ok( $p[0]->label, "eq", "time", "label okay"); | 58 | cmp_ok( $p[0]->label, "eq", "time", "label okay"); |