carlos / platform Public

Clone
git clone https://amadan.net/carlos/platform

Plain git — no account needed to clone.

Download

Download this file

1package edge
2
3import "testing"
4
5// Region HA plan 1b (Astra plan R1-2): after a failover the dead box's file
6// is stale but still listed. Its alias carries the old installation's
7// stamp and the successor's the new one, so the successor wins however the
8// boxes sort.
9func TestHomeMapAnAliasFollowsTheNewerInstallation(t *testing.T) {
10 s := meshTestStore(t)
11 putJSON(t, s, "control/edges/annie.json", `{"v":1,"box":"annie","eip":"1.1.1.1","hosts":{"shop.test":{"role":"home","stamp":41},"www.customer.com":{"role":"home","alias":true,"stamp":41}}}`)
12 putJSON(t, s, "control/edges/betty.json", `{"v":1,"box":"betty","eip":"2.2.2.2","hosts":{"shop.test":{"role":"home","stamp":57},"www.customer.com":{"role":"home","alias":true,"stamp":57}}}`)
13 m := newHomeMap(s, "carol")
14 refreshHomeMap(t, m)
15 if eip, box, ok := m.Home("www.customer.com"); !ok || box != "betty" || eip != "2.2.2.2" {
16 t.Fatalf("Home(www.customer.com) = %q %q %v, want betty", eip, box, ok)
17 }
18}
19