MCPcopy Index your code
hub / github.com/coder/coder / newChatTestOptions

Function newChatTestOptions

coderd/exp_chats_test.go:71–89  ·  view source on GitHub ↗

newChatTestOptions builds coderdtest options for chat runtime tests. Unless a test sets ChatProviderAPIKeys explicitly, it installs a fake OpenAI-compatible provider before coderd starts so background chat work stays local, and the fake server outlives chatd during cleanup.

(
	t testing.TB,
	values *codersdk.DeploymentValues,
	overrides ...func(*coderdtest.Options),
)

Source from the content-addressed store, hash-verified

69// OpenAI-compatible provider before coderd starts so background chat work stays
70// local, and the fake server outlives chatd during cleanup.
71func newChatTestOptions(
72 t testing.TB,
73 values *codersdk.DeploymentValues,
74 overrides ...func(*coderdtest.Options),
75) *coderdtest.Options {
76 t.Helper()
77
78 opts := &coderdtest.Options{
79 DeploymentValues: values,
80 }
81 for _, override := range overrides {
82 override(opts)
83 }
84 if opts.ChatProviderAPIKeys == nil {
85 providerKeys := coderdtest.FakeOpenAICompatProviderAPIKeys(t)
86 opts.ChatProviderAPIKeys = &providerKeys
87 }
88 return opts
89}
90
91func newChatClient(t testing.TB, overrides ...func(*coderdtest.Options)) *codersdk.ExperimentalClient {
92 t.Helper()

Callers 5

newChatClientFunction · 0.85
newChatClientWithAPIFunction · 0.85

Calls 2

HelperMethod · 0.65

Tested by

no test coverage detected