diff options
author | Jan Wagner <waja@cyconet.org> | 2017-01-04 14:53:16 +0100 |
---|---|---|
committer | Jan Wagner <waja@cyconet.org> | 2017-01-04 14:53:16 +0100 |
commit | 3fc149f4990358a91ca945f8b649a4c511722e73 (patch) | |
tree | d63d3f02ecdea017d91e8fe902b6e30561313e39 /plugins/t | |
parent | d9a1fb15dd60935cf1655e6b9786b28e899c8dc8 (diff) | |
parent | bf18dc42dd16811a3e0f42d4591604a4213afb3e (diff) | |
download | monitoring-plugins-3fc149f4990358a91ca945f8b649a4c511722e73.tar.gz |
Merge remote-tracking branch 'upstream/pr/1457'
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" ); |