diff options
author | Christian Schmidt <c960657@users.noreply.github.com> | 2016-12-29 16:09:24 +0100 |
---|---|---|
committer | Jan Wagner <waja@cyconet.org> | 2016-12-31 12:00:46 +0100 |
commit | bf18dc42dd16811a3e0f42d4591604a4213afb3e (patch) | |
tree | f9197f26502f588c01e1d4333814c72f78a7f003 /plugins/t | |
parent | f524b15e572c4316feb70917d05f6349bef996ef (diff) | |
download | monitoring-plugins-bf18dc42dd16811a3e0f42d4591604a4213afb3e.tar.gz |
Add --only-critical switch to check_apt
Diffstat (limited to 'plugins/t')
-rw-r--r-- | plugins/t/check_apt.t | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/plugins/t/check_apt.t b/plugins/t/check_apt.t index 9ba0ff8e..430eb53e 100644 --- a/plugins/t/check_apt.t +++ b/plugins/t/check_apt.t | |||
@@ -23,7 +23,7 @@ sub make_result_regexp { | |||
23 | } | 23 | } |
24 | 24 | ||
25 | if (-x "./check_apt") { | 25 | if (-x "./check_apt") { |
26 | plan tests => 28; | 26 | plan tests => 36; |
27 | } else { | 27 | } else { |
28 | plan skip_all => "No check_apt compiled"; | 28 | plan skip_all => "No check_apt compiled"; |
29 | } | 29 | } |
@@ -40,10 +40,18 @@ $result = NPTest->testCmd( sprintf($testfile_command, "", "debian2") ); | |||
40 | is( $result->return_code, 1, "Debian apt output, warning" ); | 40 | is( $result->return_code, 1, "Debian apt output, warning" ); |
41 | like( $result->output, make_result_regexp(13, 0), "Output correct" ); | 41 | like( $result->output, make_result_regexp(13, 0), "Output correct" ); |
42 | 42 | ||
43 | $result = NPTest->testCmd( sprintf($testfile_command, "-o", "debian2") ); | ||
44 | is( $result->return_code, 0, "Debian apt output, no critical" ); | ||
45 | like( $result->output, make_result_regexp(13, 0), "Output correct" ); | ||
46 | |||
43 | $result = NPTest->testCmd( sprintf($testfile_command, "", "debian3") ); | 47 | $result = NPTest->testCmd( sprintf($testfile_command, "", "debian3") ); |
44 | is( $result->return_code, 2, "Debian apt output, some critical" ); | 48 | is( $result->return_code, 2, "Debian apt output, some critical" ); |
45 | like( $result->output, make_result_regexp(19, 4), "Output correct" ); | 49 | like( $result->output, make_result_regexp(19, 4), "Output correct" ); |
46 | 50 | ||
51 | $result = NPTest->testCmd( sprintf($testfile_command, "-o", "debian3") ); | ||
52 | is( $result->return_code, 2, "Debian apt output, some critical" ); | ||
53 | like( $result->output, make_result_regexp(19, 4), "Output correct" ); | ||
54 | |||
47 | $result = NPTest->testCmd( sprintf($testfile_command, "-c '^[^\\(]*\\(.* (Debian-Security:|Ubuntu:[^/]*/[^-]*-security)'", "debian3") ); | 55 | $result = NPTest->testCmd( sprintf($testfile_command, "-c '^[^\\(]*\\(.* (Debian-Security:|Ubuntu:[^/]*/[^-]*-security)'", "debian3") ); |
48 | is( $result->return_code, 2, "Debian apt output - should have same result when default security regexp specified via -c" ); | 56 | is( $result->return_code, 2, "Debian apt output - should have same result when default security regexp specified via -c" ); |
49 | like( $result->output, make_result_regexp(19, 4), "Output correct" ); | 57 | like( $result->output, make_result_regexp(19, 4), "Output correct" ); |
@@ -52,6 +60,10 @@ $result = NPTest->testCmd( sprintf($testfile_command, "-i libc6", "debian3") ); | |||
52 | is( $result->return_code, 1, "Debian apt output, filter for libc6" ); | 60 | is( $result->return_code, 1, "Debian apt output, filter for libc6" ); |
53 | like( $result->output, make_result_regexp(3, 0), "Output correct" ); | 61 | like( $result->output, make_result_regexp(3, 0), "Output correct" ); |
54 | 62 | ||
63 | $result = NPTest->testCmd( sprintf($testfile_command, "-i libc6", "debian3") ); | ||
64 | is( $result->return_code, 1, "Debian apt output, filter for libc6, not critical" ); | ||
65 | like( $result->output, make_result_regexp(3, 0), "Output correct" ); | ||
66 | |||
55 | $result = NPTest->testCmd( sprintf($testfile_command, "-i libc6 -i xen", "debian3") ); | 67 | $result = NPTest->testCmd( sprintf($testfile_command, "-i libc6 -i xen", "debian3") ); |
56 | is( $result->return_code, 2, "Debian apt output, filter for libc6 and xen" ); | 68 | is( $result->return_code, 2, "Debian apt output, filter for libc6 and xen" ); |
57 | like( $result->output, make_result_regexp(9, 4), "Output correct" ); | 69 | like( $result->output, make_result_regexp(9, 4), "Output correct" ); |
@@ -64,6 +76,10 @@ $result = NPTest->testCmd( sprintf($testfile_command, "-e libc6", "debian3") ); | |||
64 | is( $result->return_code, 2, "Debian apt output, filter out libc6" ); | 76 | is( $result->return_code, 2, "Debian apt output, filter out libc6" ); |
65 | like( $result->output, make_result_regexp(16, 4), "Output correct" ); | 77 | like( $result->output, make_result_regexp(16, 4), "Output correct" ); |
66 | 78 | ||
79 | $result = NPTest->testCmd( sprintf($testfile_command, "-e libc6 -o", "debian3") ); | ||
80 | is( $result->return_code, 2, "Debian apt output, filter out libc6, critical" ); | ||
81 | like( $result->output, make_result_regexp(16, 4), "Output correct" ); | ||
82 | |||
67 | $result = NPTest->testCmd( sprintf($testfile_command, "-e libc6 -e xen", "debian3") ); | 83 | $result = NPTest->testCmd( sprintf($testfile_command, "-e libc6 -e xen", "debian3") ); |
68 | is( $result->return_code, 1, "Debian apt output, filter out libc6 and xen" ); | 84 | is( $result->return_code, 1, "Debian apt output, filter out libc6 and xen" ); |
69 | like( $result->output, make_result_regexp(10, 0), "Output correct" ); | 85 | like( $result->output, make_result_regexp(10, 0), "Output correct" ); |