[icinga-checkins] icinga.org: icinga-core/dev/cgis: Rewrite 611cgistatus-hosturgencies.t

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


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

Author: Alexander Wirt <formorer at debian.org>
Date:   Fri Feb 24 21:24:32 2012 +0100

Rewrite 611cgistatus-hosturgencies.t

---

 t/611cgistatus-hosturgencies.t |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/t/611cgistatus-hosturgencies.t b/t/611cgistatus-hosturgencies.t
index fb96619..fd1073b 100644
--- a/t/611cgistatus-hosturgencies.t
+++ b/t/611cgistatus-hosturgencies.t
@@ -1,17 +1,38 @@
 #!/usr/bin/perl
 
 # host urgency related checks for status.cgi
+# sorting by host urgency is a feature introduced in #1452
+
+# Introducing a new status.cgi sort mode (sortoption=16384) where hosts
+# are sorted by state, but with the order being based on "urgency"
+# (down>unreachable>pending>ok) instead of the historically assigned (?)
+# state IDs (unreachable>down>up>pending).
+
+# cgi-hosturgencies.cfg includes 4 host in all states
+# (down,unreachable,up,pending)
 
 use warnings;
 use strict;
 use Test::More;
 use Icinga::Test qw ( run_cgi );
 
-plan tests => 1;
+plan tests => 3;
 
 
+# sorting by names, so we expect host1,host2,host3,host4
 my $output = run_cgi('etc/cgi-hosturgencies.cfg', 'GET', 'hostgroup=all&style=hostdetail', 'status.cgi');
 like( $output, '/host1.*host2.*host3.*host4/msx', "List of hosts sorted by ascending name" );
 
+# sorting by by ascending status (see above), so we epext 4,1,2,3
+$output = run_cgi('etc/cgi-hosturgencies.cfg', 'GET',
+    'hostgroup=all&style=hostdetail&sortobject=hosts&sorttype=1&sortoption=8', 'status.cgi');
+like( $output, '/host4.*host1.*host2.*host3/mxs', "List of hosts sorted by ascending status" );
+
+# sorting the new way, so we expect 2,3,4,1
+$output = run_cgi('etc/cgi-hosturgencies.cfg', 'GET',
+    'hostgroup=all&style=hostdetail&sortobject=hosts&sorttype=2&sortoption=9', 'status.cgi');
+like( $output, '/host2.*host3.*host4.*host1/mxs', "List of hosts sorted by descending urgency" );
+
+
 open (my $fh, '>', '/tmp/test.html');
 print $fh $output;





More information about the icinga-checkins mailing list