Merge branch 'master' of mathias-kettner.de:omd
[omd.git] / t / 20-package_mysql.t
blobff446ca339a608c363503ccc2c87d10b2a6408b9
1 #!/usr/bin/env perl
3 use warnings;
4 use strict;
5 use Test::More;
6 use POSIX;
8 BEGIN {
9 use lib('t');
10 require TestUtils;
11 import TestUtils;
12 use FindBin;
13 use lib "$FindBin::Bin/lib/lib/perl5";
16 my @uname = POSIX::uname();
17 if($uname[3] =~ m/ubuntu/i) {
18 plan( skip_all => "MySQL on Ubuntu does not work due to AppArmor restrictions" );
19 } else {
20 plan( tests => 28 );
23 ##################################################
24 # create our test site
25 my $omd_bin = TestUtils::get_omd_bin();
26 my $site = TestUtils::create_test_site() or TestUtils::bail_out_clean("no further testing without site");
28 ##################################################
29 # execute some checks
30 my $tests = [
31 { cmd => $omd_bin." config $site set MYSQL on" },
32 { cmd => $omd_bin." config $site show MYSQL", like => '/on/', 'unlike' => [ '/error/', '/off/' ] },
33 { cmd => $omd_bin." start $site" },
34 { cmd => $omd_bin." status $site", like => '/mysql:\s*running/' },
35 { cmd => "/bin/su - $site -c 'mysql mysql'", stdin => "show tables;\n", like => [ '/user/', '/tables_priv/' ] },
36 { cmd => $omd_bin." stop $site" },
38 for my $test (@{$tests}) {
39 TestUtils::test_command($test);
42 ##################################################
43 # cleanup test site
44 TestUtils::remove_test_site($site);