|
|
|
@ -70,7 +70,7 @@ describe 'ClientStub' do |
|
|
|
|
it 'can be created from a host and args' do |
|
|
|
|
opts = { a_channel_arg: 'an_arg' } |
|
|
|
|
blk = proc do |
|
|
|
|
GRPC::ClientStub.new(fake_host, @cq, **opts) |
|
|
|
|
GRPC::ClientStub.new(fake_host, @cq, :this_channel_is_insecure, **opts) |
|
|
|
|
end |
|
|
|
|
expect(&blk).not_to raise_error |
|
|
|
|
end |
|
|
|
@ -78,7 +78,7 @@ describe 'ClientStub' do |
|
|
|
|
it 'can be created with a default deadline' do |
|
|
|
|
opts = { a_channel_arg: 'an_arg', deadline: 5 } |
|
|
|
|
blk = proc do |
|
|
|
|
GRPC::ClientStub.new(fake_host, @cq, **opts) |
|
|
|
|
GRPC::ClientStub.new(fake_host, @cq, :this_channel_is_insecure, **opts) |
|
|
|
|
end |
|
|
|
|
expect(&blk).not_to raise_error |
|
|
|
|
end |
|
|
|
@ -86,7 +86,7 @@ describe 'ClientStub' do |
|
|
|
|
it 'can be created with an channel override' do |
|
|
|
|
opts = { a_channel_arg: 'an_arg', channel_override: @ch } |
|
|
|
|
blk = proc do |
|
|
|
|
GRPC::ClientStub.new(fake_host, @cq, **opts) |
|
|
|
|
GRPC::ClientStub.new(fake_host, @cq, :this_channel_is_insecure, **opts) |
|
|
|
|
end |
|
|
|
|
expect(&blk).not_to raise_error |
|
|
|
|
end |
|
|
|
@ -94,15 +94,15 @@ describe 'ClientStub' do |
|
|
|
|
it 'cannot be created with a bad channel override' do |
|
|
|
|
blk = proc do |
|
|
|
|
opts = { a_channel_arg: 'an_arg', channel_override: Object.new } |
|
|
|
|
GRPC::ClientStub.new(fake_host, @cq, **opts) |
|
|
|
|
GRPC::ClientStub.new(fake_host, @cq, :this_channel_is_insecure, **opts) |
|
|
|
|
end |
|
|
|
|
expect(&blk).to raise_error |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it 'cannot be created with bad credentials' do |
|
|
|
|
blk = proc do |
|
|
|
|
opts = { a_channel_arg: 'an_arg', creds: Object.new } |
|
|
|
|
GRPC::ClientStub.new(fake_host, @cq, **opts) |
|
|
|
|
opts = { a_channel_arg: 'an_arg' } |
|
|
|
|
GRPC::ClientStub.new(fake_host, @cq, Object.new, **opts) |
|
|
|
|
end |
|
|
|
|
expect(&blk).to raise_error |
|
|
|
|
end |
|
|
|
@ -112,10 +112,10 @@ describe 'ClientStub' do |
|
|
|
|
blk = proc do |
|
|
|
|
opts = { |
|
|
|
|
GRPC::Core::Channel::SSL_TARGET => 'foo.test.google.fr', |
|
|
|
|
a_channel_arg: 'an_arg', |
|
|
|
|
creds: GRPC::Core::ChannelCredentials.new(certs[0], nil, nil) |
|
|
|
|
a_channel_arg: 'an_arg' |
|
|
|
|
} |
|
|
|
|
GRPC::ClientStub.new(fake_host, @cq, **opts) |
|
|
|
|
creds = GRPC::Core::ChannelCredentials.new(certs[0], nil, nil) |
|
|
|
|
GRPC::ClientStub.new(fake_host, @cq, creds, **opts) |
|
|
|
|
end |
|
|
|
|
expect(&blk).to_not raise_error |
|
|
|
|
end |
|
|
|
@ -130,7 +130,8 @@ describe 'ClientStub' do |
|
|
|
|
it 'should send a request to/receive a reply from a server' do |
|
|
|
|
server_port = create_test_server |
|
|
|
|
th = run_request_response(@sent_msg, @resp, @pass) |
|
|
|
|
stub = GRPC::ClientStub.new("localhost:#{server_port}", @cq) |
|
|
|
|
stub = GRPC::ClientStub.new("localhost:#{server_port}", @cq, |
|
|
|
|
:this_channel_is_insecure) |
|
|
|
|
expect(get_response(stub)).to eq(@resp) |
|
|
|
|
th.join |
|
|
|
|
end |
|
|
|
@ -140,7 +141,7 @@ describe 'ClientStub' do |
|
|
|
|
host = "localhost:#{server_port}" |
|
|
|
|
th = run_request_response(@sent_msg, @resp, @pass, |
|
|
|
|
k1: 'v1', k2: 'v2') |
|
|
|
|
stub = GRPC::ClientStub.new(host, @cq) |
|
|
|
|
stub = GRPC::ClientStub.new(host, @cq, :this_channel_is_insecure) |
|
|
|
|
expect(get_response(stub)).to eq(@resp) |
|
|
|
|
th.join |
|
|
|
|
end |
|
|
|
@ -149,8 +150,10 @@ describe 'ClientStub' do |
|
|
|
|
server_port = create_test_server |
|
|
|
|
alt_host = "localhost:#{server_port}" |
|
|
|
|
th = run_request_response(@sent_msg, @resp, @pass) |
|
|
|
|
ch = GRPC::Core::Channel.new(alt_host, nil) |
|
|
|
|
stub = GRPC::ClientStub.new('ignored-host', @cq, channel_override: ch) |
|
|
|
|
ch = GRPC::Core::Channel.new(alt_host, nil, :this_channel_is_insecure) |
|
|
|
|
stub = GRPC::ClientStub.new('ignored-host', @cq, |
|
|
|
|
:this_channel_is_insecure, |
|
|
|
|
channel_override: ch) |
|
|
|
|
expect(get_response(stub)).to eq(@resp) |
|
|
|
|
th.join |
|
|
|
|
end |
|
|
|
@ -159,7 +162,7 @@ describe 'ClientStub' do |
|
|
|
|
server_port = create_test_server |
|
|
|
|
host = "localhost:#{server_port}" |
|
|
|
|
th = run_request_response(@sent_msg, @resp, @fail) |
|
|
|
|
stub = GRPC::ClientStub.new(host, @cq) |
|
|
|
|
stub = GRPC::ClientStub.new(host, @cq, :this_channel_is_insecure) |
|
|
|
|
blk = proc { get_response(stub) } |
|
|
|
|
expect(&blk).to raise_error(GRPC::BadStatus) |
|
|
|
|
th.join |
|
|
|
@ -198,7 +201,7 @@ describe 'ClientStub' do |
|
|
|
|
server_port = create_test_server |
|
|
|
|
host = "localhost:#{server_port}" |
|
|
|
|
th = run_client_streamer(@sent_msgs, @resp, @pass) |
|
|
|
|
stub = GRPC::ClientStub.new(host, @cq) |
|
|
|
|
stub = GRPC::ClientStub.new(host, @cq, :this_channel_is_insecure) |
|
|
|
|
expect(get_response(stub)).to eq(@resp) |
|
|
|
|
th.join |
|
|
|
|
end |
|
|
|
@ -208,7 +211,7 @@ describe 'ClientStub' do |
|
|
|
|
host = "localhost:#{server_port}" |
|
|
|
|
th = run_client_streamer(@sent_msgs, @resp, @pass, |
|
|
|
|
k1: 'v1', k2: 'v2') |
|
|
|
|
stub = GRPC::ClientStub.new(host, @cq) |
|
|
|
|
stub = GRPC::ClientStub.new(host, @cq, :this_channel_is_insecure) |
|
|
|
|
expect(get_response(stub)).to eq(@resp) |
|
|
|
|
th.join |
|
|
|
|
end |
|
|
|
@ -217,7 +220,7 @@ describe 'ClientStub' do |
|
|
|
|
server_port = create_test_server |
|
|
|
|
host = "localhost:#{server_port}" |
|
|
|
|
th = run_client_streamer(@sent_msgs, @resp, @fail) |
|
|
|
|
stub = GRPC::ClientStub.new(host, @cq) |
|
|
|
|
stub = GRPC::ClientStub.new(host, @cq, :this_channel_is_insecure) |
|
|
|
|
blk = proc { get_response(stub) } |
|
|
|
|
expect(&blk).to raise_error(GRPC::BadStatus) |
|
|
|
|
th.join |
|
|
|
@ -256,7 +259,7 @@ describe 'ClientStub' do |
|
|
|
|
server_port = create_test_server |
|
|
|
|
host = "localhost:#{server_port}" |
|
|
|
|
th = run_server_streamer(@sent_msg, @replys, @pass) |
|
|
|
|
stub = GRPC::ClientStub.new(host, @cq) |
|
|
|
|
stub = GRPC::ClientStub.new(host, @cq, :this_channel_is_insecure) |
|
|
|
|
expect(get_responses(stub).collect { |r| r }).to eq(@replys) |
|
|
|
|
th.join |
|
|
|
|
end |
|
|
|
@ -265,7 +268,7 @@ describe 'ClientStub' do |
|
|
|
|
server_port = create_test_server |
|
|
|
|
host = "localhost:#{server_port}" |
|
|
|
|
th = run_server_streamer(@sent_msg, @replys, @fail) |
|
|
|
|
stub = GRPC::ClientStub.new(host, @cq) |
|
|
|
|
stub = GRPC::ClientStub.new(host, @cq, :this_channel_is_insecure) |
|
|
|
|
e = get_responses(stub) |
|
|
|
|
expect { e.collect { |r| r } }.to raise_error(GRPC::BadStatus) |
|
|
|
|
th.join |
|
|
|
@ -276,7 +279,7 @@ describe 'ClientStub' do |
|
|
|
|
host = "localhost:#{server_port}" |
|
|
|
|
th = run_server_streamer(@sent_msg, @replys, @fail, |
|
|
|
|
k1: 'v1', k2: 'v2') |
|
|
|
|
stub = GRPC::ClientStub.new(host, @cq) |
|
|
|
|
stub = GRPC::ClientStub.new(host, @cq, :this_channel_is_insecure) |
|
|
|
|
e = get_responses(stub) |
|
|
|
|
expect { e.collect { |r| r } }.to raise_error(GRPC::BadStatus) |
|
|
|
|
th.join |
|
|
|
@ -320,7 +323,7 @@ describe 'ClientStub' do |
|
|
|
|
it 'supports sending all the requests first', bidi: true do |
|
|
|
|
th = run_bidi_streamer_handle_inputs_first(@sent_msgs, @replys, |
|
|
|
|
@pass) |
|
|
|
|
stub = GRPC::ClientStub.new(@host, @cq) |
|
|
|
|
stub = GRPC::ClientStub.new(@host, @cq, :this_channel_is_insecure) |
|
|
|
|
e = get_responses(stub) |
|
|
|
|
expect(e.collect { |r| r }).to eq(@replys) |
|
|
|
|
th.join |
|
|
|
@ -328,7 +331,7 @@ describe 'ClientStub' do |
|
|
|
|
|
|
|
|
|
it 'supports client-initiated ping pong', bidi: true do |
|
|
|
|
th = run_bidi_streamer_echo_ping_pong(@sent_msgs, @pass, true) |
|
|
|
|
stub = GRPC::ClientStub.new(@host, @cq) |
|
|
|
|
stub = GRPC::ClientStub.new(@host, @cq, :this_channel_is_insecure) |
|
|
|
|
e = get_responses(stub) |
|
|
|
|
expect(e.collect { |r| r }).to eq(@sent_msgs) |
|
|
|
|
th.join |
|
|
|
@ -336,7 +339,7 @@ describe 'ClientStub' do |
|
|
|
|
|
|
|
|
|
it 'supports a server-initiated ping pong', bidi: true do |
|
|
|
|
th = run_bidi_streamer_echo_ping_pong(@sent_msgs, @pass, false) |
|
|
|
|
stub = GRPC::ClientStub.new(@host, @cq) |
|
|
|
|
stub = GRPC::ClientStub.new(@host, @cq, :this_channel_is_insecure) |
|
|
|
|
e = get_responses(stub) |
|
|
|
|
expect(e.collect { |r| r }).to eq(@sent_msgs) |
|
|
|
|
th.join |
|
|
|
@ -376,7 +379,7 @@ describe 'ClientStub' do |
|
|
|
|
|
|
|
|
|
it 'should fail with DeadlineExceeded', bidi: true do |
|
|
|
|
@server.start |
|
|
|
|
stub = GRPC::ClientStub.new(@host, @cq) |
|
|
|
|
stub = GRPC::ClientStub.new(@host, @cq, :this_channel_is_insecure) |
|
|
|
|
blk = proc do |
|
|
|
|
e = stub.bidi_streamer(@method, @sent_msgs, noop, noop, |
|
|
|
|
timeout: 0.001) |
|
|
|
|