server add records the floating address where the summary can read it
keepalived's file holds its password and is root's alone; the control plane runs as llmgw and could not read it, so the CONTROL line never named the floating address. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
ec1918b23b
commit
adef25d709
3 files changed
+24
-32
No files matched your search
@@ -111,19 +111,18 @@ func TestOneControlPlaneIsNotASetOfThem(t *testing.T) {
|
||||
|
||||
func TestTheFloatingAddressIsReadFromWhatServerAddWrote(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
ours := filepath.Join(dir, "ours.conf")
|
||||
if err := os.WriteFile(ours, []byte(keepalivedConf("eth0", "10.0.0.161", 24, 110, "abcd1234")), 0o600); err != nil {
|
||||
file := filepath.Join(dir, "floating")
|
||||
if err := os.WriteFile(file, []byte("10.0.0.161/24\n"), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if got := floatingAddress(ours); got != "10.0.0.161" {
|
||||
if got := floatingAddress(file); got != "10.0.0.161" {
|
||||
t.Errorf("read %q", got)
|
||||
}
|
||||
theirs := filepath.Join(dir, "theirs.conf")
|
||||
if err := os.WriteFile(theirs, []byte("vrrp_instance x {\n virtual_ipaddress {\n 10.9.9.9/24\n }\n}\n"), 0o600); err != nil {
|
||||
if err := os.WriteFile(file, []byte("not an address\n"), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if got := floatingAddress(theirs); got != "" {
|
||||
t.Errorf("someone else's keepalived read as ours: %q", got)
|
||||
if got := floatingAddress(file); got != "" {
|
||||
t.Errorf("nonsense read as %q", got)
|
||||
}
|
||||
if got := floatingAddress(filepath.Join(dir, "none")); got != "" {
|
||||
t.Errorf("no file read as %q", got)
|
||||
|
||||
Reference in new issue
Block a user