diff --git a/modules/mesh-build-go/cmd/mesh-build-go/test_real_integration_test.go b/modules/mesh-build-go/cmd/mesh-build-go/test_real_integration_test.go index 78a5a8f6..05175e99 100644 --- a/modules/mesh-build-go/cmd/mesh-build-go/test_real_integration_test.go +++ b/modules/mesh-build-go/cmd/mesh-build-go/test_real_integration_test.go @@ -66,7 +66,9 @@ func TestUnitLevelRunsTheRealGoOnTheFixtureRepositories(t *testing.T) { "tagged": {passed: true, noTests: true}, "empty": {passed: true, noTests: true}, "slow": {passed: true}, - "broken": {failed: "."}, // go vet, before the tests since R4g (ADR 0529 §1), names the directory and the compiler's line + // go vet, the lint step beside the tests (ADR 0542 §2), names the directory and the compiler's line; the test run + // of the package that does not compile fails beside it + "broken": {failed: "."}, } for name, w := range want { home := t.TempDir() @@ -84,14 +86,16 @@ func TestUnitLevelRunsTheRealGoOnTheFixtureRepositories(t *testing.T) { if err != nil { t.Fatalf("%s: %v", name, err) } - if res.Passed != w.passed || res.NoTests != w.noTests || (w.failed != "" && (len(res.Failed) != 1 || res.Failed[0].Package != w.failed)) { + lintFirst := w.failed != "." || (len(res.Failed) >= 1 && res.Failed[0].Step == StepLint) + if res.Passed != w.passed || res.NoTests != w.noTests || !lintFirst || + (w.failed != "" && (len(res.Failed) == 0 || res.Failed[0].Package != w.failed)) { t.Errorf("%s: result = %+v", name, res) } } } -// 1887/D7-go against the real go: a tree holding an unformatted file fails the unit level naming the file, before any -// test runs, and the level's result carries the lint's time. +// 1887/D7-go against the real go: a tree holding an unformatted file fails the check naming the file, as the lint step's +// failure (ADR 0542 §2), and the level's result carries the lint's time. func TestAnUnformattedFileFailsTheRealUnitLevel(t *testing.T) { needTools(t, "the unit level's gofmt and vet", "go", "git", "bwrap") home := t.TempDir() @@ -111,8 +115,9 @@ func TestAnUnformattedFileFailsTheRealUnitLevel(t *testing.T) { if err != nil { t.Fatal(err) } - if res.Passed || len(res.Failed) == 0 || res.Failed[0].Test != "gofmt" || !strings.Contains(res.Failed[0].Output, "ugly.go") || res.Tests != 0 { - t.Fatalf("result = %+v, want the level failed by gofmt naming ugly.go and no test run", res) + if res.Passed || len(res.Failed) == 0 || res.Failed[0].Test != "gofmt" || res.Failed[0].Step != StepLint || + !strings.Contains(res.Failed[0].Output, "ugly.go") || res.Lint <= 0 { + t.Fatalf("result = %+v, want the lint step failed by gofmt naming ugly.go, with its time", res) } }