Skip to content

ci: upgrade CI containers to Node 22 and make retry-request unit tests hermetic - #9704

Open
quirogas wants to merge 2 commits into
googleapis:mainfrom
quirogas:ci-node22-hermetic-retry-request
Open

quirogas wants to merge 2 commits into
googleapis:mainfrom
quirogas:ci-node22-hermetic-retry-request

Conversation

@quirogas

Copy link
Copy Markdown
Contributor

Description

This change upgrades CI configurations to Node 22 and isolates unit tests.

Impact

Eliminates EOL Node runtimes in CI and removes external test network calls.

Changes

  • Upgrade ci/cloudbuild_with_credentials.yaml from _NODE_VERSION: "18" to "22", add default _REPO_OWNER and _REPO_NAME substitutions, add --pull to docker build, and add id: 'Fetch Credentials' with waitFor: ['Fetch Credentials'] on run-tests to prevent a parallel race condition when writing /workspace/google_application_credentials.json.
  • Update the default ARG NODE_VERSION in ci/Dockerfile from 16 to 22, and add --pull to docker build in ci/cloudbuild.yaml and ci/cloudbuild_with_gapic_showcase.yaml.
  • Update the Node.js version matrix in .github/workflows/bigtable-conformance.yaml and .github/workflows/mandatory-conformance.yaml from [ 20, 22 ] to [ 22, 24 ].
  • Replace unmocked external HTTP calls (http://google.com/ and http://theblahstore) in core/packages/retry-request/test.js with a local ephemeral http.createServer listening on 127.0.0.1:0 so unit tests are 100% hermetic.
  • Update remaining .kokoro/**/*.cfg TRAMPOLINE_IMAGE references in core/*/.kokoro/ and handwritten/*/.kokoro/ from node:18-user and node:14-user to node:22-user.

Testing

  • Replaced live external requests in core/packages/retry-request/test.js with a local ephemeral HTTP server in before/after hooks (URI_200, URI_404, and URI_NON_EXISTENT).
  • Verified all 30 unit tests and gts check linter pass locally in core/packages/retry-request.

Alternatives

  • Not merging this PR was considered, but it would leave credentialed Cloud Build triggers and conformance workflows running on EOL Node.js versions and keep retry-request unit tests dependent on external network reachability.

…s hermetic

## Description

This change upgrades CI configurations to Node 22 and isolates unit tests.

## Impact

Eliminates EOL Node runtimes in CI and removes external test network calls.

## Changes

- Upgrade `ci/cloudbuild_with_credentials.yaml` from `_NODE_VERSION: "18"` to `"22"`, add default `_REPO_OWNER` and `_REPO_NAME` substitutions, add `--pull` to `docker build`, and add `id: 'Fetch Credentials'` with `waitFor: ['Fetch Credentials']` on `run-tests` to prevent a parallel race condition when writing `/workspace/google_application_credentials.json`.
- Update the default `ARG NODE_VERSION` in `ci/Dockerfile` from `16` to `22`, and add `--pull` to `docker build` in `ci/cloudbuild.yaml` and `ci/cloudbuild_with_gapic_showcase.yaml`.
- Update the Node.js version matrix in `.github/workflows/bigtable-conformance.yaml` and `.github/workflows/mandatory-conformance.yaml` from `[ 20, 22 ]` to `[ 22, 24 ]`.
- Replace unmocked external HTTP calls (`http://google.com/` and `http://theblahstore`) in `core/packages/retry-request/test.js` with a local ephemeral `http.createServer` listening on `127.0.0.1:0` so unit tests are 100% hermetic.
- Update remaining `.kokoro/**/*.cfg` `TRAMPOLINE_IMAGE` references in `core/*/.kokoro/` and `handwritten/*/.kokoro/` from `node:18-user` and `node:14-user` to `node:22-user`.

## Testing

- Replaced live external requests in `core/packages/retry-request/test.js` with a local ephemeral HTTP server in `before`/`after` hooks (`URI_200`, `URI_404`, and `URI_NON_EXISTENT`).
- Verified all 30 unit tests and `gts check` linter pass locally in `core/packages/retry-request`.

## Alternatives

- Not merging this PR was considered, but it would leave credentialed Cloud Build triggers and conformance workflows running on EOL Node.js versions and keep `retry-request` unit tests dependent on external network reachability.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request upgrades the Node.js version to 22 across Dockerfiles, Cloud Build configurations, and Kokoro CI configurations. Additionally, it refactors the retry-request tests to use a local HTTP server for mocking endpoints instead of external URLs. The review feedback recommends utilizing server.closeAllConnections() in the test teardown to immediately terminate active keep-alive connections and prevent potential hangs.

Comment thread core/packages/retry-request/test.js
@quirogas
quirogas marked this pull request as ready for review October 23, 2026 22:22
@quirogas
quirogas requested review from a team as code owners October 23, 2026 22:22
@quirogas
quirogas enabled auto-merge (squash) October 23, 2026 22:23
@github-actions
github-actions Bot requested a review from shivanee-p October 23, 2026 22:23
@quirogas
quirogas disabled auto-merge October 23, 2026 22:23

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant