From b418181dfe80dd75169b6e8a619ac1932155dea2 Mon Sep 17 00:00:00 2001 From: Sven Nierlein Date: Mon, 20 Jan 2014 00:54:34 +0100 Subject: renamed module into Monitoring::Plugin since the complete monitoring team has been renamed, we also rename this module. Signed-off-by: Sven Nierlein --- t/Nagios-Plugin-Getopt-02.t | 64 --------------------------------------------- 1 file changed, 64 deletions(-) delete mode 100644 t/Nagios-Plugin-Getopt-02.t (limited to 't/Nagios-Plugin-Getopt-02.t') diff --git a/t/Nagios-Plugin-Getopt-02.t b/t/Nagios-Plugin-Getopt-02.t deleted file mode 100644 index f83b180..0000000 --- a/t/Nagios-Plugin-Getopt-02.t +++ /dev/null @@ -1,64 +0,0 @@ -# Nagios::Plugin::Getopt timeout tests - -use strict; - -use Test::More tests => 14; -BEGIN { use_ok('Nagios::Plugin::Getopt') }; - -# Needed to get evals to work in testing -Nagios::Plugin::Functions::_use_die(1); - -my %PARAM = ( - version => '0.01', - url => 'http://www.openfusion.com.au/labs/nagios/', - blurb => 'This plugin tests various stuff.', - usage => "Usage: %s -H -w - -c ", - plugin => 'test_plugin', - timeout => 18, -); - -sub setup -{ - # Instantiate object - my $ng = Nagios::Plugin::Getopt->new(%PARAM); - ok($ng, 'constructor ok'); - return $ng; -} - -my $ng; - -# No args -@ARGV = qw(); -$ng = setup(); -$ng->getopts; -is($ng->timeout, 18, 'default timeout set to 18'); - -# Check help message -@ARGV = ( '-h' ); -$ng = setup; -ok(! defined eval { $ng->getopts }, 'getopts died on help'); -like($@, qr/times out.*default: 18\b/i, 'help timeout changed to 18'); - -# Explicit timeout -@ARGV = qw(--timeout=25 --verbose); -$ng = setup(); -$ng->getopts; -is($ng->timeout, 25, 'timeout changed to 25'); - -# Explicit timeout -@ARGV = qw(-t10 --verbose); -$ng = setup(); -$ng->getopts; -is($ng->timeout, 10, 'timeout changed to 10'); - -# Short timeout, test default timeout handler -@ARGV = qw(-t2 --verbose); -$ng = setup(); -$ng->getopts; -is($ng->timeout, 2, 'timeout changed to 2'); -alarm($ng->timeout); -# Loop -ok(! defined eval { 1 while 1 }, 'loop timed out'); -like($@, qr/UNKNOWN\b.*\btimed out/, 'default timeout handler ok'); - -- cgit v1.2.3-74-g34f1