MCPcopy Index your code
hub / github.com/docker/docker-agent / TestAutoModelFallbackError

Function TestAutoModelFallbackError

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

Source from the content-addressed store, hash-verified

439}
440
441func TestAutoModelFallbackError(t *testing.T) {
442 if runtime.GOOS == "windows" {
443 t.Skip("Skipping docker CLI shim test on Windows")
444 }
445
446 tempDir := t.TempDir()
447 dockerPath := filepath.Join(tempDir, "docker")
448 script := "#!/bin/sh\n" +
449 "printf 'unknown flag: --json\\n\\nUsage: docker [OPTIONS] COMMAND [ARG...]\\n\\nRun '\\''docker --help'\\'' for more information\\n' >&2\n" +
450 "exit 1\n"
451 require.NoError(t, os.WriteFile(dockerPath, []byte(script), 0o755))
452
453 t.Setenv("PATH", tempDir+string(os.PathListSeparator)+os.Getenv("PATH"))
454 t.Setenv("MODEL_RUNNER_HOST", "")
455
456 agentSource, err := config.Resolve("testdata/auto-model.yaml", nil)
457 require.NoError(t, err)
458
459 // Use noEnvProvider to ensure no API keys are available,
460 // so DMR is the only fallback option.
461 runConfig := &config.RuntimeConfig{
462 EnvProviderForTests: &noEnvProvider{},
463 }
464
465 _, err = Load(t.Context(), agentSource, runConfig, withTestProviderRegistry()...)
466 require.Error(t, err)
467
468 var autoErr *config.AutoModelFallbackError
469 require.ErrorAs(t, err, &autoErr, "expected AutoModelFallbackError when auto model selection fails")
470}
471
472func TestIsThinkingBudgetDisabled(t *testing.T) {
473 t.Parallel()

Callers

nothing calls this directly

Calls 5

ResolveFunction · 0.92
withTestProviderRegistryFunction · 0.85
ContextMethod · 0.80
LoadFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected