(t *testing.T)
| 442 | } |
| 443 | |
| 444 | func TestLoad_ExpandsEnvVarsInYAML(t *testing.T) { |
| 445 | t.Setenv("OPENAI_API_KEY", "sk-from-env") |
| 446 | cfgPath := writeTempConfig(t, ` |
| 447 | server: |
| 448 | port: 8080 |
| 449 | backends: |
| 450 | - name: oa |
| 451 | type: openai_compatible |
| 452 | endpoint: https://api.example.com |
| 453 | timeout_ms: 100 |
| 454 | api_key: ${OPENAI_API_KEY} |
| 455 | health_path: /v1/models |
| 456 | default_model: gpt-4o-mini |
| 457 | cost: { unit: 1, currency: credit } |
| 458 | capabilities: [chat] |
| 459 | tenants: |
| 460 | - id: t1 |
| 461 | routing: |
| 462 | default_backend: oa |
| 463 | reliability: |
| 464 | fallback_enabled: false |
| 465 | `) |
| 466 | |
| 467 | cfg, err := Load(cfgPath) |
| 468 | if err != nil { |
| 469 | t.Fatalf("expected config to load: %v", err) |
| 470 | } |
| 471 | if cfg.Backends[0].APIKey != "sk-from-env" { |
| 472 | t.Fatalf("api_key after expand: %q", cfg.Backends[0].APIKey) |
| 473 | } |
| 474 | } |
| 475 | |
| 476 | func TestLoad_ServerHTTPTimeoutsNegative(t *testing.T) { |
| 477 | cfgPath := writeTempConfig(t, ` |
nothing calls this directly
no test coverage detected