summaryrefslogtreecommitdiff
path: root/internal/hexaicli/run_timeout_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/hexaicli/run_timeout_test.go')
-rw-r--r--internal/hexaicli/run_timeout_test.go8
1 files changed, 3 insertions, 5 deletions
diff --git a/internal/hexaicli/run_timeout_test.go b/internal/hexaicli/run_timeout_test.go
index 9561617..7275ddb 100644
--- a/internal/hexaicli/run_timeout_test.go
+++ b/internal/hexaicli/run_timeout_test.go
@@ -16,17 +16,15 @@ func TestRun_DefaultRequestTimeoutIsTenMinutes(t *testing.T) {
t.Setenv("XDG_CACHE_HOME", t.TempDir())
t.Setenv("HEXAI_REQUEST_TIMEOUT", "")
- oldNew := newClientFromApp
- defer func() { newClientFromApp = oldNew }()
-
seenTimeout := 0
- newClientFromApp = func(cfg appconfig.App) (llm.Client, error) {
+ clientFactory := func(cfg appconfig.App) (llm.Client, error) {
seenTimeout = cfg.RequestTimeout
return okClient{}, nil
}
var out, errb bytes.Buffer
- if err := Run(context.Background(), []string{"hello"}, strings.NewReader(""), &out, &errb); err != nil {
+ ctx := withCLIClientFactory(context.Background(), clientFactory)
+ if err := Run(ctx, []string{"hello"}, strings.NewReader(""), &out, &errb); err != nil {
t.Fatalf("Run: %v", err)
}
if seenTimeout != 600 {