|
|
|
@@ -443,6 +443,7 @@ func TestRunAskRunsAPipelineStepAndSaysItsEnd(t *testing.T) {
|
|
|
|
|
run int // which run of the ask this is (the step's Run), 0 outside a puller
|
|
|
|
|
notRun []sdkstep.NotRun
|
|
|
|
|
saidOpen string // the end's said opens with these words
|
|
|
|
|
archive string // the step's install archive, which every test call names
|
|
|
|
|
}{
|
|
|
|
|
{name: "unit: the kept package carried, the other tested and kept", ask: stepOf(sdkstep.StepUnit, sdkstep.KeptResult{Package: "x/a", Digest: "d-a", Level: "unit"}),
|
|
|
|
|
digests: map[string]string{"x/a": "d-a", "x/b": "d-b"}, tests: map[string]bool{"x/b": true}, outcome: sdkstep.OutcomePassed, counts: 1, carried: []string{"x/a"}, kept: []string{"x/b"}},
|
|
|
|
@@ -469,6 +470,9 @@ func TestRunAskRunsAPipelineStepAndSaysItsEnd(t *testing.T) {
|
|
|
|
|
saidOpen: "the bus did not answer in setup within 5m0s under load"},
|
|
|
|
|
{name: "a starved setup beside an assertion: failed", ask: stepOf(sdkstep.StepIntegration), digests: map[string]string{"x/b": "d-b"}, run: 1, outcome: sdkstep.OutcomeFailed, counts: 2,
|
|
|
|
|
test: map[string]any{"passed": false, "tests": 2, "why": "2 failed", "failed": []sdkstep.Failure{{Package: "x/b", Test: "TestT", Cause: "mesh: setup starved: words"}, {Package: "x/b", Test: "TestU", Cause: "got 1, want 2"}}}},
|
|
|
|
|
// §800: the install archive the step names reaches the test calls, for the build module to unpack.
|
|
|
|
|
{name: "integration with an install archive: the test calls name it", ask: stepOf(sdkstep.StepIntegration), digests: map[string]string{"x/b": "d-b"}, tests: map[string]bool{"x/b": true},
|
|
|
|
|
outcome: sdkstep.OutcomePassed, counts: 1, kept: []string{"x/b"}, archive: "oci-artifact-registry://gitea/npm-tree:0.1.4"},
|
|
|
|
|
// §799: a fetch met away on the third run ends the step failed with its why.
|
|
|
|
|
{name: "a fetch fault's third run: failed, fetch:", ask: stepOf(sdkstep.StepUnit), run: 3, outcome: sdkstep.OutcomeFailed,
|
|
|
|
|
fetchErr: &sdkstep.Passing{Err: errors.New("fetch: git fetch: status 502")}, saidOpen: "fetch: git fetch"},
|
|
|
|
@@ -487,6 +491,9 @@ func TestRunAskRunsAPipelineStepAndSaysItsEnd(t *testing.T) {
|
|
|
|
|
if row.test != nil {
|
|
|
|
|
s.Test = func(context.Context, map[string]any) (any, error) { return row.test, nil }
|
|
|
|
|
}
|
|
|
|
|
if row.archive != "" {
|
|
|
|
|
row.ask.Step.Archive = row.archive
|
|
|
|
|
}
|
|
|
|
|
ctx := context.Background()
|
|
|
|
|
if row.run > 0 {
|
|
|
|
|
ctx = context.WithValue(ctx, phaseKey{}, &phases{step: sdkstep.Step{Run: row.run}})
|
|
|
|
@@ -536,6 +543,11 @@ func TestRunAskRunsAPipelineStepAndSaysItsEnd(t *testing.T) {
|
|
|
|
|
if _, err := sdkstep.EncodeStepEnded(e); err != nil {
|
|
|
|
|
t.Errorf("%s: the end does not encode: %v", row.name, err)
|
|
|
|
|
}
|
|
|
|
|
for _, c := range r.calls {
|
|
|
|
|
if strings.HasPrefix(c, "test ") && row.archive != "" && !strings.Contains(c, `"archive":"`+row.archive+`"`) {
|
|
|
|
|
t.Errorf("%s: the test call %s names no archive %s", row.name, c, row.archive)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if !slices.Equal(e.NotRun, row.notRun) || !strings.HasPrefix(e.Said, row.saidOpen) {
|
|
|
|
|
t.Errorf("%s: not run %+v said %q, want %+v and said opening %q", row.name, e.NotRun, e.Said, row.notRun, row.saidOpen)
|
|
|
|
|
}
|
|
|
|
|