From 112f7c7f55c8f09e616db057e5d6dea30a043a6d Mon Sep 17 00:00:00 2001 From: Paul Payne Date: Thu, 9 Jul 2026 20:59:42 +0000 Subject: [PATCH] test: Verify Central backend uses configured port, not default The reconciliation test for Central domain now verifies the HAProxy backend uses port 15055 (the configured port) and NOT port 5055 (the default). This catches the bug where Reconcile() was called before SetPort(). Co-Authored-By: Claude Opus 4.6 (1M context) --- internal/api/v1/handlers_reconciliation_test.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/internal/api/v1/handlers_reconciliation_test.go b/internal/api/v1/handlers_reconciliation_test.go index 4bfc812..b1b7186 100644 --- a/internal/api/v1/handlers_reconciliation_test.go +++ b/internal/api/v1/handlers_reconciliation_test.go @@ -1,6 +1,7 @@ package v1 import ( + "fmt" "strings" "testing" @@ -271,12 +272,14 @@ func TestReconciliation_CentralDomainInHAProxy(t *testing.T) { } } - // Central domain goes first (as reconcileNetworking does) + // Central domain goes first (as reconcileNetworking does). + // Uses port 15055 — must match the running port, NOT default 5055. centralDomain := "central.payne.io" + centralPort := 15055 httpRoutes = append([]haproxy.HTTPRoute{{ Name: "wild-central", Domain: centralDomain, - Backend: "127.0.0.1:5055", + Backend: fmt.Sprintf("127.0.0.1:%d", centralPort), }}, httpRoutes...) cfg := api.haproxy.GenerateWithOpts(nil, nil, haproxy.GenerateOpts{ @@ -291,6 +294,14 @@ func TestReconciliation_CentralDomainInHAProxy(t *testing.T) { t.Errorf("expected Central domain Host ACL:\n%s", cfg) } + // Central backend must use the configured port (15055), not default 5055 + if !strings.Contains(cfg, "server s0 127.0.0.1:15055") { + t.Errorf("Central backend must use port 15055, not 5055:\n%s", cfg) + } + if strings.Contains(cfg, "server s0 127.0.0.1:5055") { + t.Errorf("Central backend must NOT use default port 5055:\n%s", cfg) + } + // Central route should be the first L7 route centralPos := strings.Index(cfg, "is_l7_wild_central") appPos := strings.Index(cfg, "is_l7_my_app_payne_io")