Fixed some issues with the tests

pull/3746/head
murgatroid99 9 years ago
parent 6374f9dc83
commit be13d81824
  1. 14
      src/node/interop/interop_client.js
  2. 2
      src/node/test/async_test.js
  3. 2
      src/node/test/channel_test.js
  4. 10
      src/node/test/credentials_test.js
  5. 2
      src/node/test/interop_sanity_test.js

@ -44,8 +44,14 @@ var GoogleAuth = require('google-auth-library');
var assert = require('assert'); var assert = require('assert');
var SERVICE_ACCOUNT_EMAIL = require( var SERVICE_ACCOUNT_EMAIL;
try {
SERVICE_ACCOUNT_EMAIL = require(
process.env.GOOGLE_APPLICATION_CREDENTIALS).client_email; 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_INITIAL_KEY = 'x-grpc-test-echo-initial';
var ECHO_TRAILING_KEY = 'x-grpc-test-echo-trailing-bin'; var ECHO_TRAILING_KEY = 'x-grpc-test-echo-trailing-bin';
@ -346,20 +352,20 @@ function statusCodeAndMessage(client, done) {
var arg = { var arg = {
response_status: { response_status: {
code: 2, code: 2,
message: "test status message" message: 'test status message'
} }
}; };
client.unaryCall(arg, function(err, resp) { client.unaryCall(arg, function(err, resp) {
assert(err); assert(err);
assert.strictEqual(err.code, 2); assert.strictEqual(err.code, 2);
assert.strictEqual(err.message, "test status message"); assert.strictEqual(err.message, 'test status message');
done(); done();
}); });
var duplex = client.fullDuplexCall(); var duplex = client.fullDuplexCall();
duplex.on('status', function(status) { duplex.on('status', function(status) {
assert(status); assert(status);
assert.strictEqual(status.code, 2); assert.strictEqual(status.code, 2);
assert.strictEqual(status.details, "test status message"); assert.strictEqual(status.details, 'test status message');
done(); done();
}); });
duplex.on('error', function(){}); duplex.on('error', function(){});

@ -57,7 +57,7 @@ describe('Async functionality', function() {
grpc.ServerCredentials.createInsecure()); grpc.ServerCredentials.createInsecure());
server.start(); server.start();
math_client = new math.Math('localhost:' + port_num, math_client = new math.Math('localhost:' + port_num,
grpc.Credentials.createInsecure()); grpc.credentials.createInsecure());
done(); done();
}); });
after(function() { after(function() {

@ -149,7 +149,7 @@ describe('channel', function() {
afterEach(function() { afterEach(function() {
channel.close(); 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 old_state = channel.getConnectivityState();
var deadline = new Date(); var deadline = new Date();
deadline.setSeconds(deadline.getSeconds() + 1); deadline.setSeconds(deadline.getSeconds() + 1);

@ -130,8 +130,8 @@ describe('client credentials', function() {
callback(null, metadata); callback(null, metadata);
}; };
var creds = grpc.credentials.createFromMetadataGenerator(metadataUpdater); var creds = grpc.credentials.createFromMetadataGenerator(metadataUpdater);
var combined_creds = grpc.credentials.combineCredentials(client_ssl_creds, var combined_creds = grpc.credentials.combineChannelCredentials(
creds); client_ssl_creds, creds);
var client = new Client('localhost:' + port, combined_creds, var client = new Client('localhost:' + port, combined_creds,
client_options); client_options);
var call = client.unary({}, function(err, data) { var call = client.unary({}, function(err, data) {
@ -150,8 +150,8 @@ describe('client credentials', function() {
callback(null, metadata); callback(null, metadata);
}; };
var creds = grpc.credentials.createFromMetadataGenerator(metadataUpdater); var creds = grpc.credentials.createFromMetadataGenerator(metadataUpdater);
var combined_creds = grpc.credentials.combineCredentials(client_ssl_creds, var combined_creds = grpc.credentials.combineChannelCredentials(
creds); client_ssl_creds, creds);
var client = new Client('localhost:' + port, combined_creds, var client = new Client('localhost:' + port, combined_creds,
client_options); client_options);
var call = client.unary({}, function(err, data) { var call = client.unary({}, function(err, data) {
@ -231,7 +231,7 @@ describe('client credentials', function() {
updater_creds, alt_updater_creds); updater_creds, alt_updater_creds);
var call = client.unary({}, function(err, data) { var call = client.unary({}, function(err, data) {
assert.ifError(err); assert.ifError(err);
}, null, {credentials: updater_creds}); }, null, {credentials: combined_updater});
call.on('metadata', function(metadata) { call.on('metadata', function(metadata) {
assert.deepEqual(metadata.get('plugin_key'), ['plugin_value']); assert.deepEqual(metadata.get('plugin_key'), ['plugin_value']);
assert.deepEqual(metadata.get('other_plugin_key'), assert.deepEqual(metadata.get('other_plugin_key'),

@ -71,7 +71,7 @@ describe('Interop tests', function() {
interop_client.runTest(port, name_override, 'server_streaming', true, true, interop_client.runTest(port, name_override, 'server_streaming', true, true,
done); 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); interop_client.runTest(port, name_override, 'ping_pong', true, true, done);
}); });
it('should pass empty_stream', function(done) { it('should pass empty_stream', function(done) {

Loading…
Cancel
Save