Merge pull request #7 from tbetbetbe/core_creds_api_change

Core creds api change
reviewable/pr3765/r1
jboeuf 9 years ago
commit 29c2a9e9b5
  1. 2
      src/ruby/bin/apis/pubsub_demo.rb
  2. 2
      src/ruby/bin/math_client.rb
  3. 2
      src/ruby/bin/noproto_client.rb
  4. 6
      src/ruby/ext/grpc/rb_channel.c
  5. 177
      src/ruby/ext/grpc/rb_channel_credentials.c
  6. 6
      src/ruby/ext/grpc/rb_channel_credentials.h
  7. 4
      src/ruby/ext/grpc/rb_grpc.c
  8. 6
      src/ruby/lib/grpc/generic/client_stub.rb
  9. 4
      src/ruby/pb/test/client.rb
  10. 22
      src/ruby/spec/channel_credentials_spec.rb
  11. 2
      src/ruby/spec/channel_spec.rb
  12. 2
      src/ruby/spec/client_server_spec.rb
  13. 2
      src/ruby/spec/generic/client_stub_spec.rb

@ -66,7 +66,7 @@ end
# creates a SSL Credentials from the production certificates. # creates a SSL Credentials from the production certificates.
def ssl_creds def ssl_creds
GRPC::Core::Credentials.new(load_prod_cert) GRPC::Core::ChannelCredentials.new(load_prod_cert)
end end
# Builds the metadata authentication update proc. # Builds the metadata authentication update proc.

@ -102,7 +102,7 @@ end
def test_creds def test_creds
certs = load_test_certs certs = load_test_certs
GRPC::Core::Credentials.new(certs[0]) GRPC::Core::ChannelCredentials.new(certs[0])
end end
def main def main

@ -68,7 +68,7 @@ end
def test_creds def test_creds
certs = load_test_certs certs = load_test_certs
GRPC::Core::Credentials.new(certs[0]) GRPC::Core::ChannelCredentials.new(certs[0])
end end
def main def main

@ -41,8 +41,8 @@
#include "rb_grpc.h" #include "rb_grpc.h"
#include "rb_call.h" #include "rb_call.h"
#include "rb_channel_args.h" #include "rb_channel_args.h"
#include "rb_channel_credentials.h"
#include "rb_completion_queue.h" #include "rb_completion_queue.h"
#include "rb_credentials.h"
#include "rb_server.h" #include "rb_server.h"
/* id_channel is the name of the hidden ivar that preserves a reference to the /* id_channel is the name of the hidden ivar that preserves a reference to the
@ -134,8 +134,8 @@ static VALUE grpc_rb_channel_init(int argc, VALUE *argv, VALUE self) {
VALUE credentials = Qnil; VALUE credentials = Qnil;
VALUE target = Qnil; VALUE target = Qnil;
grpc_rb_channel *wrapper = NULL; grpc_rb_channel *wrapper = NULL;
grpc_credentials *creds = NULL;
grpc_channel *ch = NULL; grpc_channel *ch = NULL;
grpc_channel_credentials *creds = NULL;
char *target_chars = NULL; char *target_chars = NULL;
grpc_channel_args args; grpc_channel_args args;
MEMZERO(&args, grpc_channel_args, 1); MEMZERO(&args, grpc_channel_args, 1);
@ -149,7 +149,7 @@ static VALUE grpc_rb_channel_init(int argc, VALUE *argv, VALUE self) {
if (credentials == Qnil) { if (credentials == Qnil) {
ch = grpc_insecure_channel_create(target_chars, &args, NULL); ch = grpc_insecure_channel_create(target_chars, &args, NULL);
} else { } else {
creds = grpc_rb_get_wrapped_credentials(credentials); creds = grpc_rb_get_wrapped_channel_credentials(credentials);
ch = grpc_secure_channel_create(creds, target_chars, &args, NULL); ch = grpc_secure_channel_create(creds, target_chars, &args, NULL);
} }
if (args.args != NULL) { if (args.args != NULL) {

@ -31,7 +31,7 @@
* *
*/ */
#include "rb_credentials.h" #include "rb_channel_credentials.h"
#include <ruby/ruby.h> #include <ruby/ruby.h>
@ -40,32 +40,33 @@
#include "rb_grpc.h" #include "rb_grpc.h"
/* grpc_rb_cCredentials is the ruby class that proxies grpc_credentials. */ /* grpc_rb_cChannelCredentials is the ruby class that proxies
static VALUE grpc_rb_cCredentials = Qnil; grpc_channel_credentials. */
static VALUE grpc_rb_cChannelCredentials = Qnil;
/* grpc_rb_credentials wraps a grpc_credentials. It provides a /* grpc_rb_channel_credentials wraps a grpc_channel_credentials. It provides a
* peer ruby object, 'mark' to minimize copying when a credential is * peer ruby object, 'mark' to minimize copying when a credential is
* created from ruby. */ * created from ruby. */
typedef struct grpc_rb_credentials { typedef struct grpc_rb_channel_credentials {
/* Holder of ruby objects involved in constructing the credentials */ /* Holder of ruby objects involved in constructing the credentials */
VALUE mark; VALUE mark;
/* The actual credentials */ /* The actual credentials */
grpc_credentials *wrapped; grpc_channel_credentials *wrapped;
} grpc_rb_credentials; } grpc_rb_channel_credentials;
/* Destroys the credentials instances. */ /* Destroys the credentials instances. */
static void grpc_rb_credentials_free(void *p) { static void grpc_rb_channel_credentials_free(void *p) {
grpc_rb_credentials *wrapper = NULL; grpc_rb_channel_credentials *wrapper = NULL;
if (p == NULL) { if (p == NULL) {
return; return;
}; };
wrapper = (grpc_rb_credentials *)p; wrapper = (grpc_rb_channel_credentials *)p;
/* Delete the wrapped object if the mark object is Qnil, which indicates that /* Delete the wrapped object if the mark object is Qnil, which indicates that
* no other object is the actual owner. */ * no other object is the actual owner. */
if (wrapper->wrapped != NULL && wrapper->mark == Qnil) { if (wrapper->wrapped != NULL && wrapper->mark == Qnil) {
grpc_credentials_release(wrapper->wrapped); grpc_channel_credentials_release(wrapper->wrapped);
wrapper->wrapped = NULL; wrapper->wrapped = NULL;
} }
@ -73,12 +74,12 @@ static void grpc_rb_credentials_free(void *p) {
} }
/* Protects the mark object from GC */ /* Protects the mark object from GC */
static void grpc_rb_credentials_mark(void *p) { static void grpc_rb_channel_credentials_mark(void *p) {
grpc_rb_credentials *wrapper = NULL; grpc_rb_channel_credentials *wrapper = NULL;
if (p == NULL) { if (p == NULL) {
return; return;
} }
wrapper = (grpc_rb_credentials *)p; wrapper = (grpc_rb_channel_credentials *)p;
/* If it's not already cleaned up, mark the mark object */ /* If it's not already cleaned up, mark the mark object */
if (wrapper->mark != Qnil) { if (wrapper->mark != Qnil) {
@ -86,29 +87,29 @@ static void grpc_rb_credentials_mark(void *p) {
} }
} }
static rb_data_type_t grpc_rb_credentials_data_type = { static rb_data_type_t grpc_rb_channel_credentials_data_type = {
"grpc_credentials", "grpc_channel_credentials",
{grpc_rb_credentials_mark, grpc_rb_credentials_free, {grpc_rb_channel_credentials_mark, grpc_rb_channel_credentials_free,
GRPC_RB_MEMSIZE_UNAVAILABLE, {NULL, NULL}}, GRPC_RB_MEMSIZE_UNAVAILABLE, {NULL, NULL}},
NULL, NULL,
NULL, NULL,
RUBY_TYPED_FREE_IMMEDIATELY}; RUBY_TYPED_FREE_IMMEDIATELY};
/* Allocates Credential instances. /* Allocates ChannelCredential instances.
Provides safe initial defaults for the instance fields. */ Provides safe initial defaults for the instance fields. */
static VALUE grpc_rb_credentials_alloc(VALUE cls) { static VALUE grpc_rb_channel_credentials_alloc(VALUE cls) {
grpc_rb_credentials *wrapper = ALLOC(grpc_rb_credentials); grpc_rb_channel_credentials *wrapper = ALLOC(grpc_rb_channel_credentials);
wrapper->wrapped = NULL; wrapper->wrapped = NULL;
wrapper->mark = Qnil; wrapper->mark = Qnil;
return TypedData_Wrap_Struct(cls, &grpc_rb_credentials_data_type, wrapper); return TypedData_Wrap_Struct(cls, &grpc_rb_channel_credentials_data_type, wrapper);
} }
/* Clones Credentials instances. /* Clones ChannelCredentials instances.
Gives Credentials a consistent implementation of Ruby's object copy/dup Gives ChannelCredentials a consistent implementation of Ruby's object copy/dup
protocol. */ protocol. */
static VALUE grpc_rb_credentials_init_copy(VALUE copy, VALUE orig) { static VALUE grpc_rb_channel_credentials_init_copy(VALUE copy, VALUE orig) {
grpc_rb_credentials *orig_cred = NULL; grpc_rb_channel_credentials *orig_cred = NULL;
grpc_rb_credentials *copy_cred = NULL; grpc_rb_channel_credentials *copy_cred = NULL;
if (copy == orig) { if (copy == orig) {
return copy; return copy;
@ -116,83 +117,22 @@ static VALUE grpc_rb_credentials_init_copy(VALUE copy, VALUE orig) {
/* Raise an error if orig is not a credentials object or a subclass. */ /* Raise an error if orig is not a credentials object or a subclass. */
if (TYPE(orig) != T_DATA || if (TYPE(orig) != T_DATA ||
RDATA(orig)->dfree != (RUBY_DATA_FUNC)grpc_rb_credentials_free) { RDATA(orig)->dfree != (RUBY_DATA_FUNC)grpc_rb_channel_credentials_free) {
rb_raise(rb_eTypeError, "not a %s", rb_obj_classname(grpc_rb_cCredentials)); rb_raise(rb_eTypeError, "not a %s",
rb_obj_classname(grpc_rb_cChannelCredentials));
} }
TypedData_Get_Struct(orig, grpc_rb_credentials, TypedData_Get_Struct(orig, grpc_rb_channel_credentials,
&grpc_rb_credentials_data_type, orig_cred); &grpc_rb_channel_credentials_data_type, orig_cred);
TypedData_Get_Struct(copy, grpc_rb_credentials, TypedData_Get_Struct(copy, grpc_rb_channel_credentials,
&grpc_rb_credentials_data_type, copy_cred); &grpc_rb_channel_credentials_data_type, copy_cred);
/* use ruby's MEMCPY to make a byte-for-byte copy of the credentials /* use ruby's MEMCPY to make a byte-for-byte copy of the credentials
* wrapper object. */ * wrapper object. */
MEMCPY(copy_cred, orig_cred, grpc_rb_credentials, 1); MEMCPY(copy_cred, orig_cred, grpc_rb_channel_credentials, 1);
return copy; return copy;
} }
/*
call-seq:
creds = Credentials.default()
Creates the default credential instances. */
static VALUE grpc_rb_default_credentials_create(VALUE cls) {
grpc_rb_credentials *wrapper = ALLOC(grpc_rb_credentials);
wrapper->wrapped = grpc_google_default_credentials_create();
if (wrapper->wrapped == NULL) {
rb_raise(rb_eRuntimeError,
"could not create default credentials, not sure why");
return Qnil;
}
wrapper->mark = Qnil;
return TypedData_Wrap_Struct(cls, &grpc_rb_credentials_data_type, wrapper);
}
/*
call-seq:
creds = Credentials.compute_engine()
Creates the default credential instances. */
static VALUE grpc_rb_compute_engine_credentials_create(VALUE cls) {
grpc_rb_credentials *wrapper = ALLOC(grpc_rb_credentials);
wrapper->wrapped = grpc_google_compute_engine_credentials_create(NULL);
if (wrapper->wrapped == NULL) {
rb_raise(rb_eRuntimeError,
"could not create composite engine credentials, not sure why");
return Qnil;
}
wrapper->mark = Qnil;
return TypedData_Wrap_Struct(cls, &grpc_rb_credentials_data_type, wrapper);
}
/*
call-seq:
creds1 = ...
creds2 = ...
creds3 = creds1.add(creds2)
Creates the default credential instances. */
static VALUE grpc_rb_composite_credentials_create(VALUE self, VALUE other) {
grpc_rb_credentials *self_wrapper = NULL;
grpc_rb_credentials *other_wrapper = NULL;
grpc_rb_credentials *wrapper = NULL;
TypedData_Get_Struct(self, grpc_rb_credentials,
&grpc_rb_credentials_data_type, self_wrapper);
TypedData_Get_Struct(other, grpc_rb_credentials,
&grpc_rb_credentials_data_type, other_wrapper);
wrapper = ALLOC(grpc_rb_credentials);
wrapper->wrapped = grpc_composite_credentials_create(
self_wrapper->wrapped, other_wrapper->wrapped, NULL);
if (wrapper->wrapped == NULL) {
rb_raise(rb_eRuntimeError,
"could not create composite credentials, not sure why");
return Qnil;
}
wrapper->mark = Qnil;
return TypedData_Wrap_Struct(grpc_rb_cCredentials,
&grpc_rb_credentials_data_type, wrapper);
}
/* The attribute used on the mark object to hold the pem_root_certs. */ /* The attribute used on the mark object to hold the pem_root_certs. */
static ID id_pem_root_certs; static ID id_pem_root_certs;
@ -213,12 +153,12 @@ static ID id_pem_cert_chain;
pem_private_key: (optional) PEM encoding of the client's private key pem_private_key: (optional) PEM encoding of the client's private key
pem_cert_chain: (optional) PEM encoding of the client's cert chain pem_cert_chain: (optional) PEM encoding of the client's cert chain
Initializes Credential instances. */ Initializes Credential instances. */
static VALUE grpc_rb_credentials_init(int argc, VALUE *argv, VALUE self) { static VALUE grpc_rb_channel_credentials_init(int argc, VALUE *argv, VALUE self) {
VALUE pem_root_certs = Qnil; VALUE pem_root_certs = Qnil;
VALUE pem_private_key = Qnil; VALUE pem_private_key = Qnil;
VALUE pem_cert_chain = Qnil; VALUE pem_cert_chain = Qnil;
grpc_rb_credentials *wrapper = NULL; grpc_rb_channel_credentials *wrapper = NULL;
grpc_credentials *creds = NULL; grpc_channel_credentials *creds = NULL;
grpc_ssl_pem_key_cert_pair key_cert_pair; grpc_ssl_pem_key_cert_pair key_cert_pair;
MEMZERO(&key_cert_pair, grpc_ssl_pem_key_cert_pair, 1); MEMZERO(&key_cert_pair, grpc_ssl_pem_key_cert_pair, 1);
/* TODO: Remove mandatory arg when we support default roots. */ /* TODO: Remove mandatory arg when we support default roots. */
@ -226,8 +166,8 @@ static VALUE grpc_rb_credentials_init(int argc, VALUE *argv, VALUE self) {
rb_scan_args(argc, argv, "12", &pem_root_certs, &pem_private_key, rb_scan_args(argc, argv, "12", &pem_root_certs, &pem_private_key,
&pem_cert_chain); &pem_cert_chain);
TypedData_Get_Struct(self, grpc_rb_credentials, TypedData_Get_Struct(self, grpc_rb_channel_credentials,
&grpc_rb_credentials_data_type, wrapper); &grpc_rb_channel_credentials_data_type, wrapper);
if (pem_root_certs == Qnil) { if (pem_root_certs == Qnil) {
rb_raise(rb_eRuntimeError, rb_raise(rb_eRuntimeError,
"could not create a credential: nil pem_root_certs"); "could not create a credential: nil pem_root_certs");
@ -256,39 +196,30 @@ static VALUE grpc_rb_credentials_init(int argc, VALUE *argv, VALUE self) {
return self; return self;
} }
void Init_grpc_credentials() { void Init_grpc_channel_credentials() {
grpc_rb_cCredentials = grpc_rb_cChannelCredentials =
rb_define_class_under(grpc_rb_mGrpcCore, "Credentials", rb_cObject); rb_define_class_under(grpc_rb_mGrpcCore, "ChannelCredentials", rb_cObject);
/* Allocates an object managed by the ruby runtime */ /* Allocates an object managed by the ruby runtime */
rb_define_alloc_func(grpc_rb_cCredentials, grpc_rb_credentials_alloc); rb_define_alloc_func(grpc_rb_cChannelCredentials,
grpc_rb_channel_credentials_alloc);
/* Provides a ruby constructor and support for dup/clone. */ /* Provides a ruby constructor and support for dup/clone. */
rb_define_method(grpc_rb_cCredentials, "initialize", grpc_rb_credentials_init, rb_define_method(grpc_rb_cChannelCredentials, "initialize",
-1); grpc_rb_channel_credentials_init, -1);
rb_define_method(grpc_rb_cCredentials, "initialize_copy", rb_define_method(grpc_rb_cChannelCredentials, "initialize_copy",
grpc_rb_credentials_init_copy, 1); grpc_rb_channel_credentials_init_copy, 1);
/* Provide static funcs that create new special instances. */
rb_define_singleton_method(grpc_rb_cCredentials, "default",
grpc_rb_default_credentials_create, 0);
rb_define_singleton_method(grpc_rb_cCredentials, "compute_engine",
grpc_rb_compute_engine_credentials_create, 0);
/* Provide other methods. */
rb_define_method(grpc_rb_cCredentials, "compose",
grpc_rb_composite_credentials_create, 1);
id_pem_cert_chain = rb_intern("__pem_cert_chain"); id_pem_cert_chain = rb_intern("__pem_cert_chain");
id_pem_private_key = rb_intern("__pem_private_key"); id_pem_private_key = rb_intern("__pem_private_key");
id_pem_root_certs = rb_intern("__pem_root_certs"); id_pem_root_certs = rb_intern("__pem_root_certs");
} }
/* Gets the wrapped grpc_credentials from the ruby wrapper */ /* Gets the wrapped grpc_channel_credentials from the ruby wrapper */
grpc_credentials *grpc_rb_get_wrapped_credentials(VALUE v) { grpc_channel_credentials *grpc_rb_get_wrapped_channel_credentials(VALUE v) {
grpc_rb_credentials *wrapper = NULL; grpc_rb_channel_credentials *wrapper = NULL;
TypedData_Get_Struct(v, grpc_rb_credentials, &grpc_rb_credentials_data_type, TypedData_Get_Struct(v, grpc_rb_channel_credentials,
&grpc_rb_channel_credentials_data_type,
wrapper); wrapper);
return wrapper->wrapped; return wrapper->wrapped;
} }

@ -38,10 +38,10 @@
#include <grpc/grpc_security.h> #include <grpc/grpc_security.h>
/* Initializes the ruby Credentials class. */ /* Initializes the ruby ChannelCredentials class. */
void Init_grpc_credentials(); void Init_grpc_channel_credentials();
/* Gets the wrapped credentials from the ruby wrapper */ /* Gets the wrapped credentials from the ruby wrapper */
grpc_credentials* grpc_rb_get_wrapped_credentials(VALUE v); grpc_channel_credentials* grpc_rb_get_wrapped_channel_credentials(VALUE v);
#endif /* GRPC_RB_CREDENTIALS_H_ */ #endif /* GRPC_RB_CREDENTIALS_H_ */

@ -42,9 +42,9 @@
#include <grpc/support/time.h> #include <grpc/support/time.h>
#include "rb_call.h" #include "rb_call.h"
#include "rb_channel.h" #include "rb_channel.h"
#include "rb_channel_credentials.h"
#include "rb_completion_queue.h" #include "rb_completion_queue.h"
#include "rb_server.h" #include "rb_server.h"
#include "rb_credentials.h"
#include "rb_server_credentials.h" #include "rb_server_credentials.h"
static VALUE grpc_rb_cTimeVal = Qnil; static VALUE grpc_rb_cTimeVal = Qnil;
@ -300,7 +300,7 @@ void Init_grpc() {
Init_grpc_channel(); Init_grpc_channel();
Init_grpc_completion_queue(); Init_grpc_completion_queue();
Init_grpc_call(); Init_grpc_call();
Init_grpc_credentials(); Init_grpc_channel_credentials();
Init_grpc_server(); Init_grpc_server();
Init_grpc_server_credentials(); Init_grpc_server_credentials();
Init_grpc_status_codes(); Init_grpc_status_codes();

@ -51,7 +51,9 @@ module GRPC
end end
kw['grpc.primary_user_agent'] = "grpc-ruby/#{VERSION}" kw['grpc.primary_user_agent'] = "grpc-ruby/#{VERSION}"
return Core::Channel.new(host, kw) if creds.nil? 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) Core::Channel.new(host, kw, creds)
end end
@ -106,7 +108,7 @@ module GRPC
# @param q [Core::CompletionQueue] used to wait for events # @param q [Core::CompletionQueue] used to wait for events
# @param channel_override [Core::Channel] a pre-created channel # @param channel_override [Core::Channel] a pre-created channel
# @param timeout [Number] the default timeout to use in requests # @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 update_metadata a func that updates metadata as described above
# @param kw [KeywordArgs]the channel arguments # @param kw [KeywordArgs]the channel arguments
def initialize(host, q, def initialize(host, q,

@ -86,13 +86,13 @@ end
# creates SSL Credentials from the test certificates. # creates SSL Credentials from the test certificates.
def test_creds def test_creds
certs = load_test_certs certs = load_test_certs
GRPC::Core::Credentials.new(certs[0]) GRPC::Core::ChannelCredentials.new(certs[0])
end end
# creates SSL Credentials from the production certificates. # creates SSL Credentials from the production certificates.
def prod_creds def prod_creds
cert_text = load_prod_cert cert_text = load_prod_cert
GRPC::Core::Credentials.new(cert_text) GRPC::Core::ChannelCredentials.new(cert_text)
end end
# creates the SSL Credentials. # creates the SSL Credentials.

@ -29,8 +29,8 @@
require 'grpc' require 'grpc'
describe GRPC::Core::Credentials do describe GRPC::Core::ChannelCredentials do
Credentials = GRPC::Core::Credentials ChannelCredentials = GRPC::Core::ChannelCredentials
def load_test_certs def load_test_certs
test_root = File.join(File.dirname(__FILE__), 'testdata') test_root = File.join(File.dirname(__FILE__), 'testdata')
@ -40,32 +40,24 @@ describe GRPC::Core::Credentials do
describe '#new' do describe '#new' do
it 'can be constructed with fake inputs' 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 end
it 'it can be constructed using specific test certificates' do it 'it can be constructed using specific test certificates' do
certs = load_test_certs certs = load_test_certs
expect { Credentials.new(*certs) }.not_to raise_error expect { ChannelCredentials.new(*certs) }.not_to raise_error
end end
it 'can be constructed with server roots certs only' do it 'can be constructed with server roots certs only' do
root_cert, _, _ = load_test_certs root_cert, _, _ = load_test_certs
expect { Credentials.new(root_cert) }.not_to raise_error expect { ChannelCredentials.new(root_cert) }.not_to raise_error
end end
it 'cannot be constructed with a nil server roots' do it 'cannot be constructed with a nil server roots' do
_, client_key, client_chain = load_test_certs _, 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 expect(&blk).to raise_error
end end
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 end

@ -40,7 +40,7 @@ describe GRPC::Core::Channel do
let(:cq) { GRPC::Core::CompletionQueue.new } let(:cq) { GRPC::Core::CompletionQueue.new }
def create_test_cert def create_test_cert
GRPC::Core::Credentials.new(load_test_certs[0]) GRPC::Core::ChannelCredentials.new(load_test_certs[0])
end end
shared_examples '#new' do shared_examples '#new' do

@ -431,7 +431,7 @@ describe 'the secure http client/server' do
@server.start @server.start
args = { Channel::SSL_TARGET => 'foo.test.google.fr' } args = { Channel::SSL_TARGET => 'foo.test.google.fr' }
@ch = Channel.new("0.0.0.0:#{server_port}", args, @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 end
after(:example) do after(:example) do

@ -113,7 +113,7 @@ describe 'ClientStub' do
opts = { opts = {
GRPC::Core::Channel::SSL_TARGET => 'foo.test.google.fr', GRPC::Core::Channel::SSL_TARGET => 'foo.test.google.fr',
a_channel_arg: 'an_arg', 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) GRPC::ClientStub.new(fake_host, @cq, **opts)
end end

Loading…
Cancel
Save