carlos / platform Public

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

Plain git — no account needed to clone.

Download

Download this file

1package hostops
2
3import (
4 "strings"
5 "testing"
6 "time"
7
8 "github.com/carlosframework/platform/internal/hostclaim"
9)
10
11func TestRetirementScopeKeepsOriginalEvidenceAndBothTargets(t *testing.T) {
12 at := time.Date(2026, 10, 7, 0, 0, 0, 0, time.UTC)
13 inc := strings.Repeat("a", 64)
14 refs := map[string]hostclaim.RetirementEvidenceRef{"a": {Box: "a", EvidenceAt: at}, "b": {Box: "b", EvidenceAt: at.Add(time.Minute)}}
15 for _, target := range []string{"instances/x.example/" + inc, "moves/x.example"} {
16 first, err := retirementScope("x.example", inc, target, refs)
17 if err != nil {
18 t.Fatal(err)
19 }
20 retry, err := retirementScope("x.example", inc, target, refs)
21 if err != nil {
22 t.Fatal(err)
23 }
24 if first != retry || !retry.EvidenceAt.Equal(at.Add(time.Minute)) || retry.Location != target {
25 t.Fatalf("scope changed: %+v / %+v", first, retry)
26 }
27 }
28}
29