|
|
@ -1,6 +1,6 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* |
|
|
|
* |
|
|
|
* Copyright 2015, Google Inc. |
|
|
|
* Copyright 2015-2016, Google Inc. |
|
|
|
* All rights reserved. |
|
|
|
* All rights reserved. |
|
|
|
* |
|
|
|
* |
|
|
|
* Redistribution and use in source and binary forms, with or without |
|
|
|
* Redistribution and use in source and binary forms, with or without |
|
|
@ -952,6 +952,7 @@ describe('Call propagation', function() { |
|
|
|
describe('Cancellation', function() { |
|
|
|
describe('Cancellation', function() { |
|
|
|
it('With a unary call', function(done) { |
|
|
|
it('With a unary call', function(done) { |
|
|
|
done = multiDone(done, 2); |
|
|
|
done = multiDone(done, 2); |
|
|
|
|
|
|
|
var call; |
|
|
|
proxy_impl.unary = function(parent, callback) { |
|
|
|
proxy_impl.unary = function(parent, callback) { |
|
|
|
client.unary(parent.request, function(err, value) { |
|
|
|
client.unary(parent.request, function(err, value) { |
|
|
|
try { |
|
|
|
try { |
|
|
@ -969,12 +970,13 @@ describe('Call propagation', function() { |
|
|
|
proxy.start(); |
|
|
|
proxy.start(); |
|
|
|
var proxy_client = new Client('localhost:' + proxy_port, |
|
|
|
var proxy_client = new Client('localhost:' + proxy_port, |
|
|
|
grpc.credentials.createInsecure()); |
|
|
|
grpc.credentials.createInsecure()); |
|
|
|
var call = proxy_client.unary({}, function(err, value) { |
|
|
|
call = proxy_client.unary({}, function(err, value) { |
|
|
|
done(); |
|
|
|
done(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
it('With a client stream call', function(done) { |
|
|
|
it('With a client stream call', function(done) { |
|
|
|
done = multiDone(done, 2); |
|
|
|
done = multiDone(done, 2); |
|
|
|
|
|
|
|
var call; |
|
|
|
proxy_impl.clientStream = function(parent, callback) { |
|
|
|
proxy_impl.clientStream = function(parent, callback) { |
|
|
|
client.clientStream(function(err, value) { |
|
|
|
client.clientStream(function(err, value) { |
|
|
|
try { |
|
|
|
try { |
|
|
@ -992,12 +994,13 @@ describe('Call propagation', function() { |
|
|
|
proxy.start(); |
|
|
|
proxy.start(); |
|
|
|
var proxy_client = new Client('localhost:' + proxy_port, |
|
|
|
var proxy_client = new Client('localhost:' + proxy_port, |
|
|
|
grpc.credentials.createInsecure()); |
|
|
|
grpc.credentials.createInsecure()); |
|
|
|
var call = proxy_client.clientStream(function(err, value) { |
|
|
|
call = proxy_client.clientStream(function(err, value) { |
|
|
|
done(); |
|
|
|
done(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
it('With a server stream call', function(done) { |
|
|
|
it('With a server stream call', function(done) { |
|
|
|
done = multiDone(done, 2); |
|
|
|
done = multiDone(done, 2); |
|
|
|
|
|
|
|
var call; |
|
|
|
proxy_impl.serverStream = function(parent) { |
|
|
|
proxy_impl.serverStream = function(parent) { |
|
|
|
var child = client.serverStream(parent.request, null, |
|
|
|
var child = client.serverStream(parent.request, null, |
|
|
|
{parent: parent}); |
|
|
|
{parent: parent}); |
|
|
@ -1013,13 +1016,14 @@ describe('Call propagation', function() { |
|
|
|
proxy.start(); |
|
|
|
proxy.start(); |
|
|
|
var proxy_client = new Client('localhost:' + proxy_port, |
|
|
|
var proxy_client = new Client('localhost:' + proxy_port, |
|
|
|
grpc.credentials.createInsecure()); |
|
|
|
grpc.credentials.createInsecure()); |
|
|
|
var call = proxy_client.serverStream({}); |
|
|
|
call = proxy_client.serverStream({}); |
|
|
|
call.on('error', function(err) { |
|
|
|
call.on('error', function(err) { |
|
|
|
done(); |
|
|
|
done(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
it('With a bidi stream call', function(done) { |
|
|
|
it('With a bidi stream call', function(done) { |
|
|
|
done = multiDone(done, 2); |
|
|
|
done = multiDone(done, 2); |
|
|
|
|
|
|
|
var call; |
|
|
|
proxy_impl.bidiStream = function(parent) { |
|
|
|
proxy_impl.bidiStream = function(parent) { |
|
|
|
var child = client.bidiStream(null, {parent: parent}); |
|
|
|
var child = client.bidiStream(null, {parent: parent}); |
|
|
|
child.on('error', function(err) { |
|
|
|
child.on('error', function(err) { |
|
|
@ -1034,7 +1038,7 @@ describe('Call propagation', function() { |
|
|
|
proxy.start(); |
|
|
|
proxy.start(); |
|
|
|
var proxy_client = new Client('localhost:' + proxy_port, |
|
|
|
var proxy_client = new Client('localhost:' + proxy_port, |
|
|
|
grpc.credentials.createInsecure()); |
|
|
|
grpc.credentials.createInsecure()); |
|
|
|
var call = proxy_client.bidiStream(); |
|
|
|
call = proxy_client.bidiStream(); |
|
|
|
call.on('error', function(err) { |
|
|
|
call.on('error', function(err) { |
|
|
|
done(); |
|
|
|
done(); |
|
|
|
}); |
|
|
|
}); |
|
|
|