[omd-commits] OMD Git: omd: tests: use APACHE_INIT from config for apache restarts
git version control
git at mathias-kettner.de
Wed Dec 29 20:40:34 CET 2010
Module: omd
Branch: master
Commit: 27a9c317a57757e9b1bc5fb7030d53bbf8e5ab26
URL: http://omdistro.org/projects/omd/repository/revisions/27a9c317a57757e9b1bc5fb7030d53bbf8e5ab26
Author: Sven Nierlein <sven at nierlein.de>
Date: Wed Dec 29 20:32:18 2010 +0100
tests: use APACHE_INIT from config for apache restarts
---
t/20-package_omd.t | 2 +-
t/20-package_thruk.t | 2 +-
t/TestUtils.pm | 27 +++++++++++++++++++++++++++
3 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/t/20-package_omd.t b/t/20-package_omd.t
index 07da0b0..9a4cc7b 100644
--- a/t/20-package_omd.t
+++ b/t/20-package_omd.t
@@ -42,7 +42,7 @@ for my $test (@{$tests}) {
# switch webserver to shared mode
TestUtils::test_command({ cmd => $omd_bin." config $site set WEBSERVER shared" });
-TestUtils::test_command({ cmd => "/etc/init.d/apache2 reload" });
+TestUtils::test_command({ cmd => TestUtils::config('APACHE_INIT')." reload" });
# then run tests again
for my $test (@{$tests}) {
diff --git a/t/20-package_thruk.t b/t/20-package_thruk.t
index 80c1ddb..dfd6a51 100644
--- a/t/20-package_thruk.t
+++ b/t/20-package_thruk.t
@@ -106,7 +106,7 @@ for my $url ( @{$urls} ) {
# switch webserver to shared mode
TestUtils::test_command({ cmd => $omd_bin." stop $site" });
TestUtils::test_command({ cmd => $omd_bin." config $site set WEBSERVER shared" });
-TestUtils::test_command({ cmd => "/etc/init.d/apache2 reload" });
+TestUtils::test_command({ cmd => TestUtils::config('APACHE_INIT')." reload" });
TestUtils::test_command({ cmd => $omd_bin." start $site" });
##################################################
diff --git a/t/TestUtils.pm b/t/TestUtils.pm
index d58af2c..b5dc25b 100644
--- a/t/TestUtils.pm
+++ b/t/TestUtils.pm
@@ -283,6 +283,33 @@ sub test_url {
##################################################
+=head2 config
+
+ return config value
+
+=cut
+sub config {
+ my $key = shift;
+ our $config;
+ return $config->{$key} if defined $config;
+
+ $config = {};
+ my $conf_file = "/omd/versions/default/share/omd/distro.info";
+ open(my $fh, '<', $conf_file) or carp("cannot open $conf_file: $!");
+ while(<$fh>) {
+ my($key,$value) = split/\s+=\s+/,$_,2;
+ $key =~ s/^\s+//;
+ $value =~ s/\s+$//;
+ $config->{$key} = $value;
+ }
+ close($fh);
+ return $config->{$key};
+}
+
+
+
+##################################################
+
=head2 _diag_lint_errors_and_remove_some_exceptions
removes some lint errors we want to ignore
More information about the omd-commits
mailing list