diff --git a/src/node/index.js b/src/node/index.js index b26ab35f2c5..93c65ac5c43 100644 --- a/src/node/index.js +++ b/src/node/index.js @@ -134,6 +134,11 @@ exports.Server = server.Server; */ exports.status = grpc.status; +/** + * Propagate flag name to number mapping + */ +exports.propagate = grpc.propagate; + /** * Call error name to code number mapping */ diff --git a/src/node/test/constant_test.js b/src/node/test/constant_test.js index 964fc60da06..e251dd34283 100644 --- a/src/node/test/constant_test.js +++ b/src/node/test/constant_test.js @@ -87,7 +87,8 @@ var propagateFlagNames = [ 'DEADLINE', 'CENSUS_STATS_CONTEXT', 'CENSUS_TRACING_CONTEXT', - 'CANCELLATION' + 'CANCELLATION', + 'DEFAULTS' ]; describe('constants', function() { diff --git a/src/node/test/surface_test.js b/src/node/test/surface_test.js index b8740af74a7..5e731ea42bf 100644 --- a/src/node/test/surface_test.js +++ b/src/node/test/surface_test.js @@ -723,7 +723,10 @@ describe('Other conditions', function() { }); }); describe('Deadline', function() { - it.skip('With a client stream call', function(done) { + /* jshint bitwise:false */ + var deadline_flags = (grpc.propagate.DEFAULTS & + ~grpc.propagate.CANCELLATION); + it('With a client stream call', function(done) { done = multiDone(done, 2); proxy_impl.clientStream = function(parent, callback) { client.clientStream(function(err, value) { @@ -734,7 +737,7 @@ describe('Other conditions', function() { callback(err, value); done(); } - }, null, {parent: parent}); + }, null, {parent: parent, propagate_flags: deadline_flags}); }; proxy.addProtoService(test_service, proxy_impl); var proxy_port = proxy.bind('localhost:0', server_insecure_creds); @@ -743,14 +746,15 @@ describe('Other conditions', function() { grpc.Credentials.createInsecure()); var deadline = new Date(); deadline.setSeconds(deadline.getSeconds() + 1); - var call = proxy_client.clientStream(function(err, value) { + proxy_client.clientStream(function(err, value) { done(); }, null, {deadline: deadline}); }); - it.skip('With a bidi stream call', function(done) { + it('With a bidi stream call', function(done) { done = multiDone(done, 2); proxy_impl.bidiStream = function(parent) { - var child = client.bidiStream(null, {parent: parent}); + var child = client.bidiStream( + null, {parent: parent, propagate_flags: deadline_flags}); child.on('error', function(err) { assert(err); assert.strictEqual(err.code, grpc.status.DEADLINE_EXCEEDED);