diff options
-rw-r--r-- | t/50-icli.t | 41 | ||||
-rw-r--r-- | t/out/filter_.A.o | 7 | ||||
-rw-r--r-- | t/out/filter_.o | 7 | ||||
-rw-r--r-- | t/out/filter_.o.A.D | 3 | ||||
-rw-r--r-- | t/out/filter_A | 0 | ||||
-rw-r--r-- | t/out/filter_D | 17 | ||||
-rw-r--r-- | t/out/filter_S | 7 | ||||
-rw-r--r-- | t/out/filter_c | 3 | ||||
-rw-r--r-- | t/out/filter_u | 3 | ||||
-rw-r--r-- | t/out/filter_w | 3 | ||||
-rw-r--r-- | t/out/h_filter_.o | 2 | ||||
-rw-r--r-- | t/out/h_filter_S | 2 | ||||
-rw-r--r-- | t/out/h_filter_S.x.A | 1 | ||||
-rw-r--r-- | t/out/h_filter_d | 1 | ||||
-rw-r--r-- | t/out/h_filter_x | 1 |
15 files changed, 97 insertions, 1 deletions
diff --git a/t/50-icli.t b/t/50-icli.t index 7bf7d9b..6b3129a 100644 --- a/t/50-icli.t +++ b/t/50-icli.t @@ -3,7 +3,7 @@ use strict; use warnings; use 5.010; -use Test::Command tests => (22*3); +use Test::Command tests => (36*3); my $icli = 'bin/icli -f t/in/status.dat -c t/in/objects.cache'; @@ -11,6 +11,19 @@ my $EMPTY = q{}; my $cmd = Test::Command->new(cmd => $icli); +sub run_filter_test { + my ($prefix, $run, $filter) = @_; + + my $file = $filter; + $file =~ tr/,//d; + $file =~ tr/!/./; + + $cmd = Test::Command->new(cmd => "$icli $run -z $filter"); + $cmd->exit_is_num(0); + $cmd->stdout_is_file("t/out/${prefix}_${file}"); + $cmd->stderr_is_eq($EMPTY); +} + $cmd->exit_is_num(0); $cmd->stdout_is_file('t/out/standard'); $cmd->stderr_is_eq($EMPTY); @@ -106,6 +119,32 @@ $cmd->exit_isnt_num(0); $cmd->stdout_is_eq($EMPTY); $cmd->stderr_is_eq("See perldoc -F bin/icli\n"); +for my $filter (qw( + A + !A,!o + c + D + !o + !o,!A,!D + S + u + w + )) +{ + run_filter_test('filter', q{}, $filter); +} + +for my $filter (qw( + d + !o + S + S,!x,!A + x + )) +{ + run_filter_test('h_filter', '-lh', $filter); +} + $icli = "bin/icli -f t/in/status.dat.weird.1 -c t/in/objects.cache"; diff --git a/t/out/filter_.A.o b/t/out/filter_.A.o new file mode 100644 index 0000000..f6396c5 --- /dev/null +++ b/t/out/filter_.A.o @@ -0,0 +1,7 @@ + +aneurysm + Load [37;41mCRITICAL[0m OK - load average: 0.17, 0.13, 0.09 + Processes [37;44m UNKNOWN[0m PROCS OK: 118 processes + +steel.derf0.net + Users [30;43m WARNING[0m USERS OK - 0 users currently logged in diff --git a/t/out/filter_.o b/t/out/filter_.o new file mode 100644 index 0000000..f6396c5 --- /dev/null +++ b/t/out/filter_.o @@ -0,0 +1,7 @@ + +aneurysm + Load [37;41mCRITICAL[0m OK - load average: 0.17, 0.13, 0.09 + Processes [37;44m UNKNOWN[0m PROCS OK: 118 processes + +steel.derf0.net + Users [30;43m WARNING[0m USERS OK - 0 users currently logged in diff --git a/t/out/filter_.o.A.D b/t/out/filter_.o.A.D new file mode 100644 index 0000000..abd6201 --- /dev/null +++ b/t/out/filter_.o.A.D @@ -0,0 +1,3 @@ + +steel.derf0.net + Users [30;43m WARNING[0m USERS OK - 0 users currently logged in diff --git a/t/out/filter_A b/t/out/filter_A new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/t/out/filter_A diff --git a/t/out/filter_D b/t/out/filter_D new file mode 100644 index 0000000..105ebbe --- /dev/null +++ b/t/out/filter_D @@ -0,0 +1,17 @@ + +alpha + HTTP [30;42m OK [0m HTTP OK: HTTP/1.0 200 OK - 2333 bytes in 0.019 second response time + +aneurysm + Disk: / [30;42m OK [0m DISK OK - free space: / 4846 MB (75% inode=90%): + Disk: /boot [30;42m OK [0m DISK OK - free space: /boot 119 MB (53% inode=99%): + Disk: /data [30;42m OK [0m DISK OK - free space: /data 60091 MB (48% inode=99%): + Disk: /home [30;42m OK [0m DISK OK - free space: /home 58378 MB (59% inode=98%): + HTTP [30;42m OK [0m HTTP OK: HTTP/1.1 200 OK - 7467 bytes in 0.001 second response time + HTTPS [30;42m OK [0m HTTP OK: HTTP/1.1 200 OK - 7467 bytes in 0.018 second response time + Load [37;41mCRITICAL[0m OK - load average: 0.17, 0.13, 0.09 + Processes [37;44m UNKNOWN[0m PROCS OK: 118 processes + SMTP [30;42m OK [0m SMTP OK - 0.038 sec. response time + SSH [30;42m OK [0m SSH OK - OpenSSH_5.5p1 Debian-4 (protocol 2.0) + SSH password login d [30;42m OK [0m Password login disabled (server accepts publickey) + System Backup PENDING /dev/mapper/misc-backup 109G 40G 69G 37% /backup diff --git a/t/out/filter_S b/t/out/filter_S new file mode 100644 index 0000000..f6396c5 --- /dev/null +++ b/t/out/filter_S @@ -0,0 +1,7 @@ + +aneurysm + Load [37;41mCRITICAL[0m OK - load average: 0.17, 0.13, 0.09 + Processes [37;44m UNKNOWN[0m PROCS OK: 118 processes + +steel.derf0.net + Users [30;43m WARNING[0m USERS OK - 0 users currently logged in diff --git a/t/out/filter_c b/t/out/filter_c new file mode 100644 index 0000000..acc5847 --- /dev/null +++ b/t/out/filter_c @@ -0,0 +1,3 @@ + +aneurysm + Load [37;41mCRITICAL[0m OK - load average: 0.17, 0.13, 0.09 diff --git a/t/out/filter_u b/t/out/filter_u new file mode 100644 index 0000000..ba2b691 --- /dev/null +++ b/t/out/filter_u @@ -0,0 +1,3 @@ + +aneurysm + Processes [37;44m UNKNOWN[0m PROCS OK: 118 processes diff --git a/t/out/filter_w b/t/out/filter_w new file mode 100644 index 0000000..abd6201 --- /dev/null +++ b/t/out/filter_w @@ -0,0 +1,3 @@ + +steel.derf0.net + Users [30;43m WARNING[0m USERS OK - 0 users currently logged in diff --git a/t/out/h_filter_.o b/t/out/h_filter_.o new file mode 100644 index 0000000..7c08a69 --- /dev/null +++ b/t/out/h_filter_.o @@ -0,0 +1,2 @@ +alpha [37;41m DOWN [0m PING OK - Packet loss = 0%, RTA = 0.73 ms +aneurysm [37;44mUNREACHABLE[0m PING OK - Packet loss = 0%, RTA = 0.10 ms diff --git a/t/out/h_filter_S b/t/out/h_filter_S new file mode 100644 index 0000000..7c08a69 --- /dev/null +++ b/t/out/h_filter_S @@ -0,0 +1,2 @@ +alpha [37;41m DOWN [0m PING OK - Packet loss = 0%, RTA = 0.73 ms +aneurysm [37;44mUNREACHABLE[0m PING OK - Packet loss = 0%, RTA = 0.10 ms diff --git a/t/out/h_filter_S.x.A b/t/out/h_filter_S.x.A new file mode 100644 index 0000000..8ecadc0 --- /dev/null +++ b/t/out/h_filter_S.x.A @@ -0,0 +1 @@ +alpha [37;41m DOWN [0m PING OK - Packet loss = 0%, RTA = 0.73 ms diff --git a/t/out/h_filter_d b/t/out/h_filter_d new file mode 100644 index 0000000..8ecadc0 --- /dev/null +++ b/t/out/h_filter_d @@ -0,0 +1 @@ +alpha [37;41m DOWN [0m PING OK - Packet loss = 0%, RTA = 0.73 ms diff --git a/t/out/h_filter_x b/t/out/h_filter_x new file mode 100644 index 0000000..df4ab1a --- /dev/null +++ b/t/out/h_filter_x @@ -0,0 +1 @@ +aneurysm [37;44mUNREACHABLE[0m PING OK - Packet loss = 0%, RTA = 0.10 ms |