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

Function gatherExampleEnvVars

pkg/teamloader/teamloader_test.go:135–156  ·  view source on GitHub ↗

gatherExampleEnvVars returns the union of env vars referenced by the given example files (both for models and toolsets). The set is collected up-front so t.Setenv can be called before any subtest starts. It uses a static gateway loader so MCP `ref:` toolsets in the examples don't trigger a live cata

(t *testing.T, examples []string)

Source from the content-addressed store, hash-verified

133// gateway loader so MCP `ref:` toolsets in the examples don't trigger a live
134// catalog fetch.
135func gatherExampleEnvVars(t *testing.T, examples []string) map[string]bool {
136 t.Helper()
137
138 ctx := catalogContext(t)
139 envs := make(map[string]bool)
140 for _, agentFilename := range examples {
141 agentSource, err := config.Resolve(agentFilename, nil)
142 require.NoError(t, err)
143
144 cfg, err := config.Load(ctx, agentSource)
145 require.NoError(t, err)
146
147 for _, env := range config.GatherEnvVarsForModels(ctx, cfg, environment.NewOsEnvProvider()) {
148 envs[env] = true
149 }
150 toolEnvs, _ := config.GatherEnvVarsForTools(ctx, cfg)
151 for _, env := range toolEnvs {
152 envs[env] = true
153 }
154 }
155 return envs
156}
157
158func TestLoadDefaultAgent(t *testing.T) {
159 t.Setenv("HOME", t.TempDir())

Callers 1

TestLoadExamplesFunction · 0.85

Calls 6

ResolveFunction · 0.92
LoadFunction · 0.92
GatherEnvVarsForModelsFunction · 0.92
NewOsEnvProviderFunction · 0.92
GatherEnvVarsForToolsFunction · 0.92
catalogContextFunction · 0.85

Tested by

no test coverage detected