Merge remote-tracking branch 'origin/feat/r4g' into feat/r4g
mesh/delivery superseded: a newer head of the same pull request
mesh/check failed: unit: git.novox.be/novox/mesh-catalog/chec… | 1fc7b84ad2a0 on 3bec357968da | judged by the candidate's mesh-build-go at b3c53883f575
mesh/delivery superseded: a newer head of the same pull request
mesh/check failed: unit: git.novox.be/novox/mesh-catalog/chec… | 1fc7b84ad2a0 on 3bec357968da | judged by the candidate's mesh-build-go at b3c53883f575
This commit is contained in:
@@ -148,3 +148,33 @@ func TestManifestClaimsTheGoBuildSeatAndReadsItsCapacity(t *testing.T) {
|
||||
}
|
||||
|
||||
func m0() *Module { return &Module{Node: "ace", Capacity: func() int { return 0 }} }
|
||||
|
||||
// 1917: a check ask's digest is the digest tool's own body, which answers the packages in the call (no step key): the
|
||||
// ask's level carries the digest, so the checker keys the kept verdicts by it.
|
||||
func TestACheckAsksDigestIsTheToolsAnswerInTheCall(t *testing.T) {
|
||||
m := &Module{Node: "ace"}
|
||||
for _, s := range m.StepTools() {
|
||||
if s.Name == "build_go_digest" && s.Long {
|
||||
t.Fatal("build_go_digest is a long step: its answer would be a step key, not the digest")
|
||||
}
|
||||
}
|
||||
var calls []string
|
||||
steps := fakeSteps(&calls)
|
||||
for i := range steps {
|
||||
if steps[i].Name == "build_go_digest" {
|
||||
steps[i].Run = func(ctx context.Context, args map[string]any) (any, error) {
|
||||
return map[string]any{"level": "unit", "packages": map[string]string{"x/a": "d1"}}, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
ask := m.askSteps(steps)
|
||||
a := delivery.StepAsk{ID: buildstep.NewID(), Kind: delivery.AskCheck, Language: delivery.AskGo, Asker: "mesh-delivery-checker",
|
||||
At: time.Now(), Check: &delivery.CheckJob{Fetch: map[string]any{"repository": "novox/x", "commit": askCommit}, Levels: []string{delivery.LevelUnit}}}
|
||||
out, err := buildstep.RunAsk(context.Background(), ask, a)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if l := out.(delivery.CheckAnswer).Levels; len(l) != 1 || !strings.Contains(string(l[0].Digest), `"x/a":"d1"`) {
|
||||
t.Fatalf("levels = %+v, want the digest's packages", l)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user