region-ha p1b-1: the box's lease identity carries its account and region
The IMDS read decodes accountId and region with the instance id. The startup retry runs until the identity is Complete, and an HA acquire is refused (ErrNoSelf) until it is, with no store request.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8 files changed,
+151
−45
internal/activator/harelease_test.go+2 −2internal/activator/hasecrets_test.go+4 −4internal/activator/hawake_test.go+2 −2internal/host/agent.go+4 −5internal/host/haself.go+32 −18internal/host/haself_test.go+76 −6internal/lease/ha.go+5 −4internal/lease/ha_test.go+26 −4
diff --git a/internal/activator/harelease_test.go b/internal/activator/harelease_test.go| index 63e352680..2d96a625b 100644 |
| --- a/internal/activator/harelease_test.go |
| +++ b/internal/activator/harelease_test.go |
| @@ -901,9 +901,9 @@ func TestFailedWakeKeepsLeaseWhileSliceHoldsAReplacement(t *testing.T) { |
| t.Fatalf("no retained wake with its replica: %+v", u) |
| } |
| other := s.peer(t) |
| - lease.SetSelf(hafresh.Self{Ref: "b", IID: "i-b"}) |
| + lease.SetSelf(hafresh.Self{Ref: "b", IID: "i-b", Account: "111122223333", Region: "eu-west-1"}) |
| _, err := other.b.Acquire(context.Background(), other.rt) |
| - lease.SetSelf(hafresh.Self{Ref: "a", IID: "i-a"}) |
| + lease.SetSelf(hafresh.Self{Ref: "a", IID: "i-a", Account: "111122223333", Region: "eu-west-1"}) |
| var held *errLeaseHeld |
| if !errors.As(err, &held) { |
| t.Fatalf("another box acquired the host beside its replacement: %v", err) |
diff --git a/internal/activator/hasecrets_test.go b/internal/activator/hasecrets_test.go| index 07fde366e..38411d021 100644 |
| --- a/internal/activator/hasecrets_test.go |
| +++ b/internal/activator/hasecrets_test.go |
| @@ -351,9 +351,9 @@ func TestFirstWakeCrashBeforePublishRemints(t *testing.T) { |
| // Another box is refused the expired lease. |
| other := s.restart(t) |
| - lease.SetSelf(hafresh.Self{Ref: "b", IID: "i-b"}) |
| + lease.SetSelf(hafresh.Self{Ref: "b", IID: "i-b", Account: "111122223333", Region: "eu-west-1"}) |
| _, err = other.wakeForTest(context.Background()) |
| - lease.SetSelf(hafresh.Self{Ref: "a", IID: "i-a"}) |
| + lease.SetSelf(hafresh.Self{Ref: "a", IID: "i-a", Account: "111122223333", Region: "eu-west-1"}) |
| var refused *errLeaseRefused |
| if !errors.As(err, &refused) || !strings.Contains(refused.reason, hafresh.ReasonOtherExpired) { |
| t.Fatalf("another box took it: %v", err) |
| @@ -381,9 +381,9 @@ func TestFirstWakeCrashBeforePublishRemints(t *testing.T) { |
| t.Fatalf("the app started before its secrets were acknowledged: the manifest held %q", atSpawn) |
| } |
| // Another box is still refused: the host is held. |
| - lease.SetSelf(hafresh.Self{Ref: "b", IID: "i-b"}) |
| + lease.SetSelf(hafresh.Self{Ref: "b", IID: "i-b", Account: "111122223333", Region: "eu-west-1"}) |
| _, err = other.b.Acquire(context.Background(), other.rt) |
| - lease.SetSelf(hafresh.Self{Ref: "a", IID: "i-a"}) |
| + lease.SetSelf(hafresh.Self{Ref: "a", IID: "i-a", Account: "111122223333", Region: "eu-west-1"}) |
| var held *errLeaseHeld |
| if !errors.As(err, &held) { |
| t.Fatalf("another box acquired the woken host: %v", err) |
diff --git a/internal/activator/hawake_test.go b/internal/activator/hawake_test.go| index fd117bd22..ccccc1e58 100644 |
| --- a/internal/activator/hawake_test.go |
| +++ b/internal/activator/hawake_test.go |
| @@ -72,7 +72,7 @@ func haBackendEmptyIndex(t *testing.T, host string) (*ExecBackend, registry.Rout |
| if err := lease.SetObligationDir(t.TempDir()); err != nil { |
| t.Fatal(err) |
| } |
| - lease.SetSelf(hafresh.Self{Ref: "a", IID: "i-a"}) |
| + lease.SetSelf(hafresh.Self{Ref: "a", IID: "i-a", Account: "111122223333", Region: "eu-west-1"}) |
| root := t.TempDir() |
| b := testExecBackend(t) |
| b.Cfg.Bucket = fx.Bucket |
| @@ -884,7 +884,7 @@ func TestLeaseRefusedAnswers503RetryAfter10(t *testing.T) { |
| // obligation store) go back as they were once its test ends. |
| func TestHAFixtureRestoresLeaseGlobals(t *testing.T) { |
| defer lease.ProcessStateForTest()() |
| - lease.SetSelf(hafresh.Self{Ref: "outer", IID: "i-outer"}) |
| + lease.SetSelf(hafresh.Self{Ref: "outer", IID: "i-outer", Account: "111122223333", Region: "eu-west-1"}) |
| t.Run("fixture", func(t *testing.T) { |
| haBackend(t, "shop.example.com") |
| if got := lease.CurrentSelf(); got.Ref != "a" { |
diff --git a/internal/host/agent.go b/internal/host/agent.go| index cb6cb3528..1dd4d6fad 100644 |
| --- a/internal/host/agent.go |
| +++ b/internal/host/agent.go |
| @@ -223,15 +223,14 @@ func dataDir() string { |
| // Before it starts, a box its region's group launched resolves its group |
| // reference, whatever the switches say: the loops runAgent starts read |
| // the box's label once and keep it (agentEntry, agententry.go). Then it |
| -// names the box as the owner of the lease locks it writes; an instance id |
| -// IMDS did not answer within 2 seconds is asked for again every minute. |
| +// names the box as the owner of the lease locks it writes; an instance id, |
| +// account or region IMDS did not answer within 2 seconds is asked for |
| +// again every minute. |
| func RunAgent(args []string) { |
| var self hafresh.Self |
| identity := func() hafresh.Self { self = haSelfNow(os.Getenv, haIMDSClient); return self } |
| agentEntry(os.Getenv, resolveGroupBoxReference, groupReferenceBackoff, log.Printf, identity, func() { |
| - if self.IID == "" { |
| - go haSelfRetry(context.Background(), os.Getenv, haIMDSClient, time.Minute, lease.SetSelf) |
| - } |
| + startHASelfRetry(context.Background(), self, os.Getenv, haIMDSClient, time.Minute, lease.SetSelf) |
| runAgent(args, productionClaimFactory) |
| }) |
| } |
diff --git a/internal/host/haself.go b/internal/host/haself.go| index bb9f73dca..71930b2ac 100644 |
| --- a/internal/host/haself.go |
| +++ b/internal/host/haself.go |
| @@ -18,19 +18,30 @@ import ( |
| var haIMDSClient = &http.Client{Timeout: haIdentityRead} |
| // haSelfNow is this box's identity as a lease owner (lease.SetSelf): its |
| -// reference is the label it publishes metrics under, and its instance id |
| -// comes from one identity-document read, given 2 seconds, "" when that |
| -// read fails. |
| +// reference is the label it publishes metrics under, and its instance id, |
| +// account and region come from one identity-document read, given 2 |
| +// seconds, "" when that read fails (or the document lacks one). |
| // agentEntry calls it after the group-reference wait, so a group box's |
| // label is its resolved group reference. |
| func haSelfNow(getenv func(string) string, client *http.Client) hafresh.Self { |
| - iid, _ := readInstanceID(client, imdsBase) |
| - return hafresh.Self{Ref: metricsBoxLabel(getenv, readMachineID()), IID: iid} |
| + iid, account, region, _ := readIdentity(client, imdsBase) |
| + return hafresh.Self{Ref: metricsBoxLabel(getenv, readMachineID()), IID: iid, Account: account, Region: region} |
| } |
| -// haSelfRetry asks again, every tick, for an instance id the startup read |
| -// missed, and hands the identity to set once it has one. It returns then, |
| -// or when ctx ends. |
| +// startHASelfRetry is RunAgent's rule for the retry: a startup identity |
| +// that is not Complete starts haSelfRetry, in its own goroutine, and a |
| +// complete one starts nothing. It reports whether it started. |
| +func startHASelfRetry(ctx context.Context, startup hafresh.Self, getenv func(string) string, client *http.Client, every time.Duration, set func(hafresh.Self)) bool { |
| + if startup.Complete() { |
| + return false |
| + } |
| + go haSelfRetry(ctx, getenv, client, every, set) |
| + return true |
| +} |
| + |
| +// haSelfRetry asks again, every tick, for an identity the startup read |
| +// missed or only half got, and hands it to set once it is Complete. It |
| +// returns then, or when ctx ends. |
| func haSelfRetry(ctx context.Context, getenv func(string) string, client *http.Client, every time.Duration, set func(hafresh.Self)) { |
| t := time.NewTicker(every) |
| defer t.Stop() |
| @@ -40,19 +51,20 @@ func haSelfRetry(ctx context.Context, getenv func(string) string, client *http.C |
| return |
| case <-t.C: |
| } |
| - if s := haSelfNow(getenv, client); s.IID != "" { |
| + if s := haSelfNow(getenv, client); s.Complete() { |
| set(s) |
| return |
| } |
| } |
| } |
| -// haIdentityRead is the whole of one instance-id read: token and document. |
| +// haIdentityRead is the whole of one identity read: token and document. |
| const haIdentityRead = 2 * time.Second |
| -// readInstanceID reads the instance id from the identity document (IMDSv2), |
| -// the token and the document together within haIdentityRead. |
| -func readInstanceID(client *http.Client, base string) (string, error) { |
| +// readIdentity reads the instance id, account id and region from the |
| +// identity document (IMDSv2), the token and the document together within |
| +// haIdentityRead. A field the document lacks comes back "". |
| +func readIdentity(client *http.Client, base string) (iid, account, region string, err error) { |
| ctx, cancel := context.WithTimeout(context.Background(), haIdentityRead) |
| defer cancel() |
| get := func(method, path string, hdr map[string]string) ([]byte, error) { |
| @@ -79,21 +91,23 @@ func readInstanceID(client *http.Client, base string) (string, error) { |
| } |
| tok, err := get(http.MethodPut, "/latest/api/token", map[string]string{"X-aws-ec2-metadata-token-ttl-seconds": "60"}) |
| if err != nil { |
| - return "", fmt.Errorf("IMDS token: %w", err) |
| + return "", "", "", fmt.Errorf("IMDS token: %w", err) |
| } |
| token := strings.TrimSpace(string(tok)) |
| if token == "" { |
| - return "", fmt.Errorf("IMDS token: empty") |
| + return "", "", "", fmt.Errorf("IMDS token: empty") |
| } |
| doc, err := get(http.MethodGet, imdsIdentityDocument, map[string]string{"X-aws-ec2-metadata-token": token}) |
| if err != nil { |
| - return "", err |
| + return "", "", "", err |
| } |
| var d struct { |
| InstanceID string `json:"instanceId"` |
| + AccountID string `json:"accountId"` |
| + Region string `json:"region"` |
| } |
| if err := json.Unmarshal(doc, &d); err != nil { |
| - return "", fmt.Errorf("IMDS identity document: %w", err) |
| + return "", "", "", fmt.Errorf("IMDS identity document: %w", err) |
| } |
| - return strings.TrimSpace(d.InstanceID), nil |
| + return strings.TrimSpace(d.InstanceID), strings.TrimSpace(d.AccountID), strings.TrimSpace(d.Region), nil |
| } |
diff --git a/internal/host/haself_test.go b/internal/host/haself_test.go| index 1b422d63a..771cebf81 100644 |
| --- a/internal/host/haself_test.go |
| +++ b/internal/host/haself_test.go |
| @@ -33,13 +33,13 @@ func TestAgentEntrySetsOwnerBeforeRun(t *testing.T) { |
| } |
| } |
| -// The box's reference is its metrics label; its instance id comes from one |
| -// identity-document read, "" when that read fails. |
| +// The box's reference is its metrics label; its instance id, account and |
| +// region come from one identity-document read, "" when that read fails. |
| func TestHASelfNowNamesTheBox(t *testing.T) { |
| - f := &fakeIMDS{doc: `{"accountId":"123456789012","instanceId":"i-0a61f580df1acfa65"}`} |
| + f := &fakeIMDS{doc: `{"accountId":"111122223333","instanceId":"i-0a61f580df1acfa65","region":"eu-west-1"}`} |
| getenv := envOf(map[string]string{"CARLOS_FLEET": "pi", "CARLOS_FLEET_BOX": "pi-box"}) |
| want := metricsBoxLabel(getenv, readMachineID()) |
| - if got := haSelfNow(getenv, imdsClient(f)); got != (hafresh.Self{Ref: want, IID: "i-0a61f580df1acfa65"}) || |
| + if got := haSelfNow(getenv, imdsClient(f)); got != (hafresh.Self{Ref: want, IID: "i-0a61f580df1acfa65", Account: "111122223333", Region: "eu-west-1"}) || |
| !slices.Equal(f.calls, []string{"PUT /latest/api/token", "GET " + imdsIdentityDocument}) { |
| t.Fatalf("%+v after %q, want ref %q", got, f.calls, want) |
| } |
| @@ -70,7 +70,7 @@ func (f *failingFor) RoundTrip(r *http.Request) (*http.Response, error) { |
| // until it answers, then set once, with the reference; the retry ends |
| // there, or when its context does. |
| func TestHASelfRetrySetsALateInstanceID(t *testing.T) { |
| - f := &failingFor{fakeIMDS: &fakeIMDS{doc: `{"instanceId":"i-0abc"}`}, n: 2} |
| + f := &failingFor{fakeIMDS: &fakeIMDS{doc: `{"accountId":"111122223333","instanceId":"i-0abc","region":"eu-west-1"}`}, n: 2} |
| getenv := envOf(map[string]string{"CARLOS_FLEET": "pi", "CARLOS_FLEET_BOX": "pi-box"}) |
| var set []hafresh.Self |
| done := make(chan struct{}) |
| @@ -83,7 +83,7 @@ func TestHASelfRetrySetsALateInstanceID(t *testing.T) { |
| case <-time.After(10 * time.Second): |
| t.Fatal("the retry never ended") |
| } |
| - if want := (hafresh.Self{Ref: metricsBoxLabel(getenv, readMachineID()), IID: "i-0abc"}); len(set) != 1 || set[0] != want || len(f.calls) != 6 { |
| + if want := (hafresh.Self{Ref: metricsBoxLabel(getenv, readMachineID()), IID: "i-0abc", Account: "111122223333", Region: "eu-west-1"}); len(set) != 1 || set[0] != want || len(f.calls) != 6 { |
| t.Fatalf("set %+v after %d requests, want once %+v after 3 reads", set, len(f.calls), want) |
| } |
| @@ -91,3 +91,73 @@ func TestHASelfRetrySetsALateInstanceID(t *testing.T) { |
| cancel() |
| haSelfRetry(ctx, getenv, imdsClient(&fakeIMDS{status: 500}), time.Hour, func(hafresh.Self) { t.Fatal("set with no instance id") }) |
| } |
| + |
| +// docSwitch serves a document that changes between reads. |
| +type docSwitch struct { |
| + *fakeIMDS |
| + docs []string // the document each read gets; the last one repeats |
| + read int |
| +} |
| + |
| +func (d *docSwitch) RoundTrip(r *http.Request) (*http.Response, error) { |
| + if r.URL.Path == imdsIdentityDocument { |
| + d.fakeIMDS.doc = d.docs[min(d.read, len(d.docs)-1)] |
| + d.read++ |
| + } |
| + return d.fakeIMDS.RoundTrip(r) |
| +} |
| + |
| +// A document with an instance id but no region is not an identity yet: |
| +// the retry waits for the tick that brings all of it, and sets it once. |
| +func TestHASelfRetryWaitsForTheWholeIdentity(t *testing.T) { |
| + d := &docSwitch{fakeIMDS: &fakeIMDS{}, docs: []string{ |
| + `{"accountId":"111122223333","instanceId":"i-0abc"}`, |
| + `{"accountId":"111122223333","instanceId":"i-0abc"}`, |
| + `{"accountId":"111122223333","instanceId":"i-0abc","region":"eu-west-1"}`, |
| + }} |
| + getenv := envOf(map[string]string{"CARLOS_FLEET": "pi", "CARLOS_FLEET_BOX": "pi-box"}) |
| + var set []hafresh.Self |
| + done := make(chan struct{}) |
| + go func() { |
| + defer close(done) |
| + haSelfRetry(context.Background(), getenv, &http.Client{Transport: d}, time.Millisecond, func(s hafresh.Self) { set = append(set, s) }) |
| + }() |
| + select { |
| + case <-done: |
| + case <-time.After(10 * time.Second): |
| + t.Fatal("the retry never ended") |
| + } |
| + want := hafresh.Self{Ref: metricsBoxLabel(getenv, readMachineID()), IID: "i-0abc", Account: "111122223333", Region: "eu-west-1"} |
| + if len(set) != 1 || set[0] != want || d.read != 3 { |
| + t.Fatalf("set %+v after %d document reads, want once %+v after 3", set, d.read, want) |
| + } |
| +} |
| + |
| +// The production entry (the code RunAgent runs once the group reference |
| +// is resolved): a startup identity with an instance id but no region |
| +// starts the retry, and a later complete document reaches the lease |
| +// identity. A complete startup identity starts nothing. |
| +func TestAgentRetriesAPartialIdentity(t *testing.T) { |
| + t.Cleanup(func() { lease.SetSelf(hafresh.Self{}) }) |
| + getenv := envOf(map[string]string{"CARLOS_FLEET": "pi", "CARLOS_FLEET_BOX": "pi-box"}) |
| + ref := metricsBoxLabel(getenv, readMachineID()) |
| + partial := hafresh.Self{Ref: ref, IID: "i-0abc", Account: "111122223333"} |
| + d := &docSwitch{fakeIMDS: &fakeIMDS{}, docs: []string{`{"accountId":"111122223333","instanceId":"i-0abc","region":"eu-west-1"}`}} |
| + lease.SetSelf(partial) |
| + ctx, cancel := context.WithCancel(context.Background()) |
| + defer cancel() |
| + if !startHASelfRetry(ctx, partial, getenv, &http.Client{Transport: d}, time.Millisecond, lease.SetSelf) { |
| + t.Fatal("a partial identity did not start the retry") |
| + } |
| + want := hafresh.Self{Ref: ref, IID: "i-0abc", Account: "111122223333", Region: "eu-west-1"} |
| + deadline := time.Now().Add(10 * time.Second) |
| + for lease.CurrentSelf() != want { |
| + if time.Now().After(deadline) { |
| + t.Fatalf("the lease identity stayed %+v, want %+v", lease.CurrentSelf(), want) |
| + } |
| + time.Sleep(time.Millisecond) |
| + } |
| + if startHASelfRetry(ctx, want, getenv, &http.Client{Transport: d}, time.Hour, lease.SetSelf) { |
| + t.Fatal("a complete identity started the retry") |
| + } |
| +} |
diff --git a/internal/lease/ha.go b/internal/lease/ha.go| index 9ab131d86..8c4e32625 100644 |
| --- a/internal/lease/ha.go |
| +++ b/internal/lease/ha.go |
| @@ -27,9 +27,10 @@ func (e *RefusedError) Error() string { return "lease: HA acquire refused: " + e |
| // prefix already holds something. |
| const ReasonLeftoverData = "leftover data" |
| -// ErrNoSelf refuses an HA acquire before SetSelf: an HA lock's owner must |
| -// name the box. |
| -var ErrNoSelf = errors.New("lease: no box identity set; HA acquire refused") |
| +// ErrNoSelf refuses an HA acquire until SetSelf has named the whole box |
| +// (hafresh.Self.Complete): an HA lock's owner must name it, and a takeover |
| +// proves it from its account and region. |
| +var ErrNoSelf = errors.New("lease: this box's identity (reference, instance id, account, region) is not known yet; HA acquire refused") |
| // AcquireHA is the acquire for HA hosts, and the only one: it never falls |
| // back to litestream's AcquireLease or to the legacy path. |
| @@ -61,7 +62,7 @@ func acquireHATTL(ctx context.Context, bucket, prefix, region string, base hafre |
| return nil, ErrNoObligationStore |
| } |
| s := self.Load() |
| - if s == nil || s.Ref == "" { |
| + if s == nil || !s.Complete() { |
| return nil, ErrNoSelf |
| } |
| me := *s |
diff --git a/internal/lease/ha_test.go b/internal/lease/ha_test.go| index d3e9587fa..c87e8d8bf 100644 |
| --- a/internal/lease/ha_test.go |
| +++ b/internal/lease/ha_test.go |
| @@ -46,7 +46,7 @@ func haBox(t *testing.T) string { |
| t.Helper() |
| lease.ResetForTest() |
| t.Cleanup(lease.ResetForTest) |
| - lease.SetSelf(hafresh.Self{Ref: "a", IID: "i-a"}) |
| + lease.SetSelf(hafresh.Self{Ref: "a", IID: "i-a", Account: "111122223333", Region: "eu-west-1"}) |
| dir := t.TempDir() |
| if err := lease.SetObligationDir(dir); err != nil { |
| t.Fatal(err) |
| @@ -184,7 +184,7 @@ func TestAcquireHAFirstWakeRefusesLeftovers(t *testing.T) { |
| func TestAcquireHARefusesWithoutWriting(t *testing.T) { |
| haBox(t) |
| other := hafresh.OwnerFor(hafresh.Self{Ref: "b", IID: "i-b"}, 9, true) |
| - mine := hafresh.OwnerFor(hafresh.Self{Ref: "a", IID: "i-a"}, 9, true) |
| + mine := hafresh.OwnerFor(hafresh.Self{Ref: "a", IID: "i-a", Account: "111122223333", Region: "eu-west-1"}, 9, true) |
| empty := func(ok bool) hafresh.Proofs { |
| return hafresh.Proofs{SameBoxEmpty: func() (bool, error) { return ok, nil }} |
| } |
| @@ -239,6 +239,28 @@ func TestAcquireHARefusesWithoutSelf(t *testing.T) { |
| } |
| } |
| +// An HA owner names the whole box: a reference alone, or everything but |
| +// the region, is refused before any request. |
| +func TestAcquireHARefusesWithoutInstanceID(t *testing.T) { |
| + for _, self := range []hafresh.Self{ |
| + {Ref: "a"}, |
| + {Ref: "a", IID: "i-a"}, |
| + {Ref: "a", IID: "i-a", Account: "111122223333"}, |
| + {Ref: "a", IID: "i-a", Region: "eu-west-1"}, |
| + } { |
| + lease.ResetForTest() |
| + lease.SetSelf(self) |
| + if err := lease.SetObligationDir(t.TempDir()); err != nil { |
| + t.Fatal(err) |
| + } |
| + fx := leasetest.NewLockFixture(t) |
| + if _, err := lease.AcquireHA(ctx, fx.Bucket, "instances/h", "", hafresh.Marker{V: 1}, hafresh.Proofs{}); !errors.Is(err, lease.ErrNoSelf) || len(fx.Requests()) != 0 { |
| + t.Fatalf("%+v: %v after %v", self, err, fx.Requests()) |
| + } |
| + } |
| + lease.ResetForTest() |
| +} |
| + |
| // r2.1: the PUT lands, its answer arrives past the safe deadline. The |
| // acquire fails and leaves the lock an unclean marker, never deleted. |
| func TestAcquireHALateAckWritesUncleanMarker(t *testing.T) { |
| @@ -326,7 +348,7 @@ func TestLegacyTakeKeepsLegacyLocks(t *testing.T) { |
| func TestHAAcquireRefusedWithoutObligationStore(t *testing.T) { |
| lease.ResetForTest() |
| t.Cleanup(lease.ResetForTest) |
| - lease.SetSelf(hafresh.Self{Ref: "a", IID: "i-a"}) |
| + lease.SetSelf(hafresh.Self{Ref: "a", IID: "i-a", Account: "111122223333", Region: "eu-west-1"}) |
| fx := leasetest.NewLockFixture(t) |
| if _, err := lease.AcquireHA(ctx, fx.Bucket, "instances/h", "", hafresh.Marker{V: 1}, hafresh.Proofs{}); !errors.Is(err, lease.ErrNoObligationStore) || len(fx.Requests()) != 0 { |
| t.Fatal(err) |
| @@ -352,7 +374,7 @@ func TestAcquireCleanupObligationSurvivesRestart(t *testing.T) { |
| t.Fatalf("not persisted: %v", err) |
| } |
| lease.ResetForTest() // a new process |
| - lease.SetSelf(hafresh.Self{Ref: "a", IID: "i-a"}) |
| + lease.SetSelf(hafresh.Self{Ref: "a", IID: "i-a", Account: "111122223333", Region: "eu-west-1"}) |
| if err := lease.SetObligationDir(dir); err != nil || len(lease.PendingObligations()) != 1 { |
| t.Fatalf("not loaded: %v", err) |
| } |