Derive the late holder's worker from a build seat, since the build agent's seat is gone (issue 1931)
This commit is contained in:
@@ -46,25 +46,31 @@ func aCarriedConsumer(t *testing.T, open *stores) broker.Consumer {
|
||||
return broker.Consumer{}
|
||||
}
|
||||
|
||||
// aLateHolder is a module holding the build agent's seat on anchor, assigned after the controller
|
||||
// started, and the worker its seat's queue should have for it.
|
||||
// aLateHolder is a module holding a build seat (node-build-go) on anchor, assigned after the controller started, and
|
||||
// the worker its seat's queue should have for it: a build seat is pulled by kind, so the worker is the one for the
|
||||
// seat's first accepted kind (the build agent's seat, which had one worker for all, is gone with the builder).
|
||||
func aLateHolder(t *testing.T, open *stores) broker.Consumer {
|
||||
t.Helper()
|
||||
register(t, open, catalogue.Manifest{Module: "late-builder", Version: "1",
|
||||
Claims: []catalogue.Claim{{Name: "node-build-agent", Scope: catalogue.ScopeNode}}})
|
||||
Claims: []catalogue.Claim{{Name: "node-build-go", Scope: catalogue.ScopeNode}}})
|
||||
if _, err := open.inventory.Assign(t.Context(), "anchor", "late-builder"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
_, workers, err := seatTrafficObjects(t.Context(), open.inventory)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, s := range inventory.MeshSeats() {
|
||||
if s.Name == "node-build-agent" {
|
||||
c, needed := broker.HolderConsumerFor("anchor", "late-builder", s)
|
||||
if !needed {
|
||||
t.Fatal("the build agent's seat needs no worker")
|
||||
if s.Name != "node-build-go" || len(s.Accepts) == 0 {
|
||||
continue
|
||||
}
|
||||
for _, w := range workers {
|
||||
if w.Name == broker.WorkerName(s.Name, s.Accepts[0]) {
|
||||
return w
|
||||
}
|
||||
return c
|
||||
}
|
||||
}
|
||||
t.Fatal("the mesh declares no build agent's seat")
|
||||
t.Fatal("the build seat's holder is derived no worker")
|
||||
return broker.Consumer{}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user