thruk: update to 2.10
[omd.git] / t / 20-package_nagios_plugins.t
blobd7469aa2d735bd05fcc3a346228cfe863a45104b
1 #!/usr/bin/env perl
3 use warnings;
4 use strict;
5 use Test::More;
7 BEGIN {
8 use lib('t');
9 require TestUtils;
10 import TestUtils;
11 use FindBin;
12 use lib "$FindBin::Bin/lib/lib/perl5";
15 plan( tests => 25 );
17 ##################################################
18 # create our test site
19 my $omd_bin = TestUtils::get_omd_bin();
20 my $site = TestUtils::create_test_site() or TestUtils::bail_out_clean("no further testing without site");
22 ##################################################
23 # execute some checks
24 my $tests = [
25 { cmd => "/bin/su - $site -c 'lib/nagios/plugins/check_icmp'", exit => 3, like => '/check_icmp: No hosts to check/' },
26 { cmd => "/bin/su - $site -c 'lib/nagios/plugins/check_fping'", exit => 3, like => '/check_fping: Could not parse arguments/' },
27 { cmd => "/bin/su - $site -c 'lib/nagios/plugins/check_snmp'", exit => 3, like => '/check_snmp: Could not parse arguments/' },
28 { cmd => "/bin/su - $site -c 'lib/nagios/plugins/check_mysql'",exit => undef, like => '/Can\'t connect to local MySQL server through socket|Access denied for user|Open_tables/' },
29 { cmd => "/bin/su - $site -c 'lib/nagios/plugins/check_logfiles'", exit => 3, like => '/Usage: check_logfiles/' },
31 for my $test (@{$tests}) {
32 TestUtils::test_command($test);
35 ##################################################
36 # cleanup test site
37 TestUtils::remove_test_site($site);