diff --git a/js/spec/binary-client.spec.ts b/js/spec/binary-client.spec.ts index 128121c..c28ff4d 100644 --- a/js/spec/binary-client.spec.ts +++ b/js/spec/binary-client.spec.ts @@ -113,21 +113,21 @@ describe("binary client operations", () => { }); it("can gc random-projects and return the count cleaned up", async () => { - const result = await binaryClient.gcRandomProjects(90, 2, -1, { timeout: 90 }); + const result = await binaryClient.gcRandomProjects(90, 2, -1, { timeout: 1_000 }); expect(JSON.stringify(result)).toMatch('{"count":0}'); expect(result.count).toStrictEqual(0); }); it("can gc a specific project and return the count cleaned up", async () => { - const result = await binaryClient.gcProject(1, 2, -1, { timeout: 90 }); + const result = await binaryClient.gcProject(1, 2, -1, { timeout: 1_000 }); expect(JSON.stringify(result)).toMatch('{"count":0}'); expect(result.count).toStrictEqual(0); }); it("can gc contents and successfully return the count of contents cleaned up", async () => { - const result = await binaryClient.gcContents(90, { timeout: 90 }); + const result = await binaryClient.gcContents(90, { timeout: 1_000 }); expect(JSON.stringify(result)).toMatch('{"count":0}'); expect(result.count).toStrictEqual(0); @@ -139,7 +139,7 @@ describe("binary client operations", () => { await grpcClient.newProject(project, []); const stream = grpcClient.updateObjects(project); - for (let i = 0; i < 1000; i++) { + for (let i = 0; i < 30; i++) { const content = encodeContent(crypto.randomBytes(512 * 1024).toString("hex")); await stream.send({ path: `hello-${i}.txt`, @@ -152,9 +152,9 @@ describe("binary client operations", () => { await stream.complete(); const dir = tmpdir(); - const rebuildPromise = binaryClient.rebuild(project, null, dir, { timeout: 1 }); + const rebuildPromise = binaryClient.rebuild(project, null, dir, { timeout: 25 }); await expect(rebuildPromise).rejects.toThrow(/context deadline exceeded/); - }, 20_000); + }); }); describe("Gadget file match tests", () => { diff --git a/pkg/cli/client.go b/pkg/cli/client.go index 7da1125..8cf41ff 100644 --- a/pkg/cli/client.go +++ b/pkg/cli/client.go @@ -34,7 +34,7 @@ func NewClientCommand() *cobra.Command { otelContext string host string port uint16 - timeout uint16 + timeout uint headlessHost string ) @@ -63,7 +63,7 @@ func NewClientCommand() *cobra.Command { fmt.Fprintf(os.Stderr, "timeout: %v\n", timeout) if timeout != 0 { - ctx, cancel = context.WithTimeout(cmd.Context(), time.Duration(timeout)*time.Second) + ctx, cancel = context.WithTimeout(cmd.Context(), time.Duration(timeout)*time.Millisecond) fmt.Fprintf(os.Stderr, "duration: %v\n", time.Duration(timeout)*time.Second) } @@ -115,7 +115,7 @@ func NewClientCommand() *cobra.Command { flags.StringVar(&otelContext, "otel-context", "", "Open Telemetry context") flags.StringVar(&host, "host", "", "GRPC server hostname") flags.Uint16Var(&port, "port", 5051, "GRPC server port") - flags.Uint16Var(&timeout, "timeout", 0, "GRPC client timeout") + flags.UintVar(&timeout, "timeout", 0, "GRPC client timeout (ms)") flags.StringVar(&headlessHost, "headless-host", "", "Alternative headless hostname to use for round robin connections") cmd.AddCommand(NewCmdGet())