It's state, not config.

This commit is contained in:
2026-07-10 05:21:03 +00:00
parent 4feaa63da0
commit 5c26c7530a
18 changed files with 184 additions and 216 deletions

View File

@@ -75,10 +75,12 @@ func TestReconciliation_HAProxyConfigFromServices(t *testing.T) {
})
case services.BackendHTTP:
httpRoutes = append(httpRoutes, haproxy.HTTPRoute{
Name: svc.Domain,
Domain: svc.Domain,
Backend: svc.Backend.Address,
HealthPath: svc.Backend.Health,
Name: svc.Domain,
Domain: svc.Domain,
Routes: []haproxy.HTTPRouteBackend{{
Backend: svc.Backend.Address,
HealthPath: svc.Backend.Health,
}},
})
}
}
@@ -88,7 +90,6 @@ func TestReconciliation_HAProxyConfigFromServices(t *testing.T) {
Domain: "central.payne.io",
Source: "central",
Backend: services.Backend{Address: "127.0.0.1:5055", Type: services.BackendHTTP},
// Public defaults to false
TLS: services.TLSTerminate,
}); err != nil {
t.Fatalf("Register central failed: %v", err)
@@ -102,10 +103,12 @@ func TestReconciliation_HAProxyConfigFromServices(t *testing.T) {
for _, svc := range svcs {
if svc.Backend.Type == services.BackendHTTP {
httpRoutes = append(httpRoutes, haproxy.HTTPRoute{
Name: svc.Domain,
Domain: svc.Domain,
Backend: svc.Backend.Address,
HealthPath: svc.Backend.Health,
Name: svc.Domain,
Domain: svc.Domain,
Routes: []haproxy.HTTPRouteBackend{{
Backend: svc.Backend.Address,
HealthPath: svc.Backend.Health,
}},
})
}
}
@@ -299,9 +302,11 @@ func TestReconciliation_CentralDomainInHAProxy(t *testing.T) {
for _, svc := range svcs {
if svc.Backend.Type == services.BackendHTTP {
httpRoutes = append(httpRoutes, haproxy.HTTPRoute{
Name: svc.Domain,
Domain: svc.Domain,
Backend: svc.Backend.Address,
Name: svc.Domain,
Domain: svc.Domain,
Routes: []haproxy.HTTPRouteBackend{{
Backend: svc.Backend.Address,
}},
})
}
}
@@ -376,7 +381,7 @@ func TestReconciliation_TCPPassthroughDNSTarget(t *testing.T) {
// writeTestConfig writes a minimal global config with the given Central domain.
func writeTestConfig(t *testing.T, dataDir, centralDomain string) {
t.Helper()
configPath := filepath.Join(dataDir, "config.yaml")
configPath := filepath.Join(dataDir, "state.yaml")
content := fmt.Sprintf("cloud:\n central:\n domain: %s\n", centralDomain)
if err := os.WriteFile(configPath, []byte(content), 0644); err != nil {
t.Fatalf("write config: %v", err)