thruk: update to 2.10
[omd.git] / t / 20-package_icinga.t
blob7741fd2eb86a5c767607498b14ffb14a8fa5eda1
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 => 30 );
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 # create test host/service
23 TestUtils::prepare_obj_config('t/data/omd/testconf1', '/omd/sites/'.$site.'/etc/nagios/conf.d', $site);
25 ##################################################
26 # execute some checks
27 my $tests = [
28 { cmd => $omd_bin." config $site set CORE icinga" },
29 { cmd => $omd_bin." start $site" },
31 { cmd => "/bin/su - $site -c 'lib/nagios/plugins/check_http -H localhost -u /$site/icinga -e 401'", like => '/HTTP OK:/' },
32 { cmd => "/bin/su - $site -c 'lib/nagios/plugins/check_http -H localhost -a omdadmin:omd -u /$site/icinga -e 301'", like => '/HTTP OK:/' },
33 { cmd => "/bin/su - $site -c 'lib/nagios/plugins/check_http -H localhost -a omdadmin:omd -u /$site/icinga/ -e 200'", like => '/HTTP OK:/' },
35 { cmd => $omd_bin." stop $site" },
37 for my $test (@{$tests}) {
38 TestUtils::test_command($test);
41 ##################################################
42 # cleanup test site
43 TestUtils::remove_test_site($site);