MCPcopy
hub / github.com/docker/docker-agent / TestOverrideModel

Function TestOverrideModel

pkg/teamloader/teamloader_test.go:175–216  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

173}
174
175func TestOverrideModel(t *testing.T) {
176 tests := []struct {
177 overrides []string
178 expected string
179 expectedErr string
180 }{
181 {
182 overrides: []string{"anthropic/claude-4-6"},
183 expected: "anthropic/claude-4-6",
184 },
185 {
186 overrides: []string{"root=anthropic/claude-4-6"},
187 expected: "anthropic/claude-4-6",
188 },
189 {
190 overrides: []string{"missing=anthropic/claude-4-6"},
191 expectedErr: "unknown agent 'missing'",
192 },
193 }
194
195 t.Setenv("OPENAI_API_KEY", "asdf")
196 t.Setenv("ANTHROPIC_API_KEY", "asdf")
197
198 for _, test := range tests {
199 t.Run(test.expected, func(t *testing.T) {
200 t.Parallel()
201
202 agentSource, err := config.Resolve("testdata/basic.yaml", nil)
203 require.NoError(t, err)
204
205 team, err := Load(t.Context(), agentSource, &config.RuntimeConfig{}, withTestProviderRegistry(WithModelOverrides(test.overrides))...)
206 if test.expectedErr != "" {
207 require.Contains(t, err.Error(), test.expectedErr)
208 } else {
209 require.NoError(t, err)
210 rootAgent, err := team.Agent("root")
211 require.NoError(t, err)
212 require.Equal(t, test.expected, rootAgent.Model(t.Context()).ID().String())
213 }
214 })
215 }
216}
217
218func TestTitleModelResolution(t *testing.T) {
219 t.Setenv("OPENAI_API_KEY", "dummy")

Callers

nothing calls this directly

Calls 11

ResolveFunction · 0.92
withTestProviderRegistryFunction · 0.85
WithModelOverridesFunction · 0.85
ContextMethod · 0.80
AgentMethod · 0.80
ModelMethod · 0.80
LoadFunction · 0.70
RunMethod · 0.65
IDMethod · 0.65
ErrorMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected