Don't expect IPv6 when resolving localhost in tests

This commit is contained in:
Michael Lumish 2025-07-23 13:32:48 -07:00
parent 7360726e87
commit 1219c46815
2 changed files with 11 additions and 4 deletions

View File

@ -80,9 +80,12 @@ describe('Name Resolver', () => {
assert(
hasMatchingAddress(endpointList, { host: '127.0.0.1', port: 50051 })
);
// The new test platform doesn't resolve localhost to IPv6
/*
assert(
hasMatchingAddress(endpointList, { host: '::1', port: 50051 })
);
*/
done();
return true;
};
@ -113,7 +116,8 @@ describe('Name Resolver', () => {
assert(
hasMatchingAddress(endpointList, { host: '127.0.0.1', port: 443 })
);
assert(hasMatchingAddress(endpointList, { host: '::1', port: 443 }));
// The new test platform doesn't resolve localhost to IPv6
// assert(hasMatchingAddress(endpointList, { host: '::1', port: 443 }));
done();
return true;
};
@ -446,9 +450,12 @@ describe('Name Resolver', () => {
assert(
hasMatchingAddress(endpointList, { host: '127.0.0.1', port: 443 })
);
// The new test platform doesn't resolve localhost to IPv6
/*
assert(
hasMatchingAddress(endpointList, { host: '::1', port: 443 })
);
*/
resultCount += 1;
if (resultCount === 1) {
process.nextTick(() => resolver.updateResolution());

View File

@ -369,7 +369,7 @@ describe('Server interceptors', () => {
},
});
server.bindAsync(
'[::1]:0',
'127.0.0.1:0',
grpc.ServerCredentials.createInsecure(),
(error, port) => {
assert.ifError(error);
@ -386,8 +386,8 @@ describe('Server interceptors', () => {
it('Should get valid connection information', done => {
const call = client.sendRequest(done);
call.on('metadata', metadata => {
assert.strictEqual(metadata.get('local-address')[0], '::1');
assert.strictEqual(metadata.get('remote-address')[0], '::1');
assert.strictEqual(metadata.get('local-address')[0], '127.0.0.1');
assert.strictEqual(metadata.get('remote-address')[0], '127.0.0.1');
assert.strictEqual(metadata.get('local-port')[0], `${portNum}`);
assert.notStrictEqual(metadata.get('remote-port')[0], 'undefined');
});