MCPcopy Create free account
hub / github.com/InferCore/InferCore / TestLoad_ValidConfig

Function TestLoad_ValidConfig

internal/config/config_test.go:24–61  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

22}
23
24func TestLoad_ValidConfig(t *testing.T) {
25 cfgPath := writeTempConfig(t, `
26server:
27 port: 8080
28backends:
29 - name: b1
30 type: mock
31 timeout_ms: 100
32 cost: { unit: 1, currency: credit }
33 capabilities: [chat]
34tenants:
35 - id: t1
36 class: premium
37 priority: high
38routing:
39 default_backend: b1
40reliability:
41 fallback_enabled: true
42 fallback_rules: []
43`)
44
45 cfg, err := Load(cfgPath)
46 if err != nil {
47 t.Fatalf("expected config to load, got error: %v", err)
48 }
49 if cfg.Routing.DefaultBackend != "b1" {
50 t.Fatalf("unexpected default backend: %s", cfg.Routing.DefaultBackend)
51 }
52 if cfg.Telemetry.Exporter != "log" {
53 t.Fatalf("expected default telemetry exporter log, got %s", cfg.Telemetry.Exporter)
54 }
55 if cfg.Server.HealthCacheTTLMS != 2000 {
56 t.Fatalf("expected default health_cache_ttl_ms 2000, got %d", cfg.Server.HealthCacheTTLMS)
57 }
58 if cfg.Server.HealthCheckPerMS != 1500 {
59 t.Fatalf("expected default health_check_per_backend_ms 1500, got %d", cfg.Server.HealthCheckPerMS)
60 }
61}
62
63func TestLoad_DuplicateBackendName(t *testing.T) {
64 cfgPath := writeTempConfig(t, `

Callers

nothing calls this directly

Calls 2

writeTempConfigFunction · 0.85
LoadFunction · 0.85

Tested by

no test coverage detected