summaryrefslogtreecommitdiffstats
path: root/t/Nagios-Plugin-Threshold.t
diff options
context:
space:
mode:
authorGavin Carr <gonzai@users.sourceforge.net>2006-09-11 01:57:26 +0000
committerGavin Carr <gonzai@users.sourceforge.net>2006-09-11 01:57:26 +0000
commit1f8410dd1914449ce52ffa8fd47a308c5b372e52 (patch)
treedc14d10c159541daa211ef59f8d69e859e05fd13 /t/Nagios-Plugin-Threshold.t
parentbc239b3bd5023ed2da77ab03c581e56a4772f1d4 (diff)
downloadmonitoring-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.t16
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 @@
2use strict; 2use strict;
3use Test::More tests => 71; 3use 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.
5BEGIN { use_ok('Nagios::Plugin::Threshold'); use_ok('Nagios::Plugin::Base') }; 5BEGIN {
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
7diag "\nusing Nagios::Plugin::Threshold revision ". $Nagios::Plugin::Threshold::VERSION . "\n"; 12diag "\nusing Nagios::Plugin::Threshold revision ". $Nagios::Plugin::Threshold::VERSION . "\n"
13 if $ENV{TEST_VERBOSE};
8 14
9Nagios::Plugin::Base->exit_on_die(0); 15Nagios::Plugin::Base::_fake_exit(1);
10Nagios::Plugin::Base->print_on_die(0);
11my %STATUS_TEXT = reverse %ERRORS;
12 16
13diag "threshold: critical if > 80" if $ENV{TEST_VERBOSE}; 17diag "threshold: critical if > 80" if $ENV{TEST_VERBOSE};
14my $t = Nagios::Plugin::Threshold->set_thresholds(critical => "80"); 18my $t = Nagios::Plugin::Threshold->set_thresholds(critical => "80");
@@ -45,7 +49,7 @@ sub test_expected_statuses {
45test_expected_statuses( $t, $expected ); 49test_expected_statuses( $t, $expected );
46 50
47diag "threshold: warn if less than 5 or more than 33." if $ENV{TEST_VERBOSE}; 51diag "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 => ""); 52eval { $t = Nagios::Plugin::Threshold->set_thresholds(warning => "5:33", critical => "") };
49ok( defined $t, "Threshold ('5:33', '') set"); 53ok( defined $t, "Threshold ('5:33', '') set");
50cmp_ok( $t->warning->start, '==', 5, "Warning start set"); 54cmp_ok( $t->warning->start, '==', 5, "Warning start set");
51cmp_ok( $t->warning->end, '==', 33, "Warning end set"); 55cmp_ok( $t->warning->end, '==', 33, "Warning end set");