[omd-commits] OMD Git: omd: thruk: added more tests and new tar
git version control
git at mathias-kettner.de
Tue Dec 6 21:38:17 CET 2011
Module: omd
Branch: master
Commit: b506b33a385b1d98461ab5c1c9c2005c9aaadf58
URL: http://omdistro.org/projects/omd/repository/revisions/b506b33a385b1d98461ab5c1c9c2005c9aaadf58
Author: Sven Nierlein <sven at nierlein.de>
Date: Tue Dec 6 21:32:49 2011 +0100
Commiter: Sven Nierlein <sven at nierlein.de>
Date: Tue Dec 6 21:35:14 2011 +0100
thruk: added more tests and new tar
---
packages/thruk/Thruk-1.1.5-src.tar.gz | Bin 3100911 -> 3079798 bytes
t/20-package_thruk.t | 19 +++++++++++++++++--
t/TestUtils.pm | 13 ++++++++++++-
3 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/packages/thruk/Thruk-1.1.5-src.tar.gz b/packages/thruk/Thruk-1.1.5-src.tar.gz
index 22606ee..fc7a8bb 100644
Binary files a/packages/thruk/Thruk-1.1.5-src.tar.gz and b/packages/thruk/Thruk-1.1.5-src.tar.gz differ
diff --git a/t/20-package_thruk.t b/t/20-package_thruk.t
index c6ccb93..3f1382e 100644
--- a/t/20-package_thruk.t
+++ b/t/20-package_thruk.t
@@ -13,7 +13,7 @@ BEGIN {
use lib "$FindBin::Bin/lib/lib/perl5";
}
-plan( tests => 983 );
+plan( tests => 2010 );
##################################################
# create our test site
@@ -94,6 +94,20 @@ my $urls = [
# statusmap
{ url => '/thruk/cgi-bin/statusmap.cgi?host=all', like => '/Network Map For All Hosts/' },
+
+# minemap
+ { url => '/thruk/cgi-bin/minemap.cgi', like => '/Mine Map/' },
+
+# conf tool
+ { url => '/thruk/cgi-bin/conf.cgi', like => '/Config Tool/' },
+ { url => '/thruk/cgi-bin/conf.cgi?sub=thruk', like => [ '/Config Tool/', '/title_prefix/', '/use_wait_feature/'] },
+ { url => '/thruk/cgi-bin/conf.cgi?sub=cgi', like => [ '/Config Tool/', '/show_context_help/', '/use_pending_states/' ] },
+ { url => '/thruk/cgi-bin/conf.cgi?sub=users', like => [ '/Config Tool/', '/select user to change/' ] },
+ { url => '/thruk/cgi-bin/conf.cgi?sub=users&action=change&data.username=omdadmin', like => [ '/Config Tool/', '/remove password/', '/authorized_for_all_services/' ] },
+ { url => '/thruk/cgi-bin/conf.cgi?sub=objects', like => [ '/Config Tool/', '/select host to change/' ] },
+ { url => '/thruk/cgi-bin/conf.cgi?sub=objects&apply=yes', like => [ '/Config Tool/', '/There are no pending changes to commit/' ] },
+ { url => '/thruk/cgi-bin/conf.cgi?sub=objects&type=host&data.name=generic-host', like => [ '/Config Tool/', '/Template:\s+generic\-host/', '/templates.cfg/' ], skip_html_links => 1 },
+ { url => '/thruk/cgi-bin/conf.cgi?sub=objects&action=browser', like => [ '/Config Tool/', '/commands.cfg/' ] },
];
# complete the url
@@ -103,13 +117,14 @@ for my $url ( @{$urls} ) {
$url->{'unlike'} = [ '/internal server error/', '/"\/thruk\//', '/\'\/thruk\//' ];
}
-for my $core (qw/nagios shinken/) {
+for my $core (qw/nagios shinken icinga/) {
##################################################
# run our tests
TestUtils::test_command({ cmd => $omd_bin." stop $site" });
TestUtils::test_command({ cmd => $omd_bin." config $site set CORE $core" });
TestUtils::test_command({ cmd => $omd_bin." start $site" }) or TestUtils::bail_out_clean("No need to test Thruk without proper startup");
TestUtils::wait_for_file("/omd/sites/$site/tmp/run/live", 60) or TestUtils::bail_out_clean("No need to test Thruk without livestatus connection");
+ unlink('var/thruk/obj_retention.dat');
TestUtils::test_command({ cmd => "/bin/su - $site -c './lib/nagios/plugins/check_http -H localhost -a omdadmin:omd -u /$site/nagios/cgi-bin/cmd.cgi -e 200 -P \"cmd_typ=7&cmd_mod=2&host=omd-$site&service=Dummy+Service&start_time=2010-11-06+09%3A46%3A02&force_check=on&btnSubmit=Commit\" -r \"Your command request was successfully submitted\"'", like => '/HTTP OK:/' });
TestUtils::wait_for_file("/omd/sites/$site/var/pnp4nagios/perfdata/omd-$site/Dummy_Service_omd-dummy.rrd", 60) or TestUtils::bail_out_clean("No need to test Thruk without working pnp");;
diff --git a/t/TestUtils.pm b/t/TestUtils.pm
index ab20080..6d0c44a 100644
--- a/t/TestUtils.pm
+++ b/t/TestUtils.pm
@@ -265,7 +265,9 @@ sub test_url {
if($page->{'content_type'} =~ 'text\/html'
and (!defined $test->{'skip_html_links'} or $test->{'skip_html_links'} == 0)
) {
- my @matches = $page->{'content'} =~ m/(src|href)=['|"](.+?)['|"]/gi;
+ my $content = $page->{'content'};
+ $content =~ s/<\!\-\-.*?\-\->//gsmx;
+ my @matches = $content =~ m/(src|href)=['|"](.+?)['|"]/gi;
my $links_to_check;
my $x=0;
for my $match (@matches) {
@@ -295,6 +297,15 @@ sub test_url {
next if defined $already_checked->{$test_url};
#diag("checking link: ".$test_url);
my $req = _request({url => $test_url, auth => $test->{'auth'}});
+ if($req->{'response'}->is_redirect) {
+ my $redirects = 0;
+ while(my $location = $req->{'response'}->{'_headers'}->{'location'}) {
+ if($location !~ m/^(http|\/)/gmx) { $location = _relative_url($location, $req->{'response'}->base()->as_string()); }
+ $req= _request($location);
+ $redirects++;
+ last if $redirects > 10;
+ }
+ }
if($req->{'code'} == 200) {
$already_checked->{$test_url} = 1;
} else {
More information about the omd-commits
mailing list