diff options
author | Sven Nierlein <sven@nierlein.de> | 2012-04-09 20:12:21 (GMT) |
---|---|---|
committer | Sven Nierlein <sven@nierlein.de> | 2012-04-09 20:16:39 (GMT) |
commit | 83655083af68ddd87e5177f3dc4365b6d5721ed5 (patch) | |
tree | 0dcef0520f32a2168892a25a86c5635ff025b172 /plugins/t | |
parent | 019c9263708d48f2140eeaafb6577ce9ad013c5e (diff) | |
download | monitoring-plugins-83655083af68ddd87e5177f3dc4365b6d5721ed5.tar.gz |
check_by_ssh: added -F config file to specify alternative ssh config
Diffstat (limited to 'plugins/t')
-rw-r--r-- | plugins/t/check_by_ssh.t | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/plugins/t/check_by_ssh.t b/plugins/t/check_by_ssh.t index 5f2c534..cca72c9 100644 --- a/plugins/t/check_by_ssh.t +++ b/plugins/t/check_by_ssh.t | |||
@@ -17,9 +17,14 @@ my $ssh_key = getTestParameter( "NP_SSH_IDENTITY", | |||
17 | "A key allowing access to NP_SSH_HOST", | 17 | "A key allowing access to NP_SSH_HOST", |
18 | "~/.ssh/id_dsa"); | 18 | "~/.ssh/id_dsa"); |
19 | 19 | ||
20 | my $ssh_conf = getTestParameter( "NP_SSH_CONFIGFILE", | ||
21 | "A config file with ssh settings", | ||
22 | "~/.ssh/config"); | ||
23 | |||
24 | |||
20 | plan skip_all => "SSH_HOST and SSH_IDENTITY must be defined" unless ($ssh_service && $ssh_key); | 25 | plan skip_all => "SSH_HOST and SSH_IDENTITY must be defined" unless ($ssh_service && $ssh_key); |
21 | 26 | ||
22 | plan tests => 40; | 27 | plan tests => 42; |
23 | 28 | ||
24 | # Some random check strings/response | 29 | # Some random check strings/response |
25 | my @responce = ('OK: Everything is fine!', | 30 | my @responce = ('OK: Everything is fine!', |
@@ -85,6 +90,12 @@ $result = NPTest->testCmd( | |||
85 | cmp_ok($result->return_code, '==', 8, "Exit with return code 8 (out of bounds)"); | 90 | cmp_ok($result->return_code, '==', 8, "Exit with return code 8 (out of bounds)"); |
86 | is($result->output, $responce[4], "Return proper status text even with unknown status codes"); | 91 | is($result->output, $responce[4], "Return proper status text even with unknown status codes"); |
87 | 92 | ||
93 | $result = NPTest->testCmd( | ||
94 | "./check_by_ssh -i $ssh_key -H $ssh_service -F $ssh_conf -C 'exit 0'" | ||
95 | ); | ||
96 | cmp_ok($result->return_code, '==', 0, "Exit with return code 0 (OK)"); | ||
97 | is($result->output, 'OK - check_by_ssh: Remote command \'exit 0\' returned status 0', "Status text if command returned none (OK)"); | ||
98 | |||
88 | # Multiple active checks | 99 | # Multiple active checks |
89 | $result = NPTest->testCmd( | 100 | $result = NPTest->testCmd( |
90 | "./check_by_ssh -i $ssh_key -H $ssh_service -C '$check[1]; sh -c exit\\ 1' -C '$check[0]; sh -c exit\\ 0' -C '$check[3]; sh -c exit\\ 3' -C '$check[2]; sh -c exit\\ 2'" | 101 | "./check_by_ssh -i $ssh_key -H $ssh_service -C '$check[1]; sh -c exit\\ 1' -C '$check[0]; sh -c exit\\ 0' -C '$check[3]; sh -c exit\\ 3' -C '$check[2]; sh -c exit\\ 2'" |