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)
| 133 | // gateway loader so MCP `ref:` toolsets in the examples don't trigger a live |
| 134 | // catalog fetch. |
| 135 | func 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 | |
| 158 | func TestLoadDefaultAgent(t *testing.T) { |
| 159 | t.Setenv("HOME", t.TempDir()) |
no test coverage detected