Files
mesh-delivery/modules/mesh-grants/internal/buscompose/pulledevents_test.go
T

28 lines
1.3 KiB
Go

package buscompose
import (
"slices"
"testing"
)
// A-399: the holder of a seat pulled by kind says the seat's own events on its machine (a build seat's step-ended and
// toolchain-reported, `<event>.<node>`); on 2026-11-14 they were granted to nobody, so the builder never heard a toolchain.
func TestAPulledSeatsHolderSaysItsEvents(t *testing.T) {
held := Seat{Name: "node-build-go", Scope: "node", Accepts: []string{"delivery"}, PulledByKind: true,
Emits: []string{"step-ended", "toolchain-reported"},
EventSubjects: map[string]string{"step-ended": "step-ended.<node>", "toolchain-reported": "toolchain-reported.<node>"}}
perms, err := PermissionsFor(Principal{Kind: KindModule, Node: "shanks", Module: "mesh-build-go", Holds: []Seat{held}})
if err != nil {
t.Fatal(err)
}
for _, want := range []string{"mesh.seat.node-build-go.event.step-ended.shanks", "mesh.seat.node-build-go.event.toolchain-reported.shanks"} {
if !slices.Contains(perms.Publish, want) {
t.Errorf("the holder's account is not granted %s", want)
}
}
tr := SeatTrafficOf("mesh-build-go", []Seat{held}, nil, nil)
if !slices.Contains(tr.Publish, "mesh.seat.node-build-go.event.toolchain-reported.*") {
t.Errorf("the membership does not list toolchain-reported: %v", tr.Publish)
}
}