check_oracle_health: update to 1.9.3.6
[omd.git] / t / 20-package_omd.t
bloba67818ed19f57aaceaab0dd4995313a0f54a20d6
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 => 76 );
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 # not started site should give a nice error
23 TestUtils::test_command({ cmd => "/bin/su - $site -c 'lib/nagios/plugins/check_http -H localhost -u /$site -e 503 -r \"OMD: Site Not Started\"'", like => '/HTTP OK:/' });
25 ##################################################
26 # execute some checks
27 my $tests = [
28 { cmd => $omd_bin." start $site" },
30 { cmd => "/bin/su - $site -c 'lib/nagios/plugins/check_http -H localhost -u /$site -e 302'", like => '/HTTP OK:/' },
31 { cmd => "/bin/su - $site -c 'lib/nagios/plugins/check_http -H localhost -u /$site/ -e 302'", like => '/HTTP OK:/' },
32 { cmd => "/bin/su - $site -c 'lib/nagios/plugins/check_http -H localhost -u /$site/omd -e 401'", like => '/HTTP OK:/' },
33 { cmd => "/bin/su - $site -c 'lib/nagios/plugins/check_http -H localhost -a omdadmin:omd -u /$site -e 302'", like => '/HTTP OK:/' },
34 { cmd => "/bin/su - $site -c 'lib/nagios/plugins/check_http -H localhost -a omdadmin:omd -u /$site/omd -e 301'", like => '/HTTP OK:/' },
35 { cmd => "/bin/su - $site -c 'lib/nagios/plugins/check_http -H localhost -a omdadmin:omd -u /$site/omd/ -e 200'", like => '/HTTP OK:/' },
37 { cmd => $omd_bin." stop $site" },
39 for my $test (@{$tests}) {
40 TestUtils::test_command($test);
43 # switch webserver to shared mode
44 TestUtils::test_command({ cmd => $omd_bin." config $site set APACHE_MODE shared" });
45 TestUtils::test_command({ cmd => TestUtils::config('APACHE_INIT')." restart" });
47 # then run tests again
48 for my $test (@{$tests}) {
49 TestUtils::test_command($test);
52 ##################################################
53 # cleanup test site
54 TestUtils::remove_test_site($site);