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) + } +}