[icinga-checkins] icinga.org: icinga-core/mfriedrich/cgis: Remove todo item - it will never output a useful error

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


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

Author: Alexander Wirt <formorer at debian.org>
Date:   Fri Feb 24 22:14:49 2012 +0100

Remove todo item - it will never output a useful error

---

 t/615cgierror.t |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/t/615cgierror.t b/t/615cgierror.t
new file mode 100644
index 0000000..288bb38
--- /dev/null
+++ b/t/615cgierror.t
@@ -0,0 +1,34 @@
+#!/usr/bin/perl
+
+# Check against all cgis that you get an appropriate error is raised when the CGI config file does not exist
+
+
+use warnings;
+use strict;
+use Test::More;
+use Icinga::Test qw ( run_cgi );
+
+use FindBin qw($Bin);
+
+chdir $Bin or die "Cannot chdir";
+
+my $topdir = "$Bin/..";
+my $cgi_dir = "$topdir/cgi";
+
+# get all cgis from our bindir
+opendir(my $dh, $cgi_dir) or die "Cannot opendir $cgi_dir: $!";
+my %cgis = map { ( $_ => 1 ) } grep /\.cgi$/, readdir $dh;
+closedir $dh;
+
+
+# statuswrl does not output an appropriate error
+delete $cgis{'statuswrl.cgi'};
+
+plan tests => scalar keys %cgis;
+
+# loop over all cgis and see if they return an error
+foreach my $cgi (sort keys %cgis) {
+	my $output = `ICINGA_CGI_CONFIG=etc/cgi.nonexistant REQUEST_METHOD=GET $cgi_dir/$cgi`;
+	like( $output, "/Error: Could not open CGI (config|configuration) file 'etc/cgi.nonexistant' for reading/", "Found error for $cgi" );
+}
+





More information about the icinga-checkins mailing list