package hostops import ( "context" "github.com/carlosframework/platform/internal/hostclaim" "github.com/carlosframework/platform/internal/termfence" "testing" ) type plan13BoundFence struct{ home, region string } func (a plan13BoundFence) ValidateFence(context.Context, termfence.Record) (hostclaim.FenceBinding, error) { return hostclaim.FenceBinding{FleetHomeRegion: a.home, Region: a.region, RosterRevision: 1, RosterETag: "signed"}, nil } func TestPlan13FenceRequiresSignedHome(t *testing.T) { for _, home := range []string{"ie", "ca", ""} { a := MoveFenceRegions{Authority: plan13BoundFence{home: "ie", region: "ca"}, HomeRegion: home} got, err := a.ValidateFence(t.Context(), termfence.Record{}) if home == "ca" { if err == nil { t.Fatal("named fence projected to home", got) } continue } if err != nil || got.Region != "ca" { t.Fatal(got, err) } } }