From a0fbd6bcb553be88c92fe8b5f14fb52638c247f0 Mon Sep 17 00:00:00 2001 From: jochen Date: Sun, 25 Oct 2026 01:40:02 +0200 Subject: [PATCH] =?UTF-8?q?mesh-build-go:=20the=20real-go=20integration=20?= =?UTF-8?q?tests=20expect=20a=20lint=20finding=20as=20the=20lint=20step's,?= =?UTF-8?q?=20beside=20the=20tests=20(ADR=200542=20=C2=A72;=20issue=201921?= =?UTF-8?q?,=20try=20speed=20S4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mesh-build-go/test_real_integration_test.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) 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) } }