[omd-commits] OMD Git: omd: NagVis test can now be run without nagios/thruk/

git version control git at mathias-kettner.de
Thu Sep 11 14:28:01 CEST 2014


 check_mk packages
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Module:   omd
Branch:   master
Commit:   1a87794db6aedad73fea6c5ca537cf0bd1f473f4
URL:      http://omdistro.org/projects/omd/repository/revisions/1a87794db6aedad73fea6c5ca537cf0bd1f473f4

Author:   Lars Michelsen <lm at mathias-kettner.de>
Date:     Thu Sep 11 14:25:19 2014 +0200
Commiter: Lars Michelsen <lm at mathias-kettner.de>
Date:     Thu Sep 11 14:25:19 2014 +0200

NagVis test can now be run without nagios/thruk/check_mk packages

---

 t/20-package_nagvis.t |   46 ++++++++++++++++++++++++++++++++--------------
 1 file changed, 32 insertions(+), 14 deletions(-)

diff --git a/t/20-package_nagvis.t b/t/20-package_nagvis.t
index 8555809..6eabaee 100644
--- a/t/20-package_nagvis.t
+++ b/t/20-package_nagvis.t
@@ -64,22 +64,40 @@ TestUtils::test_command({ cmd => $omd_bin." config $site set DEFAULT_GUI welcome
 # b) htmlcgi="/nv/nagios/cgi-bin"
 TestUtils::test_command({ cmd  => "/bin/su - $site -c 'cat etc/nagvis/conf.d/urls.ini.php'",
                           like => [ '/hosturl="\[htmlcgi\]\/status.cgi\?host=\[host_name\]"/',
-                                    '/htmlcgi="\/'.$site.'\/nagios\/cgi-bin"/' ] }),
-
-TestUtils::test_command({ cmd => $omd_bin." config $site set DEFAULT_GUI nagios" });
-TestUtils::test_command({ cmd  => "/bin/su - $site -c 'cat etc/nagvis/conf.d/urls.ini.php'",
-                          like => [ '/hosturl="\[htmlcgi\]\/status.cgi\?host=\[host_name\]"/',
-                                    '/htmlcgi="\/'.$site.'\/nagios\/cgi-bin"/' ] }),
+                                    '/htmlcgi="\/'.$site.'\/nagios\/cgi-bin"/' ] });
+
+if (-e '/omd/sites/' . $site .  '/etc/nagios') {
+    TestUtils::test_command({ cmd => $omd_bin." config $site set DEFAULT_GUI nagios" });
+    TestUtils::test_command({ cmd  => "/bin/su - $site -c 'cat etc/nagvis/conf.d/urls.ini.php'",
+                              like => [ '/hosturl="\[htmlcgi\]\/status.cgi\?host=\[host_name\]"/',
+                                        '/htmlcgi="\/'.$site.'\/nagios\/cgi-bin"/' ] });
+} else {
+    # dummy tests to statisfy number of tests (did not know how to decrease number of them)
+    TestUtils::test_command({ cmd => "/bin/echo skip nagios url test"});
+    TestUtils::test_command({ cmd => "/bin/echo skip nagios url test"});
+}
 
-TestUtils::test_command({ cmd => $omd_bin." config $site set DEFAULT_GUI thruk" });
-TestUtils::test_command({ cmd  => "/bin/su - $site -c 'cat etc/nagvis/conf.d/urls.ini.php'",
-                          like => [ '/hosturl="\[htmlcgi\]\/status.cgi\?host=\[host_name\]"/',
-                                    '/htmlcgi="\/'.$site.'\/thruk\/cgi-bin"/' ] }),
+if (-e '/omd/sites/' . $site .  '/etc/thruk') {
+    TestUtils::test_command({ cmd => $omd_bin." config $site set DEFAULT_GUI thruk" });
+    TestUtils::test_command({ cmd  => "/bin/su - $site -c 'cat etc/nagvis/conf.d/urls.ini.php'",
+                              like => [ '/hosturl="\[htmlcgi\]\/status.cgi\?host=\[host_name\]"/',
+                                        '/htmlcgi="\/'.$site.'\/thruk\/cgi-bin"/' ] });
+} else {
+    # dummy tests to statisfy number of tests (did not know how to decrease number of them)
+    TestUtils::test_command({ cmd => "/bin/echo skip thruk url test"});
+    TestUtils::test_command({ cmd => "/bin/echo skup thruk url test"});
+}
 
-TestUtils::test_command({ cmd => $omd_bin." config $site set DEFAULT_GUI check_mk" });
-TestUtils::test_command({ cmd  => "/bin/su - $site -c 'cat etc/nagvis/conf.d/urls.ini.php'",
-                          like => [ '/hosturl="\[htmlcgi\]\/view\.py\?view_name=host&site=&host=\[host_name\]"/',
-                                    '/htmlcgi="\/'.$site.'\/check_mk"/' ] }),
+if (-e '/omd/sites/' . $site .  '/etc/check_mk') {
+    TestUtils::test_command({ cmd => $omd_bin." config $site set DEFAULT_GUI check_mk" });
+    TestUtils::test_command({ cmd  => "/bin/su - $site -c 'cat etc/nagvis/conf.d/urls.ini.php'",
+                              like => [ '/hosturl="\[htmlcgi\]\/view\.py\?view_name=host&site=&host=\[host_name\]"/',
+                                        '/htmlcgi="\/'.$site.'\/check_mk"/' ] });
+} else {
+    # dummy tests to statisfy number of tests (did not know how to decrease number of them)
+    TestUtils::test_command({ cmd => "/bin/echo skip check_mk url test"});
+    TestUtils::test_command({ cmd => "/bin/echo skup check_mk url test"});
+}
 
 
 ##################################################



More information about the omd-commits mailing list