Repository navigation
test(gax): add showcase harness for resumable uploads - #9288
Conversation
There was a problem hiding this comment.
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.
ec6b5de to
9c2d4d8
Compare
|
Closing to re-open on main repo as a stack. |
|
Never mind on the stack. |
9c2d4d8 to
75047c0
Compare
f28930f to
3bc696b
Compare
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.
3bc696b to
1ae0e9a
Compare
quirogas
left a comment
There was a problem hiding this comment.
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}`); | ||
| } |
There was a problem hiding this comment.
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:
- 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).
- const GRANULARITY = 256 * 1024; was dropped, causing 38 TS2304: Cannot find name 'GRANULARITY' errors when compiling core/packages/gax.
- 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.
- 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,
});
}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
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
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 thegoogle-gaxPR in this series, so merge that one first.google.showcase.v1beta1.ResumableUploadServicesample.js, which uploads a local file through a resumable sessionrun.sh, which downloads gapic-showcase, compiles the client against the localgoogle-gaxcheckout and runs the sampletest/README.md, and a.gitignoreentry for the generated protosThis is test tooling only; nothing in the published package changes.
Merge first: #9287
Related to: #9283