aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ruby/spec/client_server_spec.rb
diff options
context:
space:
mode:
authorGravatar Tim Emiola <temiola@google.com>2015-01-26 17:06:51 -0800
committerGravatar Tim Emiola <temiola@google.com>2015-01-26 17:06:51 -0800
commit0343b10817c96f58ce823ef19c394acff4602f7a (patch)
treebd9fb6e105035842e1c1f2dea4efabb7408664d0 /src/ruby/spec/client_server_spec.rb
parent6aa182fb2c0d518335b71c0fb5552342e2d2bee9 (diff)
Updates client_server_spec to use the server_port
Diffstat (limited to 'src/ruby/spec/client_server_spec.rb')
-rw-r--r--src/ruby/spec/client_server_spec.rb13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/ruby/spec/client_server_spec.rb b/src/ruby/spec/client_server_spec.rb
index b2afb0581e..c2517d649f 100644
--- a/src/ruby/spec/client_server_spec.rb
+++ b/src/ruby/spec/client_server_spec.rb
@@ -322,14 +322,13 @@ end
describe 'the http client/server' do
before(:example) do
- port = find_unused_tcp_port
- host = "localhost:#{port}"
+ server_host = 'localhost:0'
@client_queue = GRPC::Core::CompletionQueue.new
@server_queue = GRPC::Core::CompletionQueue.new
@server = GRPC::Core::Server.new(@server_queue, nil)
- @server.add_http2_port(host)
+ server_port = @server.add_http2_port(server_host)
@server.start
- @ch = Channel.new(host, nil)
+ @ch = Channel.new("localhost:#{server_port}", nil)
end
after(:example) do
@@ -347,15 +346,15 @@ describe 'the secure http client/server' do
before(:example) do
certs = load_test_certs
port = find_unused_tcp_port
- host = "localhost:#{port}"
+ server_host = 'localhost:0'
@client_queue = GRPC::Core::CompletionQueue.new
@server_queue = GRPC::Core::CompletionQueue.new
server_creds = GRPC::Core::ServerCredentials.new(nil, certs[1], certs[2])
@server = GRPC::Core::Server.new(@server_queue, nil, server_creds)
- @server.add_http2_port(host, true)
+ server_port = @server.add_http2_port(host, true)
@server.start
args = { Channel::SSL_TARGET => 'foo.test.google.com' }
- @ch = Channel.new(host, args,
+ @ch = Channel.new("localhost:#{server_port}", args,
GRPC::Core::Credentials.new(certs[0], nil, nil))
end