diff options
author | Michael Lumish <mlumish@google.com> | 2015-08-20 18:57:55 -0400 |
---|---|---|
committer | Michael Lumish <mlumish@google.com> | 2015-08-20 18:57:55 -0400 |
commit | 10cab1396fd6fce4539f6368bda6ea908e1ce27b (patch) | |
tree | d222b5d43db4a10866a05e096b7b922a7f418e25 /src/ruby/spec/generic/active_call_spec.rb | |
parent | 083b4d3de314e66f900c711c2e0f8ff3abed8268 (diff) | |
parent | 7840a5573678880ce71398fdab5948128992bfc7 (diff) |
Merge pull request #3013 from tbetbetbe/grpc-ruby-support-per-message-compression
Adds support for per message compression
Diffstat (limited to 'src/ruby/spec/generic/active_call_spec.rb')
-rw-r--r-- | src/ruby/spec/generic/active_call_spec.rb | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/ruby/spec/generic/active_call_spec.rb b/src/ruby/spec/generic/active_call_spec.rb index 26208b714a..fcd7bd082f 100644 --- a/src/ruby/spec/generic/active_call_spec.rb +++ b/src/ruby/spec/generic/active_call_spec.rb @@ -35,6 +35,7 @@ describe GRPC::ActiveCall do ActiveCall = GRPC::ActiveCall Call = GRPC::Core::Call CallOps = GRPC::Core::CallOps + WriteFlags = GRPC::Core::WriteFlags before(:each) do @pass_through = proc { |x| x } @@ -129,6 +130,31 @@ describe GRPC::ActiveCall do @pass_through, deadline) expect(server_call.remote_read).to eq('marshalled:' + msg) end + + TEST_WRITE_FLAGS = [WriteFlags::BUFFER_HINT, WriteFlags::NO_COMPRESS] + TEST_WRITE_FLAGS.each do |f| + it "successfully makes calls with write_flag set to #{f}" do + call = make_test_call + ActiveCall.client_invoke(call, @client_queue) + marshal = proc { |x| 'marshalled:' + x } + client_call = ActiveCall.new(call, @client_queue, marshal, + @pass_through, deadline) + msg = 'message is a string' + client_call.write_flag = f + client_call.remote_send(msg) + + # confirm that the message was marshalled + recvd_rpc = @server.request_call(@server_queue, @server_tag, deadline) + recvd_call = recvd_rpc.call + server_ops = { + CallOps::SEND_INITIAL_METADATA => nil + } + recvd_call.run_batch(@server_queue, @server_tag, deadline, server_ops) + server_call = ActiveCall.new(recvd_call, @server_queue, @pass_through, + @pass_through, deadline) + expect(server_call.remote_read).to eq('marshalled:' + msg) + end + end end describe '#client_invoke' do @@ -261,7 +287,7 @@ describe GRPC::ActiveCall do client_call.writes_done(false) server_call = expect_server_to_receive(msg) e = client_call.each_remote_read - n = 3 # arbitrary value > 1 + n = 3 # arbitrary value > 1 n.times do server_call.remote_send(reply) expect(e.next).to eq(reply) |