Ruby wrapping of core credentials API change.
diff --git a/src/ruby/bin/apis/pubsub_demo.rb b/src/ruby/bin/apis/pubsub_demo.rb
index a039d03..003e91a 100755
--- a/src/ruby/bin/apis/pubsub_demo.rb
+++ b/src/ruby/bin/apis/pubsub_demo.rb
@@ -66,7 +66,7 @@
# creates a SSL Credentials from the production certificates.
def ssl_creds
- GRPC::Core::Credentials.new(load_prod_cert)
+ GRPC::Core::ChannelCredentials.new(load_prod_cert)
end
# Builds the metadata authentication update proc.
diff --git a/src/ruby/bin/math_client.rb b/src/ruby/bin/math_client.rb
index 0ebd26f..d7e00e4 100755
--- a/src/ruby/bin/math_client.rb
+++ b/src/ruby/bin/math_client.rb
@@ -102,7 +102,7 @@
def test_creds
certs = load_test_certs
- GRPC::Core::Credentials.new(certs[0])
+ GRPC::Core::ChannelCredentials.new(certs[0])
end
def main
diff --git a/src/ruby/bin/noproto_client.rb b/src/ruby/bin/noproto_client.rb
index 390a9c5..3aa1187 100755
--- a/src/ruby/bin/noproto_client.rb
+++ b/src/ruby/bin/noproto_client.rb
@@ -68,7 +68,7 @@
def test_creds
certs = load_test_certs
- GRPC::Core::Credentials.new(certs[0])
+ GRPC::Core::ChannelCredentials.new(certs[0])
end
def main
diff --git a/src/ruby/lib/grpc/generic/client_stub.rb b/src/ruby/lib/grpc/generic/client_stub.rb
index b8e33ad..90aaa02 100644
--- a/src/ruby/lib/grpc/generic/client_stub.rb
+++ b/src/ruby/lib/grpc/generic/client_stub.rb
@@ -51,7 +51,9 @@
end
kw['grpc.primary_user_agent'] = "grpc-ruby/#{VERSION}"
return Core::Channel.new(host, kw) if creds.nil?
- fail(TypeError, '!Credentials') unless creds.is_a?(Core::Credentials)
+ unless creds.is_a?(Core::ChannelCredentials)
+ fail(TypeError, '!ChannelCredentials')
+ end
Core::Channel.new(host, kw, creds)
end
@@ -106,7 +108,7 @@
# @param q [Core::CompletionQueue] used to wait for events
# @param channel_override [Core::Channel] a pre-created channel
# @param timeout [Number] the default timeout to use in requests
- # @param creds [Core::Credentials] the channel
+ # @param creds [Core::ChannelCredentials] the channel credentials
# @param update_metadata a func that updates metadata as described above
# @param kw [KeywordArgs]the channel arguments
def initialize(host, q,
diff --git a/src/ruby/pb/test/client.rb b/src/ruby/pb/test/client.rb
index 164e304..800529f 100755
--- a/src/ruby/pb/test/client.rb
+++ b/src/ruby/pb/test/client.rb
@@ -86,13 +86,13 @@
# creates SSL Credentials from the test certificates.
def test_creds
certs = load_test_certs
- GRPC::Core::Credentials.new(certs[0])
+ GRPC::Core::ChannelCredentials.new(certs[0])
end
# creates SSL Credentials from the production certificates.
def prod_creds
cert_text = load_prod_cert
- GRPC::Core::Credentials.new(cert_text)
+ GRPC::Core::ChannelCredentials.new(cert_text)
end
# creates the SSL Credentials.
diff --git a/src/ruby/spec/credentials_spec.rb b/src/ruby/spec/channel_credentials_spec.rb
similarity index 78%
rename from src/ruby/spec/credentials_spec.rb
rename to src/ruby/spec/channel_credentials_spec.rb
index b02219d..b2bdf70 100644
--- a/src/ruby/spec/credentials_spec.rb
+++ b/src/ruby/spec/channel_credentials_spec.rb
@@ -29,8 +29,8 @@
require 'grpc'
-describe GRPC::Core::Credentials do
- Credentials = GRPC::Core::Credentials
+describe GRPC::Core::ChannelCredentials do
+ ChannelCredentials = GRPC::Core::ChannelCredentials
def load_test_certs
test_root = File.join(File.dirname(__FILE__), 'testdata')
@@ -40,32 +40,24 @@
describe '#new' do
it 'can be constructed with fake inputs' do
- expect { Credentials.new('root_certs', 'key', 'cert') }.not_to raise_error
+ blk = proc { ChannelCredentials.new('root_certs', 'key', 'cert') }
+ expect(&blk).not_to raise_error
end
it 'it can be constructed using specific test certificates' do
certs = load_test_certs
- expect { Credentials.new(*certs) }.not_to raise_error
+ expect { ChannelCredentials.new(*certs) }.not_to raise_error
end
it 'can be constructed with server roots certs only' do
root_cert, _, _ = load_test_certs
- expect { Credentials.new(root_cert) }.not_to raise_error
+ expect { ChannelCredentials.new(root_cert) }.not_to raise_error
end
it 'cannot be constructed with a nil server roots' do
_, client_key, client_chain = load_test_certs
- blk = proc { Credentials.new(nil, client_key, client_chain) }
+ blk = proc { ChannelCredentials.new(nil, client_key, client_chain) }
expect(&blk).to raise_error
end
end
-
- describe '#compose' do
- it 'cannot be completed OK with 2 SSL creds' do
- certs = load_test_certs
- cred1 = Credentials.new(*certs)
- cred2 = Credentials.new(*certs)
- expect { cred1.compose(cred2) }.to raise_error
- end
- end
end
diff --git a/src/ruby/spec/channel_spec.rb b/src/ruby/spec/channel_spec.rb
index 25cefcd..b4d2b94 100644
--- a/src/ruby/spec/channel_spec.rb
+++ b/src/ruby/spec/channel_spec.rb
@@ -40,7 +40,7 @@
let(:cq) { GRPC::Core::CompletionQueue.new }
def create_test_cert
- GRPC::Core::Credentials.new(load_test_certs[0])
+ GRPC::Core::ChannelCredentials.new(load_test_certs[0])
end
shared_examples '#new' do
diff --git a/src/ruby/spec/client_server_spec.rb b/src/ruby/spec/client_server_spec.rb
index ad0fb26..734f176 100644
--- a/src/ruby/spec/client_server_spec.rb
+++ b/src/ruby/spec/client_server_spec.rb
@@ -431,7 +431,7 @@
@server.start
args = { Channel::SSL_TARGET => 'foo.test.google.fr' }
@ch = Channel.new("0.0.0.0:#{server_port}", args,
- GRPC::Core::Credentials.new(certs[0], nil, nil))
+ GRPC::Core::ChannelCredentials.new(certs[0], nil, nil))
end
after(:example) do
diff --git a/src/ruby/spec/generic/client_stub_spec.rb b/src/ruby/spec/generic/client_stub_spec.rb
index c5173ae..da5bc6c 100644
--- a/src/ruby/spec/generic/client_stub_spec.rb
+++ b/src/ruby/spec/generic/client_stub_spec.rb
@@ -113,7 +113,7 @@
opts = {
GRPC::Core::Channel::SSL_TARGET => 'foo.test.google.fr',
a_channel_arg: 'an_arg',
- creds: GRPC::Core::Credentials.new(certs[0], nil, nil)
+ creds: GRPC::Core::ChannelCredentials.new(certs[0], nil, nil)
}
GRPC::ClientStub.new(fake_host, @cq, **opts)
end