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

Function newTestAPIWithOptions

agent/agentproc/api_test.go:133–144  ·  view source on GitHub ↗

newTestAPIWithOptions creates a new API with optional updateEnv and workingDir hooks.

(t *testing.T, updateEnv func([]string) ([]string, error), workingDir func() string)

Source from the content-addressed store, hash-verified

131// newTestAPIWithOptions creates a new API with optional
132// updateEnv and workingDir hooks.
133func newTestAPIWithOptions(t *testing.T, updateEnv func([]string) ([]string, error), workingDir func() string) http.Handler {
134 t.Helper()
135
136 logger := slogtest.Make(t, &slogtest.Options{
137 IgnoreErrors: true,
138 }).Leveled(slog.LevelDebug)
139 api := agentproc.NewAPI(logger, agentexec.DefaultExecer, updateEnv, nil, workingDir)
140 t.Cleanup(func() {
141 _ = api.Close()
142 })
143 return agentchat.Middleware(api.Routes())
144}
145
146func TestAccessLogIncludesChatID(t *testing.T) {
147 t.Parallel()

Callers 3

newTestAPIFunction · 0.85
newTestAPIWithUpdateEnvFunction · 0.85
TestStartProcessFunction · 0.85

Calls 6

CloseMethod · 0.95
RoutesMethod · 0.95
NewAPIFunction · 0.92
MiddlewareFunction · 0.92
HelperMethod · 0.65
CleanupMethod · 0.65

Tested by

no test coverage detected