[icinga-checkins] icinga.org: icinga-core/mfriedrich/cgis: Add Icinga::Test lib

git at icinga.org git at icinga.org
Sat Feb 25 15:48:04 CET 2012


Module: icinga-core
Branch: mfriedrich/cgis
Commit: dbdf028afc4597da56bb00e77c034f10a9fccb36
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=dbdf028afc4597da56bb00e77c034f10a9fccb36

Author: Alexander Wirt <formorer at debian.org>
Date:   Thu Feb 23 23:51:01 2012 +0100

Add Icinga::Test lib

---

 t/Icinga/Test.pm |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/t/Icinga/Test.pm b/t/Icinga/Test.pm
new file mode 100644
index 0000000..31a71e6
--- /dev/null
+++ b/t/Icinga/Test.pm
@@ -0,0 +1,36 @@
+#!/usr/bin/perl
+
+package Icinga::Test;
+
+use strict;
+use warnings;
+
+use Exporter 'import';
+our @EXPORT_OK = qw( run_cgi);
+
+use IPC::Run3 qw( run3 );
+
+use FindBin qw($Bin);
+
+my $topdir = "$Bin/..";
+my $cgi_dir = "$topdir/cgi";
+my $cgi = "$cgi_dir/status.cgi";
+
+sub run_cgi ($$$$) {
+    my ($config, $method, $query_string, $cgi) = @_; 
+    my @cmd = qw ( sh -c );
+    chdir $Bin or die "Cannot chdir";
+
+    my $cmd = sprintf("ICINGA_CGI_CONFIG=%s REMOTE_USER=icingaadmin REQUEST_METHOD=%s QUERY_STRING=%s %s",
+        $config,
+        $method,
+        $query_string,
+        "$cgi_dir/$cgi"
+    );
+    my @test = qw ( date );
+    my ($in, $out, $err) = '';
+    run3 ($cmd, \$in, \$out, \$err) or die "cat: $? - $! - $err";
+    return $out;
+}
+
+1;





More information about the icinga-checkins mailing list