The builds list carries each build's source fingerprint, so builds shows it (issue 1208) #393
@@ -256,3 +256,33 @@ func TestAFailedNewerBuildLeavesTheBuildSourceStale(t *testing.T) {
|
|||||||
t.Fatalf("after a newer failed build the proxy reads as %+v", got)
|
t.Fatalf("after a newer failed build the proxy reads as %+v", got)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// novox/hq issue 1208: the list builds reads carries each build's source fingerprint, so the verb can say it.
|
||||||
|
func TestTheBuildsListCarriesTheSourceFingerprint(t *testing.T) {
|
||||||
|
inv := fresh(t)
|
||||||
|
ctx := context.Background()
|
||||||
|
pinned := aBuild("1", "shell", "")
|
||||||
|
pinned.SourceFingerprint = "src1:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
|
||||||
|
if err := inv.RecordBuild(ctx, pinned); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if err := inv.RecordBuild(ctx, aBuild("2", "other", "")); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
got, err := inv.Builds(ctx, "", 10)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
says := map[string]string{}
|
||||||
|
for _, b := range got {
|
||||||
|
says[b.Module] = b.SourceFingerprint
|
||||||
|
}
|
||||||
|
// 1208/AC1
|
||||||
|
if says["shell"] != pinned.SourceFingerprint {
|
||||||
|
t.Errorf("the list says %q for shell; want %q", says["shell"], pinned.SourceFingerprint)
|
||||||
|
}
|
||||||
|
// 1208/AC2
|
||||||
|
if fp, listed := says["other"]; !listed || fp != "" {
|
||||||
|
t.Errorf("a build with no fingerprint is listed with %q (listed %v); want it listed with none", fp, listed)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -618,7 +618,9 @@ func (i *Inventory) chainBuildList(ctx context.Context, c *chain.Chain, module s
|
|||||||
for _, b := range all {
|
for _, b := range all {
|
||||||
if module == "" || b.Module == module {
|
if module == "" || b.Module == module {
|
||||||
out = append(out, Build{ID: b.ID, Repository: b.Repository, Ref: b.Ref, Module: b.Module, Commit: b.Commit,
|
out = append(out, Build{ID: b.ID, Repository: b.Repository, Ref: b.Ref, Module: b.Module, Commit: b.Commit,
|
||||||
On: b.On, Failed: b.Failed, Made: b.Made, Asked: b.Asked, At: b.At, ReuseKey: b.ReuseKey, Published: b.Published})
|
On: b.On, Failed: b.Failed, Made: b.Made, Asked: b.Asked, At: b.At, ReuseKey: b.ReuseKey, Published: b.Published,
|
||||||
|
// What it was made from, which builds says (novox/hq issue 1208).
|
||||||
|
SourceFingerprint: b.SourceFingerprint})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sort.SliceStable(out, func(a, b int) bool {
|
sort.SliceStable(out, func(a, b int) bool {
|
||||||
|
|||||||
Reference in New Issue
Block a user