Read a done build once, and work out the data items in the scope the pass composed in (ADR 0577)
The data items after a pass re-read each placed module's build over the bus (about 55 per pass on ace, g14 and shanks); a done build never changes, so the composer keeps it. The items are now worked out with the pass's own kept builds and modules run inside the node's own, as composed. Claude-Session: https://claude.ai/code/session_01NcbgfJ9Gum47zkFKWRaovL
This commit is contained in:
@@ -145,4 +145,29 @@ func TestTheEngineKeepsEachPlacedModulesDataItems(t *testing.T) {
|
||||
}
|
||||
})
|
||||
}
|
||||
// The items are worked out from what the pass read: a done build is read over the bus once, not again for the data
|
||||
// items after the pass (a module in a running build is read again, since it may land).
|
||||
b := newFakeBus()
|
||||
done, _ := delivery.EncodeBuilderBuild(delivery.BuilderBuild{State: delivery.BuildDone, Manifest: delivery.ManifestDigest([]byte(lemurs))})
|
||||
running, _ := delivery.EncodeBuilderBuild(delivery.BuilderBuild{State: "building"})
|
||||
fp := delivery.SourcePrefix2 + strings.Repeat("b", 64)
|
||||
doneKey, _ := delivery.BuilderBuildKey("web", fp)
|
||||
runningKey, _ := delivery.BuilderBuildKey("pg", fp)
|
||||
b.kv[delivery.BuilderBuildsBucket+"/"+doneKey], b.kv[delivery.BuilderBuildsBucket+"/"+runningKey] = done, running
|
||||
r := reader{c: New(b.env())}
|
||||
for range 3 {
|
||||
if got, err := r.Build(context.Background(), "web", fp); err != nil || got.State != delivery.BuildDone {
|
||||
t.Fatalf("the done build: %+v, %v", got, err)
|
||||
}
|
||||
if got, err := r.Build(context.Background(), "pg", fp); err != nil || got.State != "building" {
|
||||
t.Fatalf("the running build: %+v, %v", got, err)
|
||||
}
|
||||
}
|
||||
reads := map[string]int{}
|
||||
for _, read := range b.reads {
|
||||
reads[read[1]]++
|
||||
}
|
||||
if reads[doneKey] != 1 || reads[runningKey] != 3 {
|
||||
t.Errorf("the builds were read %v times over the bus; want the done one once, the running one each time", reads)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user