Fix a couple of issues with tests on Windows

This commit is contained in:
Michael Lumish 2021-12-08 15:23:06 -05:00
parent d5ce784348
commit e41b99dffc
2 changed files with 6 additions and 3 deletions

View File

@ -79,7 +79,8 @@ describe('Client without a server', () => {
after(() => { after(() => {
client.close(); client.close();
}); });
it('should fail multiple calls to the nonexistent server', done => { it('should fail multiple calls to the nonexistent server', function(done) {
this.timeout(5000);
// Regression test for https://github.com/grpc/grpc-node/issues/1411 // Regression test for https://github.com/grpc/grpc-node/issues/1411
client.makeUnaryRequest('/service/method', x => x, x => x, Buffer.from([]), (error, value) => { client.makeUnaryRequest('/service/method', x => x, x => x, Buffer.from([]), (error, value) => {
assert(error); assert(error);

View File

@ -61,7 +61,9 @@ const serviceImpl = {
describe(`${anyGrpc.clientName} client -> ${anyGrpc.serverName} server`, function() { describe(`${anyGrpc.clientName} client -> ${anyGrpc.serverName} server`, function() {
it('client should not wait for ready by default', function(done) { it('client should not wait for ready by default', function(done) {
this.timeout(15000); this.timeout(15000);
const disconnectedClient = new TestServiceClient('foo.test.google.com:50051', clientGrpc.credentials.createInsecure()); /* TCP port 47 is reserved according to
* https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers */
const disconnectedClient = new TestServiceClient('localhost:47', clientGrpc.credentials.createInsecure());
const deadline = new Date(); const deadline = new Date();
deadline.setSeconds(deadline.getSeconds() + 10); deadline.setSeconds(deadline.getSeconds() + 10);
disconnectedClient.unary({}, {deadline: deadline}, (error, value) =>{ disconnectedClient.unary({}, {deadline: deadline}, (error, value) =>{
@ -72,7 +74,7 @@ describe(`${anyGrpc.clientName} client -> ${anyGrpc.serverName} server`, functio
}); });
it('client should wait for a connection with waitForReady on', function(done) { it('client should wait for a connection with waitForReady on', function(done) {
this.timeout(15000); this.timeout(15000);
const disconnectedClient = new TestServiceClient('foo.test.google.com:50051', clientGrpc.credentials.createInsecure()); const disconnectedClient = new TestServiceClient('localhost:47', clientGrpc.credentials.createInsecure());
const metadata = new clientGrpc.Metadata({waitForReady: true}); const metadata = new clientGrpc.Metadata({waitForReady: true});
const deadline = new Date(); const deadline = new Date();
deadline.setSeconds(deadline.getSeconds() + 10); deadline.setSeconds(deadline.getSeconds() + 10);