[omd-commits] OMD Git: omd: added tests for nagios-plugins

git version control git at mathias-kettner.de
Mon Apr 11 23:24:52 CEST 2011


Module:   omd
Branch:   master
Commit:   6ba9a39cb21ab158be9a2d5bdd475a243349316c
URL:      http://omdistro.org/projects/omd/repository/revisions/6ba9a39cb21ab158be9a2d5bdd475a243349316c

Author:   Sven Nierlein <sven at nierlein.de>
Date:     Mon Apr 11 23:24:09 2011 +0200
Commiter: Sven Nierlein <sven at nierlein.de>
Date:     Mon Apr 11 23:24:09 2011 +0200

added tests for nagios-plugins

---

 t/20-package_nagios_plugins.t |   36 ++++++++++++++++++++++++++++++++++++
 t/30-check_webinject.t        |    6 +-----
 2 files changed, 37 insertions(+), 5 deletions(-)

diff --git a/t/20-package_nagios_plugins.t b/t/20-package_nagios_plugins.t
new file mode 100644
index 0000000..ee94747
--- /dev/null
+++ b/t/20-package_nagios_plugins.t
@@ -0,0 +1,36 @@
+#!/usr/bin/env perl
+
+use warnings;
+use strict;
+use Test::More;
+
+BEGIN {
+    use lib('t');
+    require TestUtils;
+    import TestUtils;
+    use FindBin;
+    use lib "$FindBin::Bin/lib/lib/perl5";
+}
+
+plan( tests => 22 );
+
+##################################################
+# create our test site
+my $omd_bin = TestUtils::get_omd_bin();
+my $site    = TestUtils::create_test_site() or TestUtils::bail_out_clean("no further testing without site");
+
+##################################################
+# execute some checks
+my $tests = [
+  { cmd => "/bin/su - $site -c 'lib/nagios/plugins/check_icmp'",     exit => 3, like => '/check_icmp: No hosts to check/' },
+  { cmd => "/bin/su - $site -c 'lib/nagios/plugins/check_snmp'",     exit => 3, like => '/check_snmp: Could not parse arguments/' },
+  { cmd => "/bin/su - $site -c 'lib/nagios/plugins/check_mysql'",    exit => 2, like => '/Can\'t connect to local MySQL server through socket/' },
+  { cmd => "/bin/su - $site -c 'lib/nagios/plugins/check_logfiles'", exit => 3, like => '/Usage: check_logfiles/' },
+];
+for my $test (@{$tests}) {
+    TestUtils::test_command($test);
+}
+
+##################################################
+# cleanup test site
+TestUtils::remove_test_site($site);
diff --git a/t/30-check_webinject.t b/t/30-check_webinject.t
index 29b039f..a0e4d24 100644
--- a/t/30-check_webinject.t
+++ b/t/30-check_webinject.t
@@ -12,7 +12,7 @@ BEGIN {
     use lib "$FindBin::Bin/lib/lib/perl5";
 }
 
-plan( tests => 16 );
+plan( tests => 10 );
 
 ##################################################
 # create our test site
@@ -22,11 +22,7 @@ my $site    = TestUtils::create_test_site() or TestUtils::bail_out_clean("no fur
 ##################################################
 # execute some checks
 my $tests = [
-  { cmd => $omd_bin." start $site" },
-
   { cmd => "/bin/su - $site -c 'lib/nagios/plugins/check_webinject'", exit => 3, like => '/find any test case files to run./' },
-
-  { cmd => $omd_bin." stop $site" },
 ];
 for my $test (@{$tests}) {
     TestUtils::test_command($test);



More information about the omd-commits mailing list