Skip to content
This repository was archived by the owner on Jan 25, 2022. It is now read-only.

Commit

Permalink
Introduce exit status in stream protocol.
Browse files Browse the repository at this point in the history
Change-Id: I5d6f72d1be27ca14d8d92b01805310031701de17
  • Loading branch information
Kowshik Prakasam committed Jul 27, 2012
1 parent 3cbbf7d commit fbe1384
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 13 deletions.
5 changes: 1 addition & 4 deletions warden-client/lib/warden/client/v1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,7 @@ def self.convert_stream_request(args)
end

def self.convert_stream_response(response)
to_return = []
to_return << response.name if response.name
to_return << response.data if response.data
to_return
[response.name, response.data, response.exit_status]
end

def self.convert_run_request(args)
Expand Down
2 changes: 1 addition & 1 deletion warden-client/lib/warden/client/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Warden
class Client
VERSION = "0.0.4"
VERSION = "0.0.5"
end
end
11 changes: 4 additions & 7 deletions warden-client/spec/client/v1_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -218,22 +218,19 @@ def to_response(response)
end

describe "response" do
it "should return a 2-element tuple" do
it "should return a 3-element tuple" do
response = to_response \
Warden::Protocol::StreamResponse.new(
:name => "stdout",
:data => "data"
:data => "data",
:exit_status => 25,
)

response[0].should == "stdout"
response[1].should == "data"
response[2].should == 25
end
end

it "should return an empty tuple when streaming stops" do
response = to_response Warden::Protocol::StreamResponse.new
response.size.should == 0
end
end

describe "run" do
Expand Down
2 changes: 2 additions & 0 deletions warden-protocol/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ source 'https://rubygems.org'

# Specify your gem's dependencies in warden-protocol.gemspec
gemspec

gem 'rake'
1 change: 1 addition & 0 deletions warden-protocol/lib/warden/protocol/stream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class StreamRequest < BaseRequest
class StreamResponse < BaseResponse
optional :name, :string, 1
optional :data, :string, 2
optional :exit_status, :uint32, 3
end
end
end
2 changes: 1 addition & 1 deletion warden-protocol/lib/warden/protocol/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module Warden
module Protocol
VERSION = "0.0.3"
VERSION = "0.0.4"
end
end
5 changes: 5 additions & 0 deletions warden-protocol/spec/stream_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,9 @@
it_should_be_optional
it_should_be_typed_as_string
end

field :exit_status do
it_should_be_optional
it_should_be_typed_as_uint
end
end

0 comments on commit fbe1384

Please sign in to comment.