summaryrefslogtreecommitdiff
path: root/test/proxy
diff options
context:
space:
mode:
authorDima <dima@cloud66.com>2017-11-28 11:50:02 +0000
committerMiklos Fazekas <mfazekas@szemafor.com>2018-03-04 17:20:53 +0100
commit36b8ce0565d118741bb18b78bc86a803d202f4dc (patch)
tree495b67a7b610dbcd83a7eb719cd6c28b3e818b25 /test/proxy
parentb8fdd0a7fc4f283f0d87a4e603b3db94a91b335f (diff)
downloadnet-ssh-36b8ce0565d118741bb18b78bc86a803d202f4dc.tar.gz
Handle ProxyCommand child in case of timeout and exception
Diffstat (limited to 'test/proxy')
-rw-r--r--test/proxy/test_command.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/proxy/test_command.rb b/test/proxy/test_command.rb
new file mode 100644
index 0000000..22dd17e
--- /dev/null
+++ b/test/proxy/test_command.rb
@@ -0,0 +1,23 @@
+require_relative '../common'
+require 'net/ssh'
+require 'net/ssh/proxy/command'
+
+module NetSSH
+ class TestProxy < NetSSHTest
+ unless Gem.win_platform?
+ def test_process_is_stopped_on_timeout
+ proxy = Net::SSH::Proxy::Command.new('sleep 10')
+ proxy.timeout = 2
+ host = 'foo'
+ port = 1
+ assert_raises Net::SSH::Proxy::ConnectError do
+ proxy.open(host, port)
+ end
+ sleep 0.1
+ assert_raises Errno::ECHILD do
+ Process.waitpid(0, Process::WNOHANG)
+ end
+ end
+ end
+ end
+end