From be13d818240bd2f37737d8717d4f77a417f44074 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Fri, 9 Oct 2015 14:45:30 -0700 Subject: [PATCH] Fixed some issues with the tests --- src/node/interop/interop_client.js | 16 +++++++++++----- src/node/test/async_test.js | 2 +- src/node/test/channel_test.js | 2 +- src/node/test/credentials_test.js | 10 +++++----- src/node/test/interop_sanity_test.js | 2 +- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/node/interop/interop_client.js b/src/node/interop/interop_client.js index 6ee271f431b..cb55083d1ae 100644 --- a/src/node/interop/interop_client.js +++ b/src/node/interop/interop_client.js @@ -44,8 +44,14 @@ var GoogleAuth = require('google-auth-library'); var assert = require('assert'); -var SERVICE_ACCOUNT_EMAIL = require( - process.env.GOOGLE_APPLICATION_CREDENTIALS).client_email; +var SERVICE_ACCOUNT_EMAIL; +try { + SERVICE_ACCOUNT_EMAIL = require( + process.env.GOOGLE_APPLICATION_CREDENTIALS).client_email; +} catch (e) { + // This will cause the tests to fail if they need that string + SERVICE_ACCOUNT_EMAIL = null; +} var ECHO_INITIAL_KEY = 'x-grpc-test-echo-initial'; var ECHO_TRAILING_KEY = 'x-grpc-test-echo-trailing-bin'; @@ -346,20 +352,20 @@ function statusCodeAndMessage(client, done) { var arg = { response_status: { code: 2, - message: "test status message" + message: 'test status message' } }; client.unaryCall(arg, function(err, resp) { assert(err); assert.strictEqual(err.code, 2); - assert.strictEqual(err.message, "test status message"); + assert.strictEqual(err.message, 'test status message'); done(); }); var duplex = client.fullDuplexCall(); duplex.on('status', function(status) { assert(status); assert.strictEqual(status.code, 2); - assert.strictEqual(status.details, "test status message"); + assert.strictEqual(status.details, 'test status message'); done(); }); duplex.on('error', function(){}); diff --git a/src/node/test/async_test.js b/src/node/test/async_test.js index ce3ce50a2d6..6d71ea24f54 100644 --- a/src/node/test/async_test.js +++ b/src/node/test/async_test.js @@ -57,7 +57,7 @@ describe('Async functionality', function() { grpc.ServerCredentials.createInsecure()); server.start(); math_client = new math.Math('localhost:' + port_num, - grpc.Credentials.createInsecure()); + grpc.credentials.createInsecure()); done(); }); after(function() { diff --git a/src/node/test/channel_test.js b/src/node/test/channel_test.js index b86f89b8a85..05269f7b6e4 100644 --- a/src/node/test/channel_test.js +++ b/src/node/test/channel_test.js @@ -149,7 +149,7 @@ describe('channel', function() { afterEach(function() { channel.close(); }); - it.only('should time out if called alone', function(done) { + it('should time out if called alone', function(done) { var old_state = channel.getConnectivityState(); var deadline = new Date(); deadline.setSeconds(deadline.getSeconds() + 1); diff --git a/src/node/test/credentials_test.js b/src/node/test/credentials_test.js index 8eb91ee69e6..7fc311a888d 100644 --- a/src/node/test/credentials_test.js +++ b/src/node/test/credentials_test.js @@ -130,8 +130,8 @@ describe('client credentials', function() { callback(null, metadata); }; var creds = grpc.credentials.createFromMetadataGenerator(metadataUpdater); - var combined_creds = grpc.credentials.combineCredentials(client_ssl_creds, - creds); + var combined_creds = grpc.credentials.combineChannelCredentials( + client_ssl_creds, creds); var client = new Client('localhost:' + port, combined_creds, client_options); var call = client.unary({}, function(err, data) { @@ -150,8 +150,8 @@ describe('client credentials', function() { callback(null, metadata); }; var creds = grpc.credentials.createFromMetadataGenerator(metadataUpdater); - var combined_creds = grpc.credentials.combineCredentials(client_ssl_creds, - creds); + var combined_creds = grpc.credentials.combineChannelCredentials( + client_ssl_creds, creds); var client = new Client('localhost:' + port, combined_creds, client_options); var call = client.unary({}, function(err, data) { @@ -231,7 +231,7 @@ describe('client credentials', function() { updater_creds, alt_updater_creds); var call = client.unary({}, function(err, data) { assert.ifError(err); - }, null, {credentials: updater_creds}); + }, null, {credentials: combined_updater}); call.on('metadata', function(metadata) { assert.deepEqual(metadata.get('plugin_key'), ['plugin_value']); assert.deepEqual(metadata.get('other_plugin_key'), diff --git a/src/node/test/interop_sanity_test.js b/src/node/test/interop_sanity_test.js index f008a87585c..f8c0b141377 100644 --- a/src/node/test/interop_sanity_test.js +++ b/src/node/test/interop_sanity_test.js @@ -71,7 +71,7 @@ describe('Interop tests', function() { interop_client.runTest(port, name_override, 'server_streaming', true, true, done); }); - it('should pass ping_pong', function(done) { + it.only('should pass ping_pong', function(done) { interop_client.runTest(port, name_override, 'ping_pong', true, true, done); }); it('should pass empty_stream', function(done) {