Build each fingerprint on one node and drop the second-node retake, as ADR 0478 §4 has it from R4e (issue 1587, B9)
A key done on one node before R4e is not built again for a second; a key failed for differing digests stays as it is.
This commit is contained in:
@@ -332,3 +332,31 @@ func TestTheFetchOfAModuleNamingItsPathsCarriesItsDirectoryAndThosePaths(t *test
|
||||
}
|
||||
|
||||
func hex40(c byte) string { return strings.Repeat(string(c), 40) }
|
||||
|
||||
func TestOneNodeBuildsEachFingerprint(t *testing.T) { // B9, ADR 0478 clause 4: "From R4e one node builds each fingerprint"
|
||||
r := newRig(t, goBundle, archiveA, tsBundle) // ace and novox both qualify for both build modules
|
||||
v := r.consider(t, "modules/m")
|
||||
if v.State != delivery.BuildDone || strings.Contains(v.Step, " and ") || strings.HasPrefix(v.Step, "one node (") {
|
||||
t.Fatalf("build = %+v, want done on one node of each build module, unmarked", v)
|
||||
}
|
||||
if f, b := len(r.bm.callsOf("build_go_fetch")), len(r.bm.callsOf("build_go_build")); f != 1 || b != 2 {
|
||||
t.Errorf("go fetches %d, builds %d; want one fetch and one build of each artifact, on one node", f, b)
|
||||
}
|
||||
if f := len(r.bm.callsOf("build_node_fetch")); f != 1 {
|
||||
t.Errorf("node fetches %d, want one", f)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAKeyDoneOnOneNodeIsNeverBuiltAgainForASecondNode(t *testing.T) { // B9: the second-node retake is gone
|
||||
r := newRig(t, goBundle)
|
||||
putBuild(t, r.st, r.key, delivery.BuilderBuild{State: delivery.BuildDone, By: "novox.builder", Manifest: manifestD,
|
||||
Step: "one node (mesh-build-go): built mesh-build-go on one node, novox",
|
||||
Artifacts: []delivery.BuiltArtifact{{Name: "tool", Kind: "bundle", Digest: digest, Reference: "artifact-store://m/tool/blobs/" + digest}}})
|
||||
writes := r.st.writes
|
||||
r.b.Module(context.Background(), "m", moduleValue(t, "modules/m"))
|
||||
r.b.NodesChanged(context.Background())
|
||||
r.b.Wait()
|
||||
if r.st.writes != writes || len(r.bm.calls) != 0 {
|
||||
t.Errorf("a key done on one node was built again (%d writes, was %d; %d calls)", r.st.writes, writes, len(r.bm.calls))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user