Skip to content

test(gax): add showcase harness for resumable uploads - #9288

Merged
feywind merged 6 commits into
googleapis:mainfrom
feywind:resumable/gax-showcase
Sep 24, 2026
Merged

feywind merged 6 commits into
googleapis:mainfrom
feywind:resumable/gax-showcase

Conversation

@feywind

@feywind feywind commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Adds an end-to-end harness for the gapic-showcase ResumableUploadService, so the resumable upload client path can be exercised against a real server. It uses the resumable upload support from the google-gax PR in this series, so merge that one first.

  • checked-in generated client for google.showcase.v1beta1.ResumableUploadService
  • sample.js, which uploads a local file through a resumable session
  • run.sh, which downloads gapic-showcase, compiles the client against the local google-gax checkout and runs the sample
  • harness README plus a pointer from test/README.md, and a .gitignore entry for the generated protos

This is test tooling only; nothing in the published package changes.

Merge first: #9287
Related to: #9283

@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 implements client-side support for the resumable upload protocol in google-gax, introducing the ResumableUploadSession state machine, file-backed seekable sources, and a showcase test harness. Feedback on the changes highlights an incorrect throughput constant (DEFAULT_UPLOAD_RATE_BYTES_PER_MS) that scales to gigabytes instead of megabytes per millisecond, as well as documentation examples in client-libraries.md that incorrectly reference uploadStream instead of uploadSource.

Comment thread core/packages/gax/src/resumableUpload.ts Outdated
Comment thread core/packages/gax/client-libraries.md
Comment thread core/packages/gax/client-libraries.md
@feywind
feywind force-pushed the resumable/gax-showcase branch from ec6b5de to 9c2d4d8 Compare September 22, 2026 18:49
@feywind
feywind changed the base branch from main to resumable/gax-showcase September 22, 2026 18:50
@feywind
feywind changed the base branch from resumable/gax-showcase to resumable/gax September 22, 2026 18:50
@feywind

feywind commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

Closing to re-open on main repo as a stack.

@feywind feywind closed this Sep 22, 2026
@feywind feywind reopened this Sep 22, 2026
@feywind
feywind marked this pull request as ready for review September 22, 2026 19:17
@feywind
feywind requested a review from a team as a code owner September 22, 2026 19:17
@feywind

feywind commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

Never mind on the stack.

@github-actions
github-actions Bot requested a review from bshaffer September 22, 2026 19:36
@feywind
feywind force-pushed the resumable/gax-showcase branch from 9c2d4d8 to 75047c0 Compare September 23, 2026 17:56
@feywind
feywind requested review from a team as code owners September 23, 2026 19:32
@feywind
feywind changed the base branch from resumable/gax to main September 23, 2026 19:32
@feywind
feywind force-pushed the resumable/gax-showcase branch from f28930f to 3bc696b Compare September 23, 2026 20:51
Adds an end-to-end harness for the gapic-showcase ResumableUploadService:
a checked-in generated client, a sample that uploads a local file through
a resumable session, and a run.sh that downloads the showcase server,
compiles the client against the local google-gax checkout and runs the
sample. Also documents the harness in test/README.md and ignores the
protos it generates.
The checked-in generated client is linted and type-checked as its own
package, but CI installs the published google-gax (which does not have the
resumable upload APIs yet) and never compiles protos/protos, so the client
reported 12 type errors plus a promise/always-return error on every run.

Treat it as a fixture instead:

- move client/ to fixtures/, a path segment the monorepo linter ignores
- rename its tsconfig.json to tsconfig.client.json, so the package
  detection walks up to google-gax's tsconfig and skips these files
- update run.sh, sample.js, the client package.json and the harness README

Verified by running the harness's own compile steps (compileProtos plus
tsc -p tsconfig.client.json) against the local google-gax checkout.
@feywind
feywind force-pushed the resumable/gax-showcase branch from 3bc696b to 1ae0e9a Compare September 23, 2026 21:12

@quirogas quirogas 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.

Approving so this is not blocked! Left a few inline comments on sample.ts (fixing a small rebase splice so compile and the showcase run pass) plus a couple of quick nits.

}
if (!fs.existsSync(filePath)) {
throw new Error(`Upload file does not exist: ${filePath}`);
}

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.

It looks like a rebase or merge conflict in sample.ts left a few syntax and wiring issues that currently break npm run compile, the linter, and the instrumented auth checks at runtime:

  1. Lines 33-41 have an unclosed async function main() { stub left over from the earlier JS version (the real async function main(): Promise is at line 1133).
  2. const GRANULARITY = 256 * 1024; was dropped, causing 38 TS2304: Cannot find name 'GRANULARITY' errors when compiling core/packages/gax.
  3. In createClient() (lines 132-148), the closing } brace is missing, and lines 145-147 pass a fresh new GoogleAuth(...) instead of the auth variable computed on lines 136-140. Passing auth is needed so createInstrumentedAuth() in Tests 3, 4, 5, 6, and 8 records the request log and runs the stallAuth hook.
  4. Lines 172 and 192 in runBaselineUpload() need trailing commas to satisfy Prettier.

Replacing lines 33-41 with const GRANULARITY = 256 * 1024; and updating createClient() as follows fixes compilation and makes the instrumented auth log assertions work:

function createClient(
  port: number,
  customAuth?: GoogleAuth,
): ShowcaseResumableUploadClient {
  const auth =
    customAuth ??
    new GoogleAuth({
      authClient: new googleAuthLibrary.PassThroughClient(),
    });
  return new ResumableUploadServiceClient({
    servicePath: '127.0.0.1',
    port,
    protocol: 'http',
    auth,
  });
}

Comment thread core/packages/gax/test/showcase-resumable-upload/sample.ts Outdated
Comment thread core/packages/gax/test/showcase-resumable-upload/README.md Outdated
Comment thread core/packages/gax/tsconfig.json
Comment thread core/packages/gax/test/showcase-resumable-upload/run.sh
Comment thread core/packages/gax/test/README.md Outdated
Comment thread core/packages/gax/test/showcase-resumable-upload/sample.ts
@feywind
feywind merged commit a428628 into googleapis:main Sep 24, 2026
50 checks passed
@feywind
feywind deleted the resumable/gax-showcase branch September 24, 2026 18:26
feywind added a commit to feywind/google-cloud-node that referenced this pull request Sep 24, 2026
Adds an end-to-end harness for the gapic-showcase
`ResumableUploadService`, so the resumable upload client path can be
exercised against a real server. It uses the resumable upload support
from the `google-gax` PR in this series, so merge that one first.

- checked-in generated client for
`google.showcase.v1beta1.ResumableUploadService`
- `sample.js`, which uploads a local file through a resumable session
- `run.sh`, which downloads gapic-showcase, compiles the client against
the local `google-gax` checkout and runs the sample
- harness README plus a pointer from `test/README.md`, and a
`.gitignore` entry for the generated protos

This is test tooling only; nothing in the published package changes.

Merge first: googleapis#9287
Related to: googleapis#9283
danieljbruce pushed a commit that referenced this pull request Sep 29, 2026
Adds an end-to-end harness for the gapic-showcase
`ResumableUploadService`, so the resumable upload client path can be
exercised against a real server. It uses the resumable upload support
from the `google-gax` PR in this series, so merge that one first.

- checked-in generated client for
`google.showcase.v1beta1.ResumableUploadService`
- `sample.js`, which uploads a local file through a resumable session
- `run.sh`, which downloads gapic-showcase, compiles the client against
the local `google-gax` checkout and runs the sample
- harness README plus a pointer from `test/README.md`, and a
`.gitignore` entry for the generated protos

This is test tooling only; nothing in the published package changes.

Merge first: #9287
Related to: #9283
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.

2 participants