File: test_command.rb

package info (click to toggle)
ruby-net-ssh 1%3A6.1.0-2%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,884 kB
  • sloc: ruby: 15,997; makefile: 4
file content (28 lines) | stat: -rw-r--r-- 745 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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
        10.times do
          Process.waitpid(0, Process::WNOHANG) rescue true # rubocop:disable Style/RescueModifier
        end

        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.2
        assert_raises Errno::ECHILD do
          Process.waitpid(0, Process::WNOHANG)
          skip "This test is fragile TODO revise"
        end
      end
    end
  end
end