37 lines
1.3 KiB
Go
37 lines
1.3 KiB
Go
package grants
|
|
|
|
import (
|
|
"slices"
|
|
"testing"
|
|
|
|
"git.novox.be/novox/mesh-sdk/go/catalogue"
|
|
)
|
|
|
|
// A seat-form read resolves to the holder on record, else to the assigned module whose manifest claims the seat (A-398):
|
|
// on 2026-11-14 the builder's `seat:node-build-go.steps` stayed unresolved while no assignments held the build seat, so
|
|
// the bus refused it the steps and no build could start.
|
|
func TestSeatReadsResolveToTheClaimant(t *testing.T) {
|
|
in := Inputs{
|
|
Assigned: map[string][]string{"shanks": {"mesh-delivery-builder", "mesh-build-go"}},
|
|
Manifests: map[string]catalogue.Manifest{
|
|
"mesh-delivery-builder": {Module: "mesh-delivery-builder"},
|
|
"mesh-build-go": {Module: "mesh-build-go", Claims: []catalogue.Claim{{Name: "node-build-go"}}},
|
|
},
|
|
}
|
|
for _, c := range []struct {
|
|
name string
|
|
holders []catalogue.Held
|
|
want string
|
|
}{
|
|
{"no holder on record: the claimant", nil, "mesh-build-go.steps"},
|
|
{"a holder on record wins", []catalogue.Held{{Claim: "node-build-go", Node: "ace", Module: "other-build"}}, "other-build.steps"},
|
|
} {
|
|
t.Run(c.name, func(t *testing.T) {
|
|
got := resolveSeatReads([]string{"seat:node-build-go.steps"}, withClaimants(c.holders, in))
|
|
if !slices.Equal(got, []string{c.want}) {
|
|
t.Fatalf("reads = %v, want [%s]", got, c.want)
|
|
}
|
|
})
|
|
}
|
|
}
|