File: test_exec.rb

package info (click to toggle)
ruby-net-ssh 1%3A7.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,804 kB
  • sloc: ruby: 16,999; makefile: 5
file content (22 lines) | stat: -rw-r--r-- 534 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require_relative 'common'
require 'net/ssh'

class TestExec < NetSSHTest
  include IntegrationTestHelpers

  def test_error_exitstatus
    ret = Net::SSH.start("localhost", "net_ssh_1", password: 'foopwd') do |ssh|
      ssh.exec! "exit 42"
    end
    assert_equal "", ret
    assert_equal 42, ret.exitstatus
  end

  def test_ok_exitstatus
    ret = Net::SSH.start("localhost", "net_ssh_1", password: 'foopwd') do |ssh|
      ssh.exec! "echo 'foo'"
    end
    assert_equal "foo\n", ret
    assert_equal 0, ret.exitstatus
  end
end