diff options
author | Gavin Carr <gonzai@users.sourceforge.net> | 2006-09-11 01:57:26 +0000 |
---|---|---|
committer | Gavin Carr <gonzai@users.sourceforge.net> | 2006-09-11 01:57:26 +0000 |
commit | 1f8410dd1914449ce52ffa8fd47a308c5b372e52 (patch) | |
tree | dc14d10c159541daa211ef59f8d69e859e05fd13 /t/Nagios-Plugin-Threshold.t | |
parent | bc239b3bd5023ed2da77ab03c581e56a4772f1d4 (diff) | |
download | monitoring-plugin-perl-1f8410dd1914449ce52ffa8fd47a308c5b372e52.tar.gz |
Add constants, nagios_exit, and nagios_die to Nagios::Plugin::Base.
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/Nagios-Plugin/trunk@1477 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 't/Nagios-Plugin-Threshold.t')
-rw-r--r-- | t/Nagios-Plugin-Threshold.t | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/t/Nagios-Plugin-Threshold.t b/t/Nagios-Plugin-Threshold.t index bb8b578..677c054 100644 --- a/t/Nagios-Plugin-Threshold.t +++ b/t/Nagios-Plugin-Threshold.t | |||
@@ -2,13 +2,17 @@ | |||
2 | use strict; | 2 | use strict; |
3 | use Test::More tests => 71; | 3 | use Test::More tests => 71; |
4 | #use Test::Exception; # broken for now so we don't need this. | 4 | #use Test::Exception; # broken for now so we don't need this. |
5 | BEGIN { use_ok('Nagios::Plugin::Threshold'); use_ok('Nagios::Plugin::Base') }; | 5 | BEGIN { |
6 | use_ok('Nagios::Plugin::Threshold'); | ||
7 | use_ok('Nagios::Plugin::Base', ':all' ); | ||
8 | # Silence warnings unless TEST_VERBOSE is set | ||
9 | $SIG{__WARN__} = sub { warn $_[0] if $ENV{TEST_VERBOSE} }; | ||
10 | } | ||
6 | 11 | ||
7 | diag "\nusing Nagios::Plugin::Threshold revision ". $Nagios::Plugin::Threshold::VERSION . "\n"; | 12 | diag "\nusing Nagios::Plugin::Threshold revision ". $Nagios::Plugin::Threshold::VERSION . "\n" |
13 | if $ENV{TEST_VERBOSE}; | ||
8 | 14 | ||
9 | Nagios::Plugin::Base->exit_on_die(0); | 15 | Nagios::Plugin::Base::_fake_exit(1); |
10 | Nagios::Plugin::Base->print_on_die(0); | ||
11 | my %STATUS_TEXT = reverse %ERRORS; | ||
12 | 16 | ||
13 | diag "threshold: critical if > 80" if $ENV{TEST_VERBOSE}; | 17 | diag "threshold: critical if > 80" if $ENV{TEST_VERBOSE}; |
14 | my $t = Nagios::Plugin::Threshold->set_thresholds(critical => "80"); | 18 | my $t = Nagios::Plugin::Threshold->set_thresholds(critical => "80"); |
@@ -45,7 +49,7 @@ sub test_expected_statuses { | |||
45 | test_expected_statuses( $t, $expected ); | 49 | test_expected_statuses( $t, $expected ); |
46 | 50 | ||
47 | diag "threshold: warn if less than 5 or more than 33." if $ENV{TEST_VERBOSE}; | 51 | diag "threshold: warn if less than 5 or more than 33." if $ENV{TEST_VERBOSE}; |
48 | $t = Nagios::Plugin::Threshold->set_thresholds(warning => "5:33", critical => ""); | 52 | eval { $t = Nagios::Plugin::Threshold->set_thresholds(warning => "5:33", critical => "") }; |
49 | ok( defined $t, "Threshold ('5:33', '') set"); | 53 | ok( defined $t, "Threshold ('5:33', '') set"); |
50 | cmp_ok( $t->warning->start, '==', 5, "Warning start set"); | 54 | cmp_ok( $t->warning->start, '==', 5, "Warning start set"); |
51 | cmp_ok( $t->warning->end, '==', 33, "Warning end set"); | 55 | cmp_ok( $t->warning->end, '==', 33, "Warning end set"); |