From c3041e8b9ac7d7a1de04cb25241aa5e46bcdaa5a Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 30 May 2019 18:05:42 -0700 Subject: [PATCH] Test that waitForReady option changes default behavior --- packages/grpc-native-core/test/surface_test.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/grpc-native-core/test/surface_test.js b/packages/grpc-native-core/test/surface_test.js index d5b7add5..c6f121fd 100644 --- a/packages/grpc-native-core/test/surface_test.js +++ b/packages/grpc-native-core/test/surface_test.js @@ -934,6 +934,19 @@ describe('Other conditions', function() { call.write({}); call.end(); }); + it('client should wait for ready by default', function(done) { + this.timeout(15000); + const disconnectedClient = new Client('foo.test.google.com:50051', grpc.credentials.createInsecure()); + const metadata = new grpc.Metadata({waitForReady: false}); + const deadline = new Date(); + deadline.setSeconds(deadline.getSeconds() + 10); + disconnectedClient.unary({}, metadata, {deadline: deadline}, (error, value) =>{ + assert(error); + assert.strictEqual(error.code, grpc.status.DEADLINE_EXCEEDED); + done(); + }); + + }); it('client should drop a call if not connected with waitForReady off', function(done) { /* We have to wait for the client to reach the first connection timeout * and go to TRANSIENT_FAILURE to confirm that the waitForReady option