diff options
author | Doc Ritezel <pair+doc@pivotallabs.com> | 2012-11-17 11:08:20 -0800 |
---|---|---|
committer | Doc Ritezel <pair+doc@pivotallabs.com> | 2012-11-17 12:57:52 -0800 |
commit | 358b4e51a747ca5152b436ef1c582b7c9248db3b (patch) | |
tree | 3c73fced9d2e5bfe6894312a0cee3ba1691a3c39 | |
parent | 6e8d26da589de514374bf5a1786800341109f5ef (diff) | |
download | net-ssh-358b4e51a747ca5152b436ef1c582b7c9248db3b.tar.gz |
Add stderr handling to Net::SSH::Test
Add #gets_extended_data to the test flow
-rw-r--r-- | lib/net/ssh/test/channel.rb | 9 | ||||
-rw-r--r-- | lib/net/ssh/test/packet.rb | 1 | ||||
-rw-r--r-- | lib/net/ssh/test/script.rb | 9 |
3 files changed, 19 insertions, 0 deletions
diff --git a/lib/net/ssh/test/channel.rb b/lib/net/ssh/test/channel.rb index 261d8f3..1b58671 100644 --- a/lib/net/ssh/test/channel.rb +++ b/lib/net/ssh/test/channel.rb @@ -10,6 +10,7 @@ module Net; module SSH; module Test # channel = session.opens_channel # channel.sends_exec "ls" # channel.gets_data "result of ls" + # channel.gets_extended_data "some error coming from ls" # channel.gets_close # channel.sends_close # end @@ -104,6 +105,14 @@ module Net; module SSH; module Test script.gets_channel_data(self, data) end + # Scripts the reception of a channel extended data packet from the remote + # end. + # + # channel.gets_extended_data "whoops" + def gets_extended_data(data) + script.gets_channel_extended_data(self, data) + end + # Scripts the reception of an "exit-status" channel request packet. # # channel.gets_exit_status(127) diff --git a/lib/net/ssh/test/packet.rb b/lib/net/ssh/test/packet.rb index 0853003..60cf4e6 100644 --- a/lib/net/ssh/test/packet.rb +++ b/lib/net/ssh/test/packet.rb @@ -65,6 +65,7 @@ module Net; module SSH; module Test when CHANNEL_OPEN then [:string, :long, :long, :long] when CHANNEL_OPEN_CONFIRMATION then [:long, :long, :long, :long] when CHANNEL_DATA then [:long, :string] + when CHANNEL_EXTENDED_DATA then [:long, :long, :string] when CHANNEL_EOF, CHANNEL_CLOSE, CHANNEL_SUCCESS, CHANNEL_FAILURE then [:long] when CHANNEL_REQUEST parts = [:long, :string, :bool] diff --git a/lib/net/ssh/test/script.rb b/lib/net/ssh/test/script.rb index 89ee064..701defc 100644 --- a/lib/net/ssh/test/script.rb +++ b/lib/net/ssh/test/script.rb @@ -111,6 +111,15 @@ module Net; module SSH; module Test events << RemotePacket.new(:channel_data, channel.local_id, data) end + # Scripts the reception of a channel extended data packet from the remote + # host by the given Net::SSH::Test::Channel +channel+. This will typically + # be called via Net::SSH::Test::Channel#gets_extended_data. + # + # Currently the only extended data type is stderr == 1. + def gets_channel_extended_data(channel, data) + events << RemotePacket.new(:channel_extended_data, channel.local_id, 1, data) + end + # Scripts the reception of a channel request packet from the remote host by # the given Net::SSH::Test::Channel +channel+. This will typically be # called via Net::SSH::Test::Channel#gets_exit_status. |