Skip to content

Commit bc38711

Browse files
author
Mateusz
committed
test: assert candidate-aware client options
1 parent 3fd6d31 commit bc38711

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

internal/plugins/backends/openaicompat/backend_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,9 @@ func TestNewBackend_forwardsRequestAndClientOptions(t *testing.T) {
129129
})
130130

131131
spec := validBackendSpec(srv.URL)
132-
spec.ClientOptions = func(lipapi.Call, routing.AttemptCandidate) []option.RequestOption {
132+
var gotCand routing.AttemptCandidate
133+
spec.ClientOptions = func(_ lipapi.Call, cand routing.AttemptCandidate) []option.RequestOption {
134+
gotCand = cand
133135
return []option.RequestOption{option.WithHeader("X-Test-Client", "yes")}
134136
}
135137
spec.RequestOptions = func(lipapi.Call) []option.RequestOption {
@@ -149,6 +151,9 @@ func TestNewBackend_forwardsRequestAndClientOptions(t *testing.T) {
149151
if header != "yes" {
150152
t.Fatalf("client header = %q", header)
151153
}
154+
if gotCand.Primary.Model != "gpt-test" {
155+
t.Fatalf("candidate model = %q, want gpt-test", gotCand.Primary.Model)
156+
}
152157
body := rec.lastBody(t)
153158
if !strings.Contains(string(body), `"max_tokens":19`) {
154159
t.Fatalf("request option not applied body=%s", string(body))

0 commit comments

Comments
 (0)