carlos / platform Public

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

Plain git — no account needed to clone.

Download

Download this file

1package host
2
3import (
4 "github.com/carlosframework/platform/internal/hostclaim"
5 "github.com/carlosframework/platform/internal/park"
6 "testing"
7 "time"
8)
9
10func TestPlan13MoveQuietReadsLegacyAndHomeToken(t *testing.T) {
11 now := time.Unix(100, 0)
12 for _, stored := range []string{"ie", park.HomeRegion, "uk"} {
13 o := hostclaim.Observed{Claim: &hostclaim.Claim{Op: hostclaim.Op{Intent: map[string]string{"home_region": "ie"}}, QuietAfter: map[string]time.Time{stored: now.Add(time.Hour)}}}
14 got := checkQuiet(o, park.HomeRegion, now)
15 if got.OK != (stored == "uk") {
16 t.Fatalf("%q: %+v", stored, got)
17 }
18 got = checkQuiet(o, "uk", now)
19 if got.OK != (stored != "uk") {
20 t.Fatalf("named %q: %+v", stored, got)
21 }
22 }
23}
24