Record the inputs of a build's source fingerprint in its build record (issue 1215)
This commit is contained in:
@@ -9,6 +9,8 @@ import (
|
||||
"slices"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"git.novox.be/novox/mesh-sdk/go/delivery"
|
||||
)
|
||||
|
||||
// What a build says it was made from, as files (novox/hq ADR 0267), and what a build compiling a Go
|
||||
@@ -202,3 +204,20 @@ func TestAGoBundleSaysItsClosureAndAnUntoldImageNothing(t *testing.T) {
|
||||
t.Fatalf("an image compiling nothing it was told of said a build source: %+v", got.Sources)
|
||||
}
|
||||
}
|
||||
|
||||
// 1215/AC1 (compiled here, run by the merge check; the unit level has 1215/AC1 over the same inputs): a build's
|
||||
// result carries every input of its fingerprint, and the SDK function over them gives it again.
|
||||
func TestABuildSaysTheInputsItsFingerprintWasComputedFrom(t *testing.T) {
|
||||
got, _, _ := buildTheProxy(t, aSharedRepository("one", "1"), false)
|
||||
if got.SourceInputs == nil {
|
||||
t.Fatal("the result carries no source inputs")
|
||||
}
|
||||
in := *got.SourceInputs
|
||||
if in.Module != "route-proxy" || in.Tree == "" || in.Contexts["server"] == "" {
|
||||
t.Errorf("the inputs miss the module, its tree or the server's context: %+v", in)
|
||||
}
|
||||
fp, none := delivery.SourceFingerprint(in)
|
||||
if fp == "" || none != "" || fp != got.Source {
|
||||
t.Errorf("the inputs give %q (%q); the build recorded %q", fp, none, got.Source)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user