From 77fb48ba32e55814e2872002045765f944cf37a0 Mon Sep 17 00:00:00 2001 From: Ilker Manap Date: Mon, 5 Oct 2026 02:56:23 +0200 Subject: [PATCH] The probe reads the floating address from its file each time The change to read it each time left the constructor storing the address itself, so the file read each time was one named 10.0.0.161. Co-Authored-By: Claude Opus 5.5 (1M context) --- internal/cli/controlplanes.go | 2 +- internal/cli/controlplanes_test.go | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/internal/cli/controlplanes.go b/internal/cli/controlplanes.go index 6d959b6..960a3a9 100644 --- a/internal/cli/controlplanes.go +++ b/internal/cli/controlplanes.go @@ -46,7 +46,7 @@ func newControlPlaneProbe(st *store.DB, listen string) *controlPlaneProbe { self, _ := os.Hostname() return &controlPlaneProbe{st: st, self: self, leaderURL: func(host string) string { return "http://" + net.JoinHostPort(host, port) + "/leader" }, - floating: floatingAddress(floatingPath), + floating: floatingPath, client: &http.Client{Timeout: time.Second}} } diff --git a/internal/cli/controlplanes_test.go b/internal/cli/controlplanes_test.go index bd0cb2c..38c742b 100644 --- a/internal/cli/controlplanes_test.go +++ b/internal/cli/controlplanes_test.go @@ -132,3 +132,11 @@ func TestTheFloatingAddressIsReadFromWhatServerAddWrote(t *testing.T) { t.Errorf("no file read as %q", got) } } + +func TestTheProbeReadsTheFloatingAddressFromItsFile(t *testing.T) { + // The file, not what it held when the process started: server add + // writes it after restarting the control plane it adds. + if p := newControlPlaneProbe(nil, ":8080"); p.floating != floatingPath { + t.Errorf("the probe reads %q, not %s", p.floating, floatingPath) + } +}