Merge branch 'master' of github.com:grpc/grpc

pull/2728/head
murgatroid99 10 years ago
commit 0814371985
  1. 3
      include/grpc++/server_context.h
  2. 5
      src/cpp/server/server_context.cc
  3. 3
      src/node/examples/perf_test.js
  4. 3
      src/node/examples/qps_test.js
  5. 3
      src/node/examples/route_guide_client.js
  6. 3
      src/node/examples/stock_client.js
  7. 52
      src/node/ext/channel.cc
  8. 47
      src/node/ext/credentials.cc
  9. 1
      src/node/ext/credentials.h
  10. 8
      src/node/interop/interop_client.js
  11. 6
      src/node/src/client.js
  12. 6
      src/node/test/call_test.js
  13. 33
      src/node/test/channel_test.js
  14. 4
      src/node/test/end_to_end_test.js
  15. 3
      src/node/test/health_test.js
  16. 3
      src/node/test/math_client_test.js
  17. 14
      src/node/test/surface_test.js
  18. 2
      test/core/security/oauth2_utils.c
  19. 4
      test/cpp/qps/qps_test.cc
  20. 3
      tools/run_tests/run_interops_build.sh

@ -46,6 +46,7 @@
struct gpr_timespec; struct gpr_timespec;
struct grpc_metadata; struct grpc_metadata;
struct grpc_call; struct grpc_call;
struct census_context;
namespace grpc { namespace grpc {
@ -116,6 +117,8 @@ class ServerContext {
std::shared_ptr<const AuthContext> auth_context() const; std::shared_ptr<const AuthContext> auth_context() const;
const struct census_context* census_context() const;
private: private:
friend class ::grpc::testing::InteropContextInspector; friend class ::grpc::testing::InteropContextInspector;
friend class ::grpc::Server; friend class ::grpc::Server;

@ -39,6 +39,7 @@
#include <grpc++/impl/sync.h> #include <grpc++/impl/sync.h>
#include <grpc++/time.h> #include <grpc++/time.h>
#include "src/core/census/grpc_context.h"
#include "src/core/channel/compress_filter.h" #include "src/core/channel/compress_filter.h"
#include "src/cpp/common/create_auth_context.h" #include "src/cpp/common/create_auth_context.h"
@ -179,4 +180,8 @@ std::shared_ptr<const AuthContext> ServerContext::auth_context() const {
return auth_context_; return auth_context_;
} }
const struct census_context* ServerContext::census_context() const {
return grpc_census_call_get_context(call_);
}
} // namespace grpc } // namespace grpc

@ -41,7 +41,8 @@ var interop_server = require('../interop/interop_server.js');
function runTest(iterations, callback) { function runTest(iterations, callback) {
var testServer = interop_server.getServer(0, false); var testServer = interop_server.getServer(0, false);
testServer.server.listen(); testServer.server.listen();
var client = new testProto.TestService('localhost:' + testServer.port); var client = new testProto.TestService('localhost:' + testServer.port,
grpc.Credentials.createInsecure());
function runIterations(finish) { function runIterations(finish) {
var start = process.hrtime(); var start = process.hrtime();

@ -61,7 +61,8 @@ var interop_server = require('../interop/interop_server.js');
function runTest(concurrent_calls, seconds, callback) { function runTest(concurrent_calls, seconds, callback) {
var testServer = interop_server.getServer(0, false); var testServer = interop_server.getServer(0, false);
testServer.server.listen(); testServer.server.listen();
var client = new testProto.TestService('localhost:' + testServer.port); var client = new testProto.TestService('localhost:' + testServer.port,
grpc.Credentials.createInsecure());
var warmup_num = 100; var warmup_num = 100;

@ -40,7 +40,8 @@ var path = require('path');
var _ = require('lodash'); var _ = require('lodash');
var grpc = require('..'); var grpc = require('..');
var examples = grpc.load(__dirname + '/route_guide.proto').examples; var examples = grpc.load(__dirname + '/route_guide.proto').examples;
var client = new examples.RouteGuide('localhost:50051'); var client = new examples.RouteGuide('localhost:50051',
grpc.Credentials.createInsecure());
var COORD_FACTOR = 1e7; var COORD_FACTOR = 1e7;

@ -38,7 +38,8 @@ var examples = grpc.load(__dirname + '/stock.proto').examples;
* This exports a client constructor for the Stock service. The usage looks like * This exports a client constructor for the Stock service. The usage looks like
* *
* var StockClient = require('stock_client.js'); * var StockClient = require('stock_client.js');
* var stockClient = new StockClient(server_address); * var stockClient = new StockClient(server_address,
* grpc.Credentials.createInsecure());
* stockClient.getLastTradePrice({symbol: 'GOOG'}, function(error, response) { * stockClient.getLastTradePrice({symbol: 'GOOG'}, function(error, response) {
* console.log(error || response); * console.log(error || response);
* }); * });

@ -98,31 +98,30 @@ NAN_METHOD(Channel::New) {
if (args.IsConstructCall()) { if (args.IsConstructCall()) {
if (!args[0]->IsString()) { if (!args[0]->IsString()) {
return NanThrowTypeError("Channel expects a string and an object"); return NanThrowTypeError(
"Channel expects a string, a credential and an object");
} }
grpc_channel *wrapped_channel; grpc_channel *wrapped_channel;
// Owned by the Channel object // Owned by the Channel object
NanUtf8String *host = new NanUtf8String(args[0]); NanUtf8String *host = new NanUtf8String(args[0]);
NanUtf8String *host_override = NULL; NanUtf8String *host_override = NULL;
if (args[1]->IsUndefined()) { grpc_credentials *creds;
if (!Credentials::HasInstance(args[1])) {
return NanThrowTypeError(
"Channel's second argument must be a credential");
}
Credentials *creds_object = ObjectWrap::Unwrap<Credentials>(
args[1]->ToObject());
creds = creds_object->GetWrappedCredentials();
grpc_channel_args *channel_args_ptr;
if (args[2]->IsUndefined()) {
channel_args_ptr = NULL;
wrapped_channel = grpc_insecure_channel_create(**host, NULL); wrapped_channel = grpc_insecure_channel_create(**host, NULL);
} else if (args[1]->IsObject()) { } else if (args[2]->IsObject()) {
grpc_credentials *creds = NULL; Handle<Object> args_hash(args[2]->ToObject()->Clone());
Handle<Object> args_hash(args[1]->ToObject()->Clone());
if (args_hash->HasOwnProperty(NanNew(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG))) { if (args_hash->HasOwnProperty(NanNew(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG))) {
host_override = new NanUtf8String(args_hash->Get(NanNew(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG))); host_override = new NanUtf8String(args_hash->Get(NanNew(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG)));
} }
if (args_hash->HasOwnProperty(NanNew("credentials"))) {
Handle<Value> creds_value = args_hash->Get(NanNew("credentials"));
if (!Credentials::HasInstance(creds_value)) {
return NanThrowTypeError(
"credentials arg must be a Credentials object");
}
Credentials *creds_object =
ObjectWrap::Unwrap<Credentials>(creds_value->ToObject());
creds = creds_object->GetWrappedCredentials();
args_hash->Delete(NanNew("credentials"));
}
Handle<Array> keys(args_hash->GetOwnPropertyNames()); Handle<Array> keys(args_hash->GetOwnPropertyNames());
grpc_channel_args channel_args; grpc_channel_args channel_args;
channel_args.num_args = keys->Length(); channel_args.num_args = keys->Length();
@ -149,16 +148,19 @@ NAN_METHOD(Channel::New) {
return NanThrowTypeError("Arg values must be strings"); return NanThrowTypeError("Arg values must be strings");
} }
} }
if (creds == NULL) { channel_args_ptr = &channel_args;
wrapped_channel = grpc_insecure_channel_create(**host, &channel_args);
} else {
wrapped_channel =
grpc_secure_channel_create(creds, **host, &channel_args);
}
free(channel_args.args);
} else { } else {
return NanThrowTypeError("Channel expects a string and an object"); return NanThrowTypeError("Channel expects a string and an object");
} }
if (creds == NULL) {
wrapped_channel = grpc_insecure_channel_create(**host, channel_args_ptr);
} else {
wrapped_channel =
grpc_secure_channel_create(creds, **host, channel_args_ptr);
}
if (channel_args_ptr != NULL) {
free(channel_args_ptr->args);
}
Channel *channel; Channel *channel;
if (host_override == NULL) { if (host_override == NULL) {
channel = new Channel(wrapped_channel, host); channel = new Channel(wrapped_channel, host);
@ -168,8 +170,8 @@ NAN_METHOD(Channel::New) {
channel->Wrap(args.This()); channel->Wrap(args.This());
NanReturnValue(args.This()); NanReturnValue(args.This());
} else { } else {
const int argc = 2; const int argc = 3;
Local<Value> argv[argc] = {args[0], args[1]}; Local<Value> argv[argc] = {args[0], args[1], args[2]};
NanReturnValue(constructor->GetFunction()->NewInstance(argc, argv)); NanReturnValue(constructor->GetFunction()->NewInstance(argc, argv));
} }
} }

@ -81,6 +81,8 @@ void Credentials::Init(Handle<Object> exports) {
NanNew<FunctionTemplate>(CreateGce)->GetFunction()); NanNew<FunctionTemplate>(CreateGce)->GetFunction());
ctr->Set(NanNew("createIam"), ctr->Set(NanNew("createIam"),
NanNew<FunctionTemplate>(CreateIam)->GetFunction()); NanNew<FunctionTemplate>(CreateIam)->GetFunction());
ctr->Set(NanNew("createInsecure"),
NanNew<FunctionTemplate>(CreateInsecure)->GetFunction());
constructor = new NanCallback(ctr); constructor = new NanCallback(ctr);
exports->Set(NanNew("Credentials"), ctr); exports->Set(NanNew("Credentials"), ctr);
} }
@ -92,9 +94,6 @@ bool Credentials::HasInstance(Handle<Value> val) {
Handle<Value> Credentials::WrapStruct(grpc_credentials *credentials) { Handle<Value> Credentials::WrapStruct(grpc_credentials *credentials) {
NanEscapableScope(); NanEscapableScope();
if (credentials == NULL) {
return NanEscapeScope(NanNull());
}
const int argc = 1; const int argc = 1;
Handle<Value> argv[argc] = { Handle<Value> argv[argc] = {
NanNew<External>(reinterpret_cast<void *>(credentials))}; NanNew<External>(reinterpret_cast<void *>(credentials))};
@ -128,7 +127,11 @@ NAN_METHOD(Credentials::New) {
NAN_METHOD(Credentials::CreateDefault) { NAN_METHOD(Credentials::CreateDefault) {
NanScope(); NanScope();
NanReturnValue(WrapStruct(grpc_google_default_credentials_create())); grpc_credentials *creds = grpc_google_default_credentials_create();
if (creds == NULL) {
NanReturnNull();
}
NanReturnValue(WrapStruct(creds));
} }
NAN_METHOD(Credentials::CreateSsl) { NAN_METHOD(Credentials::CreateSsl) {
@ -152,9 +155,12 @@ NAN_METHOD(Credentials::CreateSsl) {
return NanThrowTypeError( return NanThrowTypeError(
"createSSl's third argument must be a Buffer if provided"); "createSSl's third argument must be a Buffer if provided");
} }
grpc_credentials *creds = grpc_ssl_credentials_create(
NanReturnValue(WrapStruct(grpc_ssl_credentials_create( root_certs, key_cert_pair.private_key == NULL ? NULL : &key_cert_pair);
root_certs, key_cert_pair.private_key == NULL ? NULL : &key_cert_pair))); if (creds == NULL) {
NanReturnNull();
}
NanReturnValue(WrapStruct(creds));
} }
NAN_METHOD(Credentials::CreateComposite) { NAN_METHOD(Credentials::CreateComposite) {
@ -169,13 +175,21 @@ NAN_METHOD(Credentials::CreateComposite) {
} }
Credentials *creds1 = ObjectWrap::Unwrap<Credentials>(args[0]->ToObject()); Credentials *creds1 = ObjectWrap::Unwrap<Credentials>(args[0]->ToObject());
Credentials *creds2 = ObjectWrap::Unwrap<Credentials>(args[1]->ToObject()); Credentials *creds2 = ObjectWrap::Unwrap<Credentials>(args[1]->ToObject());
NanReturnValue(WrapStruct(grpc_composite_credentials_create( grpc_credentials *creds = grpc_composite_credentials_create(
creds1->wrapped_credentials, creds2->wrapped_credentials))); creds1->wrapped_credentials, creds2->wrapped_credentials);
if (creds == NULL) {
NanReturnNull();
}
NanReturnValue(WrapStruct(creds));
} }
NAN_METHOD(Credentials::CreateGce) { NAN_METHOD(Credentials::CreateGce) {
NanScope(); NanScope();
NanReturnValue(WrapStruct(grpc_compute_engine_credentials_create())); grpc_credentials *creds = grpc_compute_engine_credentials_create();
if (creds == NULL) {
NanReturnNull();
}
NanReturnValue(WrapStruct(creds));
} }
NAN_METHOD(Credentials::CreateIam) { NAN_METHOD(Credentials::CreateIam) {
@ -188,8 +202,17 @@ NAN_METHOD(Credentials::CreateIam) {
} }
NanUtf8String auth_token(args[0]); NanUtf8String auth_token(args[0]);
NanUtf8String auth_selector(args[1]); NanUtf8String auth_selector(args[1]);
NanReturnValue( grpc_credentials *creds = grpc_iam_credentials_create(*auth_token,
WrapStruct(grpc_iam_credentials_create(*auth_token, *auth_selector))); *auth_selector);
if (creds == NULL) {
NanReturnNull();
}
NanReturnValue(WrapStruct(creds));
}
NAN_METHOD(Credentials::CreateInsecure) {
NanScope();
NanReturnValue(WrapStruct(NULL));
} }
} // namespace node } // namespace node

@ -68,6 +68,7 @@ class Credentials : public ::node::ObjectWrap {
static NAN_METHOD(CreateGce); static NAN_METHOD(CreateGce);
static NAN_METHOD(CreateFake); static NAN_METHOD(CreateFake);
static NAN_METHOD(CreateIam); static NAN_METHOD(CreateIam);
static NAN_METHOD(CreateInsecure);
static NanCallback *constructor; static NanCallback *constructor;
// Used for typechecking instances of this javascript class // Used for typechecking instances of this javascript class
static v8::Persistent<v8::FunctionTemplate> fun_tpl; static v8::Persistent<v8::FunctionTemplate> fun_tpl;

@ -397,6 +397,7 @@ var test_cases = {
function runTest(address, host_override, test_case, tls, test_ca, done) { function runTest(address, host_override, test_case, tls, test_ca, done) {
// TODO(mlumish): enable TLS functionality // TODO(mlumish): enable TLS functionality
var options = {}; var options = {};
var creds;
if (tls) { if (tls) {
var ca_path; var ca_path;
if (test_ca) { if (test_ca) {
@ -405,13 +406,14 @@ function runTest(address, host_override, test_case, tls, test_ca, done) {
ca_path = process.env.SSL_CERT_FILE; ca_path = process.env.SSL_CERT_FILE;
} }
var ca_data = fs.readFileSync(ca_path); var ca_data = fs.readFileSync(ca_path);
var creds = grpc.Credentials.createSsl(ca_data); creds = grpc.Credentials.createSsl(ca_data);
options.credentials = creds;
if (host_override) { if (host_override) {
options['grpc.ssl_target_name_override'] = host_override; options['grpc.ssl_target_name_override'] = host_override;
} }
} else {
creds = grpc.Credentials.createInsecure();
} }
var client = new testProto.TestService(address, options); var client = new testProto.TestService(address, creds, options);
test_cases[test_case](client, done); test_cases[test_case](client, done);
} }

@ -531,11 +531,13 @@ exports.makeClientConstructor = function(methods, serviceName) {
* Create a client with the given methods * Create a client with the given methods
* @constructor * @constructor
* @param {string} address The address of the server to connect to * @param {string} address The address of the server to connect to
* @param {grpc.Credentials} credentials Credentials to use to connect
* to the server
* @param {Object} options Options to pass to the underlying channel * @param {Object} options Options to pass to the underlying channel
* @param {function(string, Object, function)=} updateMetadata function to * @param {function(string, Object, function)=} updateMetadata function to
* update the metadata for each request * update the metadata for each request
*/ */
function Client(address, options, updateMetadata) { function Client(address, credentials, options, updateMetadata) {
if (!updateMetadata) { if (!updateMetadata) {
updateMetadata = function(uri, metadata, callback) { updateMetadata = function(uri, metadata, callback) {
callback(null, metadata); callback(null, metadata);
@ -545,7 +547,7 @@ exports.makeClientConstructor = function(methods, serviceName) {
options = {}; options = {};
} }
options['grpc.primary_user_agent'] = 'grpc-node/' + version; options['grpc.primary_user_agent'] = 'grpc-node/' + version;
this.channel = new grpc.Channel(address, options); this.channel = new grpc.Channel(address, credentials, options);
this.server_address = address.replace(/\/$/, ''); this.server_address = address.replace(/\/$/, '');
this.auth_uri = this.server_address + '/' + serviceName; this.auth_uri = this.server_address + '/' + serviceName;
this.updateMetadata = updateMetadata; this.updateMetadata = updateMetadata;

@ -48,6 +48,8 @@ function getDeadline(timeout_secs) {
return deadline; return deadline;
} }
var insecureCreds = grpc.Credentials.createInsecure();
describe('call', function() { describe('call', function() {
var channel; var channel;
var server; var server;
@ -55,7 +57,7 @@ describe('call', function() {
server = new grpc.Server(); server = new grpc.Server();
var port = server.addHttp2Port('localhost:0'); var port = server.addHttp2Port('localhost:0');
server.start(); server.start();
channel = new grpc.Channel('localhost:' + port); channel = new grpc.Channel('localhost:' + port, insecureCreds);
}); });
after(function() { after(function() {
server.shutdown(); server.shutdown();
@ -82,7 +84,7 @@ describe('call', function() {
}); });
}); });
it('should fail with a closed channel', function() { it('should fail with a closed channel', function() {
var local_channel = new grpc.Channel('hostname'); var local_channel = new grpc.Channel('hostname', insecureCreds);
local_channel.close(); local_channel.close();
assert.throws(function() { assert.throws(function() {
new grpc.Call(channel, 'method'); new grpc.Call(channel, 'method');

@ -36,11 +36,13 @@
var assert = require('assert'); var assert = require('assert');
var grpc = require('bindings')('grpc.node'); var grpc = require('bindings')('grpc.node');
var insecureCreds = grpc.Credentials.createInsecure();
describe('channel', function() { describe('channel', function() {
describe('constructor', function() { describe('constructor', function() {
it('should require a string for the first argument', function() { it('should require a string for the first argument', function() {
assert.doesNotThrow(function() { assert.doesNotThrow(function() {
new grpc.Channel('hostname'); new grpc.Channel('hostname', insecureCreds);
}); });
assert.throws(function() { assert.throws(function() {
new grpc.Channel(); new grpc.Channel();
@ -49,38 +51,49 @@ describe('channel', function() {
new grpc.Channel(5); new grpc.Channel(5);
}); });
}); });
it('should accept an object for the second parameter', function() { it('should require a credential for the second argument', function() {
assert.doesNotThrow(function() { assert.doesNotThrow(function() {
new grpc.Channel('hostname', {}); new grpc.Channel('hostname', insecureCreds);
}); });
assert.throws(function() { assert.throws(function() {
new grpc.Channel('hostname', 5); new grpc.Channel('hostname', 5);
}); });
assert.throws(function() {
new grpc.Channel('hostname');
});
});
it('should accept an object for the third argument', function() {
assert.doesNotThrow(function() {
new grpc.Channel('hostname', insecureCreds, {});
});
assert.throws(function() {
new grpc.Channel('hostname', insecureCreds, 'abc');
});
}); });
it('should only accept objects with string or int values', function() { it('should only accept objects with string or int values', function() {
assert.doesNotThrow(function() { assert.doesNotThrow(function() {
new grpc.Channel('hostname', {'key' : 'value'}); new grpc.Channel('hostname', insecureCreds,{'key' : 'value'});
}); });
assert.doesNotThrow(function() { assert.doesNotThrow(function() {
new grpc.Channel('hostname', {'key' : 5}); new grpc.Channel('hostname', insecureCreds, {'key' : 5});
}); });
assert.throws(function() { assert.throws(function() {
new grpc.Channel('hostname', {'key' : null}); new grpc.Channel('hostname', insecureCreds, {'key' : null});
}); });
assert.throws(function() { assert.throws(function() {
new grpc.Channel('hostname', {'key' : new Date()}); new grpc.Channel('hostname', insecureCreds, {'key' : new Date()});
}); });
}); });
}); });
describe('close', function() { describe('close', function() {
it('should succeed silently', function() { it('should succeed silently', function() {
var channel = new grpc.Channel('hostname', {}); var channel = new grpc.Channel('hostname', insecureCreds, {});
assert.doesNotThrow(function() { assert.doesNotThrow(function() {
channel.close(); channel.close();
}); });
}); });
it('should be idempotent', function() { it('should be idempotent', function() {
var channel = new grpc.Channel('hostname', {}); var channel = new grpc.Channel('hostname', insecureCreds, {});
assert.doesNotThrow(function() { assert.doesNotThrow(function() {
channel.close(); channel.close();
channel.close(); channel.close();
@ -89,7 +102,7 @@ describe('channel', function() {
}); });
describe('getTarget', function() { describe('getTarget', function() {
it('should return a string', function() { it('should return a string', function() {
var channel = new grpc.Channel('localhost', {}); var channel = new grpc.Channel('localhost', insecureCreds, {});
assert.strictEqual(typeof channel.getTarget(), 'string'); assert.strictEqual(typeof channel.getTarget(), 'string');
}); });
}); });

@ -57,6 +57,8 @@ function multiDone(done, count) {
}; };
} }
var insecureCreds = grpc.Credentials.createInsecure();
describe('end-to-end', function() { describe('end-to-end', function() {
var server; var server;
var channel; var channel;
@ -64,7 +66,7 @@ describe('end-to-end', function() {
server = new grpc.Server(); server = new grpc.Server();
var port_num = server.addHttp2Port('0.0.0.0:0'); var port_num = server.addHttp2Port('0.0.0.0:0');
server.start(); server.start();
channel = new grpc.Channel('localhost:' + port_num); channel = new grpc.Channel('localhost:' + port_num, insecureCreds);
}); });
after(function() { after(function() {
server.shutdown(); server.shutdown();

@ -56,7 +56,8 @@ describe('Health Checking', function() {
before(function() { before(function() {
var port_num = healthServer.bind('0.0.0.0:0'); var port_num = healthServer.bind('0.0.0.0:0');
healthServer.start(); healthServer.start();
healthClient = new health.Client('localhost:' + port_num); healthClient = new health.Client('localhost:' + port_num,
grpc.Credentials.createInsecure());
}); });
after(function() { after(function() {
healthServer.shutdown(); healthServer.shutdown();

@ -53,7 +53,8 @@ describe('Math client', function() {
before(function(done) { before(function(done) {
var port_num = server.bind('0.0.0.0:0'); var port_num = server.bind('0.0.0.0:0');
server.start(); server.start();
math_client = new math.Math('localhost:' + port_num); math_client = new math.Math('localhost:' + port_num,
grpc.Credentials.createInsecure());
done(); done();
}); });
after(function() { after(function() {

@ -124,7 +124,7 @@ describe('Echo service', function() {
}); });
var port = server.bind('localhost:0'); var port = server.bind('localhost:0');
var Client = surface_client.makeProtobufClientConstructor(echo_service); var Client = surface_client.makeProtobufClientConstructor(echo_service);
client = new Client('localhost:' + port); client = new Client('localhost:' + port, grpc.Credentials.createInsecure());
server.start(); server.start();
}); });
after(function() { after(function() {
@ -169,7 +169,8 @@ describe('Generic client and server', function() {
var port = server.bind('localhost:0'); var port = server.bind('localhost:0');
server.start(); server.start();
var Client = grpc.makeGenericClientConstructor(string_service_attrs); var Client = grpc.makeGenericClientConstructor(string_service_attrs);
client = new Client('localhost:' + port); client = new Client('localhost:' + port,
grpc.Credentials.createInsecure());
}); });
after(function() { after(function() {
server.shutdown(); server.shutdown();
@ -216,7 +217,7 @@ describe('Echo metadata', function() {
}); });
var port = server.bind('localhost:0'); var port = server.bind('localhost:0');
var Client = surface_client.makeProtobufClientConstructor(test_service); var Client = surface_client.makeProtobufClientConstructor(test_service);
client = new Client('localhost:' + port); client = new Client('localhost:' + port, grpc.Credentials.createInsecure());
server.start(); server.start();
}); });
after(function() { after(function() {
@ -337,7 +338,7 @@ describe('Other conditions', function() {
}); });
port = server.bind('localhost:0'); port = server.bind('localhost:0');
var Client = surface_client.makeProtobufClientConstructor(test_service); var Client = surface_client.makeProtobufClientConstructor(test_service);
client = new Client('localhost:' + port); client = new Client('localhost:' + port, grpc.Credentials.createInsecure());
server.start(); server.start();
}); });
after(function() { after(function() {
@ -382,7 +383,8 @@ describe('Other conditions', function() {
}; };
var Client = surface_client.makeClientConstructor(test_service_attrs, var Client = surface_client.makeClientConstructor(test_service_attrs,
'TestService'); 'TestService');
misbehavingClient = new Client('localhost:' + port); misbehavingClient = new Client('localhost:' + port,
grpc.Credentials.createInsecure());
}); });
it('should respond correctly to a unary call', function(done) { it('should respond correctly to a unary call', function(done) {
misbehavingClient.unary(badArg, function(err, data) { misbehavingClient.unary(badArg, function(err, data) {
@ -602,7 +604,7 @@ describe('Cancelling surface client', function() {
}); });
var port = server.bind('localhost:0'); var port = server.bind('localhost:0');
var Client = surface_client.makeProtobufClientConstructor(mathService); var Client = surface_client.makeProtobufClientConstructor(mathService);
client = new Client('localhost:' + port); client = new Client('localhost:' + port, grpc.Credentials.createInsecure());
server.start(); server.start();
}); });
after(function() { after(function() {

@ -84,7 +84,7 @@ char *grpc_test_fetch_oauth2_token_with_credentials(grpc_credentials *creds) {
gpr_mu_lock(GRPC_POLLSET_MU(&request.pollset)); gpr_mu_lock(GRPC_POLLSET_MU(&request.pollset));
while (!request.is_done) while (!request.is_done)
grpc_pollset_work(&request.pollset, gpr_inf_future(GPR_CLOCK_REALTIME)); grpc_pollset_work(&request.pollset, gpr_inf_future(GPR_CLOCK_MONOTONIC));
gpr_mu_unlock(GRPC_POLLSET_MU(&request.pollset)); gpr_mu_unlock(GRPC_POLLSET_MU(&request.pollset));
grpc_pollset_shutdown(&request.pollset, do_nothing, NULL); grpc_pollset_shutdown(&request.pollset, do_nothing, NULL);

@ -53,8 +53,8 @@ static void RunQPS() {
ClientConfig client_config; ClientConfig client_config;
client_config.set_client_type(ASYNC_CLIENT); client_config.set_client_type(ASYNC_CLIENT);
client_config.set_enable_ssl(false); client_config.set_enable_ssl(false);
client_config.set_outstanding_rpcs_per_channel(10); client_config.set_outstanding_rpcs_per_channel(1000);
client_config.set_client_channels(800); client_config.set_client_channels(8);
client_config.set_payload_size(1); client_config.set_payload_size(1);
client_config.set_async_client_threads(8); client_config.set_async_client_threads(8);
client_config.set_rpc_type(UNARY); client_config.set_rpc_type(UNARY);

@ -31,10 +31,11 @@
set -e set -e
#clean up any old docker files #clean up any old docker files and start mirroring repository if not started already
sudo docker rmi -f grpc/cxx || true sudo docker rmi -f grpc/cxx || true
sudo docker rmi -f grpc/base || true sudo docker rmi -f grpc/base || true
sudo docker rmi -f 0.0.0.0:5000/grpc/base || true sudo docker rmi -f 0.0.0.0:5000/grpc/base || true
sudo docker run -d -e GCS_BUCKET=docker-interop-images -e STORAGE_PATH=/admin/docker_images -p 5000:5000 google/docker-registry || true
#prepare building by pulling down base images and necessary files #prepare building by pulling down base images and necessary files
sudo docker pull 0.0.0.0:5000/grpc/base sudo docker pull 0.0.0.0:5000/grpc/base

Loading…
Cancel
Save