diff options
author | Matthias Eble <psychotrahe@users.sourceforge.net> | 2012-04-10 20:49:24 (GMT) |
---|---|---|
committer | Matthias Eble <psychotrahe@users.sourceforge.net> | 2012-04-10 20:49:24 (GMT) |
commit | 4c30935850997f513b3eee21d169f6d523d43c5d (patch) | |
tree | 09a14dfecd959e1b566b9df7b7fdb99f6bb4c5d8 /plugins/t | |
parent | 9978b3ca744b076d8ea24441819826938211dd17 (diff) | |
parent | 8c7e2b636c601dd05a6881c84cc95136ecf9323e (diff) | |
download | monitoring-plugins-4c30935850997f513b3eee21d169f6d523d43c5d.tar.gz |
Merge branch 'master' of ssh://nagiosplug.git.sourceforge.net/gitroot/nagiosplug/nagiosplug
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'" |