File: 611cgistatus-hosturgencies.t

package info (click to toggle)
nagios4 4.4.6-4.1
  • links: PTS
  • area: main
  • in suites: sid, trixie
  • size: 22,336 kB
  • sloc: ansic: 97,631; sh: 12,619; javascript: 5,483; perl: 2,624; makefile: 1,265; php: 381; ruby: 95
file content (33 lines) | stat: -rw-r--r-- 1,187 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/perl
# 
# Checks for status.cgi

use warnings;
use strict;
use Test::More;
use FindBin qw($Bin);

chdir $Bin or die "Cannot chdir";

my $topdir = "$Bin/..";
my $cgi_dir = "$topdir/cgi";
my $cgi = "$cgi_dir/status.cgi";

my $output;

plan tests => 3;

my $numhosts;

# Host list sorted by name
$output = `NAGIOS_CGI_CONFIG=etc/cgi-hosturgencies.cfg REMOTE_USER=nagiosadmin REQUEST_METHOD=GET QUERY_STRING='hostgroup=all&style=hostdetail' $cgi`;
like( $output, '/>host1<.*>host2<.*>host3<.*>host4</s', "List of hosts sorted by ascending name" );

# Host list sorted by (traditional) status
$output = `NAGIOS_CGI_CONFIG=etc/cgi-hosturgencies.cfg REMOTE_USER=nagiosadmin REQUEST_METHOD=GET QUERY_STRING='hostgroup=all&style=hostdetail&sorttype=1&sortoption=8' $cgi`;
like( $output, '/>host4<.*>host1<.*>host2<.*>host3</s', "List of hosts sorted by ascending status" );

# Host list sorted by urgency
$output = `NAGIOS_CGI_CONFIG=etc/cgi-hosturgencies.cfg REMOTE_USER=nagiosadmin REQUEST_METHOD=GET QUERY_STRING='hostgroup=all&style=hostdetail&sorttype=2&sortoption=9' $cgi`;
like( $output, '/>host2<.*>host3<.*>host4<.*>host1</s', "List of hosts sorted by descending urgency" );