diff --git a/src/node/interop/interop_client.js b/src/node/interop/interop_client.js index 402843162e021660f0b8b72e68d9a1eb4f0c6c40..80f811901cacfaf601974873131f9f9761c2b0f1 100644 --- a/src/node/interop/interop_client.js +++ b/src/node/interop/interop_client.js @@ -263,6 +263,19 @@ function cancelAfterFirstResponse(client, done) { }); } +function timeoutOnSleepingServer(client, done) { + var deadline = new Date(); + deadline.setMilliseconds(deadline.getMilliseconds() + 1); + var call = client.fullDuplexCall(null, deadline); + call.write({ + payload: {body: zeroBuffer(27182)} + }); + call.on('error', function(error) { + assert.strictEqual(error.code, grpc.status.DEADLINE_EXCEEDED); + done(); + }); +} + /** * Run one of the authentication tests. * @param {string} expected_user The expected username in the response @@ -315,6 +328,7 @@ var test_cases = { empty_stream: emptyStream, cancel_after_begin: cancelAfterBegin, cancel_after_first_response: cancelAfterFirstResponse, + timeout_on_sleeping_server: timeoutOnSleepingServer, compute_engine_creds: _.partial(authTest, COMPUTE_ENGINE_USER, null), service_account_creds: _.partial(authTest, AUTH_USER, AUTH_SCOPE), jwt_token_creds: _.partial(authTest, AUTH_USER, null) diff --git a/src/node/test/interop_sanity_test.js b/src/node/test/interop_sanity_test.js index 6b3aa3dd842a42180e370b63e978e36bc68fa03b..fcd8eb6403dd8fd59358fccfa92ebde72c198b23 100644 --- a/src/node/test/interop_sanity_test.js +++ b/src/node/test/interop_sanity_test.js @@ -86,4 +86,8 @@ describe('Interop tests', function() { interop_client.runTest(port, name_override, 'cancel_after_first_response', true, true, done); }); + it('should pass timeout_on_sleeping_server', function(done) { + interop_client.runTest(port, name_override, 'timeout_on_sleeping_server', + true, true, done); + }); });