MCPcopy Create free account
hub / github.com/astercloud/aster / TestLoadAgentConfig

Function TestLoadAgentConfig

pkg/config/loader_test.go:192–225  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

190}
191
192func TestLoadAgentConfig(t *testing.T) {
193 // Create a temp file
194 tmpDir := t.TempDir()
195 configPath := filepath.Join(tmpDir, "agent.yaml")
196
197 configContent := `
198template_id: "test-template"
199template_version: "1.0.0"
200model_config:
201 provider: "anthropic"
202 model: "claude-3-5-sonnet"
203`
204
205 err := os.WriteFile(configPath, []byte(configContent), 0644)
206 if err != nil {
207 t.Fatalf("failed to write test config: %v", err)
208 }
209
210 loader := NewLoader()
211 config, err := loader.LoadAgentConfig(configPath)
212 if err != nil {
213 t.Fatalf("LoadAgentConfig failed: %v", err)
214 }
215
216 if config.TemplateID != "test-template" {
217 t.Errorf("expected template_id 'test-template', got %q", config.TemplateID)
218 }
219 if config.TemplateVersion != "1.0.0" {
220 t.Errorf("expected template_version '1.0.0', got %q", config.TemplateVersion)
221 }
222 if config.ModelConfig.Provider != "anthropic" {
223 t.Errorf("expected provider 'anthropic', got %q", config.ModelConfig.Provider)
224 }
225}
226
227func TestLoadAgentConfigWithEnvVars(t *testing.T) {
228 _ = os.Setenv("TEST_API_KEY", "sk-env-key")

Callers

nothing calls this directly

Calls 3

LoadAgentConfigMethod · 0.95
NewLoaderFunction · 0.70
JoinMethod · 0.45

Tested by

no test coverage detected