Skip to content
Snippets Groups Projects
Commit d24424ff authored by murgatroid99's avatar murgatroid99
Browse files

Fixed stub construction in interop client

parent afe3974b
No related branches found
No related tags found
No related merge requests found
...@@ -114,8 +114,8 @@ end ...@@ -114,8 +114,8 @@ end
def create_stub(opts) def create_stub(opts)
address = "#{opts.host}:#{opts.port}" address = "#{opts.host}:#{opts.port}"
if opts.secure if opts.secure
creds = ssl_creds(opts.use_test_ca)
stub_opts = { stub_opts = {
:creds => ssl_creds(opts.use_test_ca),
GRPC::Core::Channel::SSL_TARGET => opts.host_override GRPC::Core::Channel::SSL_TARGET => opts.host_override
} }
...@@ -125,7 +125,7 @@ def create_stub(opts) ...@@ -125,7 +125,7 @@ def create_stub(opts)
unless opts.oauth_scope.nil? unless opts.oauth_scope.nil?
auth_creds = Google::Auth.get_application_default(opts.oauth_scope) auth_creds = Google::Auth.get_application_default(opts.oauth_scope)
call_creds = GRPC::Core::CallCredentials.new(auth_creds.updater_proc) call_creds = GRPC::Core::CallCredentials.new(auth_creds.updater_proc)
stub_opts[:creds] = stub_opts[:creds].compose call_creds creds = creds.compose call_creds
end end
end end
...@@ -135,20 +135,20 @@ def create_stub(opts) ...@@ -135,20 +135,20 @@ def create_stub(opts)
# use a metadata update proc that just adds the auth token. # use a metadata update proc that just adds the auth token.
call_creds = GRPC::Core::CallCredentials.new(proc { |md| md.merge(kw) }) call_creds = GRPC::Core::CallCredentials.new(proc { |md| md.merge(kw) })
stub_opts[:creds] = stub_opts[:creds].compose call_creds creds = creds.compose call_creds
end end
if opts.test_case == 'jwt_token_creds' # don't use a scope if opts.test_case == 'jwt_token_creds' # don't use a scope
auth_creds = Google::Auth.get_application_default auth_creds = Google::Auth.get_application_default
call_creds = GRPC::Core::CallCredentials.new(auth_creds.updater_proc) call_creds = GRPC::Core::CallCredentials.new(auth_creds.updater_proc)
stub_opts[:creds] = stub_opts[:creds].compose call_creds creds = creds.compose call_creds
end end
GRPC.logger.info("... connecting securely to #{address}") GRPC.logger.info("... connecting securely to #{address}")
Grpc::Testing::TestService::Stub.new(address, **stub_opts) Grpc::Testing::TestService::Stub.new(address, creds, **stub_opts)
else else
GRPC.logger.info("... connecting insecurely to #{address}") GRPC.logger.info("... connecting insecurely to #{address}")
Grpc::Testing::TestService::Stub.new(address) Grpc::Testing::TestService::Stub.new(address, :this_channel_is_insecure)
end end
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment