Merge pull request #2980 from murgatroid99/test_newer_node_versions

Test with newer Node versions
This commit is contained in:
Michael Lumish 2025-07-23 14:48:16 -07:00 committed by GitHub
commit 259f5c9c86
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 26 additions and 17 deletions

View File

@ -76,12 +76,16 @@ describe('Name Resolver', () => {
resultSeen = true;
assert(maybeEndpointList.ok);
const endpointList = maybeEndpointList.value;
console.log(`Endpoint list: ${JSON.stringify(endpointList)}`);
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;
};
@ -108,10 +112,12 @@ describe('Name Resolver', () => {
resultSeen = true;
assert(maybeEndpointList.ok);
const endpointList = maybeEndpointList.value;
console.log(`Endpoint list: ${JSON.stringify(endpointList)}`);
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;
};
@ -440,12 +446,16 @@ describe('Name Resolver', () => {
) => {
assert(maybeEndpointList.ok);
const endpointList = maybeEndpointList.value;
console.log(`Endpoint list: ${JSON.stringify(endpointList)}`);
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());
@ -473,8 +483,10 @@ describe('Name Resolver', () => {
serviceConfig: StatusOr<ServiceConfig> | null,
resolutionNote: string
) => {
console.log(`Enpoint list: ${JSON.stringify(maybeEndpointList)}`);
assert(!maybeEndpointList.ok);
resultCount += 1;
console.log(`resultCount: ${resultCount}`);
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');
});

View File

@ -75,7 +75,7 @@ export interface ProtoGrpcType {
OperationInfo: MessageTypeDefinition<I_google_longrunning_OperationInfo, O_google_longrunning_OperationInfo>
/**
* Manages long-running operations with an API service.
*
*
* When an API method normally takes long time to complete, it can be designed
* to return [Operation][google.longrunning.Operation] to the client, and the client can use this
* interface to receive the real response asynchronously by polling the
@ -146,3 +146,4 @@ export interface ProtoGrpcType {
}
}
}

View File

@ -28,8 +28,8 @@ SET JOBS=8
call nvm version
call nvm install 16
call nvm use 16
call nvm install 22
call nvm use 22
git submodule update --init --recursive
@ -40,14 +40,12 @@ call npm install || goto :error
SET JUNIT_REPORT_STACK=1
SET FAILED=0
for %%v in (14 16) do (
for %%v in (20 22) do (
call nvm install %%v
call nvm use %%v
if "%%v"=="4" (
call npm install -g npm@5
)
@rem https://github.com/mapbox/node-pre-gyp/issues/362
call npm install -g node-gyp
node -e "console.log(process.versions)"
mkdir reports\node%%v

View File

@ -28,11 +28,11 @@ cd $ROOT
git submodule update --init --recursive
if [ ! -n "$node_versions" ] ; then
node_versions="14 16"
node_versions="20 22"
fi
set +ex
nvm install 8
nvm install 22
nvm install lts/*
nvm use lts/*
set -ex
@ -58,16 +58,14 @@ do
set +ex
echo "Switching to node version $version"
nvm install $version
nvm use $version
nvm use --delete-prefix $version
set -ex
export JUNIT_REPORT_PATH="reports/node$version/"
# https://github.com/mapbox/node-pre-gyp/issues/362
npm install -g node-gyp
mkdir -p "reports/node$version"
node -p 'process.version'
node -e 'process.exit(process.version.startsWith("v'$version'") ? 0 : -1)'
# Install dependencies and link packages together.
@ -80,7 +78,7 @@ do
done
set +ex
nvm use 8
nvm use 22
set -ex
node merge_kokoro_logs.js