diff --git a/modules/mesh-build-go/cmd/mesh-build-go/test_test.go b/modules/mesh-build-go/cmd/mesh-build-go/test_test.go index 359ce3c4..aa6d1d1a 100644 --- a/modules/mesh-build-go/cmd/mesh-build-go/test_test.go +++ b/modules/mesh-build-go/cmd/mesh-build-go/test_test.go @@ -103,6 +103,33 @@ func TestUnitLevelNamesTheFailingTestAndFailsTheLevel(t *testing.T) { } } +// Issue 1921: a fixture with a failing test in each of two packages: one level's run names both, each with its own +// cause, and counts every test, the passing one beside a failure too. go test runs every package to its end; nothing +// stops at the first failure. +func TestUnitLevelNamesEveryFailingTestOfEveryPackage(t *testing.T) { + m, states, ws, calls := workspaceFor(t, "twofailing") + res, st := runUnit(t, m, states, ws) + if st.State != delivery.StepPassed || res.Passed { + t.Fatalf("step %s (%s), result %+v: want the step done and the level failed", st.State, st.Reason, res) + } + var got []string + for _, f := range res.Failed { + got = append(got, f.Package+"."+f.Test+": "+f.Cause) + } + want := []string{"fixture/twofailing/one.TestOneIsTwo: One() = 1, want 2", "fixture/twofailing/two.TestTwoIsThree: Two() = 2, want 3"} + if strings.Join(got, "\n") != strings.Join(want, "\n") { + t.Errorf("failed\n%s\nwant\n%s", strings.Join(got, "\n"), strings.Join(want, "\n")) + } + if res.Tests != 3 { + t.Errorf("%d tests counted, want 3", res.Tests) + } + for _, c := range *calls { + if strings.Contains(c.line, " test ") && strings.Contains(c.line, "-failfast") { + t.Errorf("go test ran with -failfast: %s", c.line) + } + } +} + // 1290/AC2: a fixture whose tests take more than the bound (lowered by the module's option, not by waiting five // seconds): the level fails naming the bound and the slowest tests; under the real bound the same run passes. func TestUnitLevelOverItsBoundFailsNamingTheBoundAndTheSlowestTests(t *testing.T) { diff --git a/modules/mesh-build-go/cmd/mesh-build-go/testdata/captured/README b/modules/mesh-build-go/cmd/mesh-build-go/testdata/captured/README index 194bc050..5326c73b 100644 --- a/modules/mesh-build-go/cmd/mesh-build-go/testdata/captured/README +++ b/modules/mesh-build-go/cmd/mesh-build-go/testdata/captured/README @@ -1,6 +1,7 @@ Each file is the standard output of `GOTOOLCHAIN=go1.27.1 GOFLAGS=-mod=mod go test -count=1 -json ./...` (go1.27.1) run in the fixture module of the same name under ../repos, captured on 2026-10-20 for issue 1290. The unit -tests feed them to the parser through a fake runner, so no test here runs `go test`. +tests feed them to the parser through a fake runner, so no test here runs `go test`. twofailing.json was captured the +same way on 2026-10-24 for issue 1921: two packages with a failing test each, and a passing test beside one of them. golist-external.json is `GOTOOLCHAIN=go1.27.1 GOFLAGS=-mod=mod go list -json=ImportPath,Standard,DepOnly,Module git.novox.be/novox/mesh-sdk/go/buildstep` run in this module (go1.27.1, 2026-10-20 for issue 1291): a package of a module diff --git a/modules/mesh-build-go/cmd/mesh-build-go/testdata/captured/twofailing.json b/modules/mesh-build-go/cmd/mesh-build-go/testdata/captured/twofailing.json new file mode 100644 index 00000000..52a6a25c --- /dev/null +++ b/modules/mesh-build-go/cmd/mesh-build-go/testdata/captured/twofailing.json @@ -0,0 +1,23 @@ +{"Time":"2026-10-24T23:45:37.721718705+02:00","Action":"start","Package":"fixture/twofailing/one"} +{"Time":"2026-10-24T23:45:37.723685152+02:00","Action":"run","Package":"fixture/twofailing/one","Test":"TestOneIsTwo"} +{"Time":"2026-10-24T23:45:37.723726472+02:00","Action":"output","Package":"fixture/twofailing/one","Test":"TestOneIsTwo","Output":"=== RUN TestOneIsTwo\n","OutputType":"frame"} +{"Time":"2026-10-24T23:45:37.723743682+02:00","Action":"output","Package":"fixture/twofailing/one","Test":"TestOneIsTwo","Output":" one_test.go:6: checking One\n"} +{"Time":"2026-10-24T23:45:37.723750622+02:00","Action":"output","Package":"fixture/twofailing/one","Test":"TestOneIsTwo","Output":" one_test.go:8: One() = 1, want 2\n","OutputType":"error"} +{"Time":"2026-10-24T23:45:37.723759302+02:00","Action":"output","Package":"fixture/twofailing/one","Test":"TestOneIsTwo","Output":"--- FAIL: TestOneIsTwo (0.00s)\n","OutputType":"frame"} +{"Time":"2026-10-24T23:45:37.723889303+02:00","Action":"start","Package":"fixture/twofailing/two"} +{"Time":"2026-10-24T23:45:37.723762972+02:00","Action":"fail","Package":"fixture/twofailing/one","Test":"TestOneIsTwo","Elapsed":0} +{"Time":"2026-10-24T23:45:37.723952274+02:00","Action":"run","Package":"fixture/twofailing/one","Test":"TestOneIsOne"} +{"Time":"2026-10-24T23:45:37.723955484+02:00","Action":"output","Package":"fixture/twofailing/one","Test":"TestOneIsOne","Output":"=== RUN TestOneIsOne\n","OutputType":"frame"} +{"Time":"2026-10-24T23:45:37.723959304+02:00","Action":"output","Package":"fixture/twofailing/one","Test":"TestOneIsOne","Output":"--- PASS: TestOneIsOne (0.00s)\n","OutputType":"frame"} +{"Time":"2026-10-24T23:45:37.723964914+02:00","Action":"pass","Package":"fixture/twofailing/one","Test":"TestOneIsOne","Elapsed":0} +{"Time":"2026-10-24T23:45:37.723967704+02:00","Action":"output","Package":"fixture/twofailing/one","Output":"FAIL\n","OutputType":"frame"} +{"Time":"2026-10-24T23:45:37.724225126+02:00","Action":"output","Package":"fixture/twofailing/one","Output":"FAIL\tfixture/twofailing/one\t0.002s\n","OutputType":"frame"} +{"Time":"2026-10-24T23:45:37.724231936+02:00","Action":"fail","Package":"fixture/twofailing/one","Elapsed":0.003} +{"Time":"2026-10-24T23:45:37.725752949+02:00","Action":"run","Package":"fixture/twofailing/two","Test":"TestTwoIsThree"} +{"Time":"2026-10-24T23:45:37.725796309+02:00","Action":"output","Package":"fixture/twofailing/two","Test":"TestTwoIsThree","Output":"=== RUN TestTwoIsThree\n","OutputType":"frame"} +{"Time":"2026-10-24T23:45:37.725808239+02:00","Action":"output","Package":"fixture/twofailing/two","Test":"TestTwoIsThree","Output":" two_test.go:7: Two() = 2, want 3\n","OutputType":"error"} +{"Time":"2026-10-24T23:45:37.72581671+02:00","Action":"output","Package":"fixture/twofailing/two","Test":"TestTwoIsThree","Output":"--- FAIL: TestTwoIsThree (0.00s)\n","OutputType":"frame"} +{"Time":"2026-10-24T23:45:37.72582026+02:00","Action":"fail","Package":"fixture/twofailing/two","Test":"TestTwoIsThree","Elapsed":0} +{"Time":"2026-10-24T23:45:37.72582549+02:00","Action":"output","Package":"fixture/twofailing/two","Output":"FAIL\n","OutputType":"frame"} +{"Time":"2026-10-24T23:45:37.726319344+02:00","Action":"output","Package":"fixture/twofailing/two","Output":"FAIL\tfixture/twofailing/two\t0.002s\n","OutputType":"frame"} +{"Time":"2026-10-24T23:45:37.726362544+02:00","Action":"fail","Package":"fixture/twofailing/two","Elapsed":0.002} diff --git a/modules/mesh-build-go/cmd/mesh-build-go/testdata/repos/twofailing/go.mod b/modules/mesh-build-go/cmd/mesh-build-go/testdata/repos/twofailing/go.mod new file mode 100644 index 00000000..e3103525 --- /dev/null +++ b/modules/mesh-build-go/cmd/mesh-build-go/testdata/repos/twofailing/go.mod @@ -0,0 +1,3 @@ +module fixture/twofailing + +go 1.25.0 diff --git a/modules/mesh-build-go/cmd/mesh-build-go/testdata/repos/twofailing/one/one.go b/modules/mesh-build-go/cmd/mesh-build-go/testdata/repos/twofailing/one/one.go new file mode 100644 index 00000000..93c23e66 --- /dev/null +++ b/modules/mesh-build-go/cmd/mesh-build-go/testdata/repos/twofailing/one/one.go @@ -0,0 +1,3 @@ +package one + +func One() int { return 1 } diff --git a/modules/mesh-build-go/cmd/mesh-build-go/testdata/repos/twofailing/one/one_test.go b/modules/mesh-build-go/cmd/mesh-build-go/testdata/repos/twofailing/one/one_test.go new file mode 100644 index 00000000..44e165f2 --- /dev/null +++ b/modules/mesh-build-go/cmd/mesh-build-go/testdata/repos/twofailing/one/one_test.go @@ -0,0 +1,16 @@ +package one + +import "testing" + +func TestOneIsTwo(t *testing.T) { + t.Log("checking One") + if One() != 2 { + t.Fatalf("One() = %d, want 2", One()) + } +} + +func TestOneIsOne(t *testing.T) { + if One() != 1 { + t.Fatal("one") + } +} diff --git a/modules/mesh-build-go/cmd/mesh-build-go/testdata/repos/twofailing/two/two.go b/modules/mesh-build-go/cmd/mesh-build-go/testdata/repos/twofailing/two/two.go new file mode 100644 index 00000000..2c10eb4c --- /dev/null +++ b/modules/mesh-build-go/cmd/mesh-build-go/testdata/repos/twofailing/two/two.go @@ -0,0 +1,3 @@ +package two + +func Two() int { return 2 } diff --git a/modules/mesh-build-go/cmd/mesh-build-go/testdata/repos/twofailing/two/two_test.go b/modules/mesh-build-go/cmd/mesh-build-go/testdata/repos/twofailing/two/two_test.go new file mode 100644 index 00000000..cef76c25 --- /dev/null +++ b/modules/mesh-build-go/cmd/mesh-build-go/testdata/repos/twofailing/two/two_test.go @@ -0,0 +1,9 @@ +package two + +import "testing" + +func TestTwoIsThree(t *testing.T) { + if Two() != 3 { + t.Errorf("Two() = %d, want 3", Two()) + } +} diff --git a/modules/mesh-build-go/go.mod b/modules/mesh-build-go/go.mod index a5118d4a..46e9e151 100644 --- a/modules/mesh-build-go/go.mod +++ b/modules/mesh-build-go/go.mod @@ -3,7 +3,7 @@ module meshbuildgo go 1.26.0 require ( - git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261024125710-bfc3883af980 + git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261024214154-bc16740feb0d github.com/distribution/distribution/v3 v3.1.2 github.com/nats-io/nats-server/v2 v2.11.17 github.com/nats-io/nats.go v1.54.0 diff --git a/modules/mesh-build-go/go.sum b/modules/mesh-build-go/go.sum index f32f243f..0f0bc5de 100644 --- a/modules/mesh-build-go/go.sum +++ b/modules/mesh-build-go/go.sum @@ -1,5 +1,5 @@ -git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261024125710-bfc3883af980 h1:ZEEeYibEPD1rngOAqbODzRY5rUStGC46OpyQwtNCYbs= -git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261024125710-bfc3883af980/go.mod h1:ouERNpZizzwZ0HLEtAypsY9FR20FyUgUYRni6J7kVCY= +git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261024214154-bc16740feb0d h1:oJREw0ggKqJWJ5DEISSL0i2ZC5XqdXAidxo9NJ74TCc= +git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261024214154-bc16740feb0d/go.mod h1:ouERNpZizzwZ0HLEtAypsY9FR20FyUgUYRni6J7kVCY= github.com/alicebob/miniredis/v2 v2.35.0 h1:QwLphYqCEAo1eu1TqPRN2jgVMPBweeQcR21jeqDCONI= github.com/alicebob/miniredis/v2 v2.35.0/go.mod h1:TcL7YfarKPGDAthEtl5NBeHZfeUQj6OXMm/+iu5cLMM= github.com/antithesishq/antithesis-sdk-go v0.7.0-default-no-op h1:Z/MZK75wC/NSrkgqeNIa7jexam9uWzhLmFTSCPI/kn0= diff --git a/modules/mesh-build-node/go.mod b/modules/mesh-build-node/go.mod index 612d489b..0211e575 100644 --- a/modules/mesh-build-node/go.mod +++ b/modules/mesh-build-node/go.mod @@ -3,7 +3,7 @@ module meshbuildnode go 1.26.0 require ( - git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261023213200-403a5d72ab93 + git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261024214154-bc16740feb0d github.com/distribution/distribution/v3 v3.1.2 github.com/nats-io/nats.go v1.54.0 ) diff --git a/modules/mesh-build-node/go.sum b/modules/mesh-build-node/go.sum index f7f15fa5..1e321670 100644 --- a/modules/mesh-build-node/go.sum +++ b/modules/mesh-build-node/go.sum @@ -1,5 +1,5 @@ -git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261023213200-403a5d72ab93 h1:FAiFY2KBKEoZSH49OZTt7/zRBIQxyl5g/KhYrpggbN4= -git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261023213200-403a5d72ab93/go.mod h1:ouERNpZizzwZ0HLEtAypsY9FR20FyUgUYRni6J7kVCY= +git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261024214154-bc16740feb0d h1:oJREw0ggKqJWJ5DEISSL0i2ZC5XqdXAidxo9NJ74TCc= +git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261024214154-bc16740feb0d/go.mod h1:ouERNpZizzwZ0HLEtAypsY9FR20FyUgUYRni6J7kVCY= github.com/alicebob/miniredis/v2 v2.35.0 h1:QwLphYqCEAo1eu1TqPRN2jgVMPBweeQcR21jeqDCONI= github.com/alicebob/miniredis/v2 v2.35.0/go.mod h1:TcL7YfarKPGDAthEtl5NBeHZfeUQj6OXMm/+iu5cLMM= github.com/antithesishq/antithesis-sdk-go v0.7.0-default-no-op h1:Z/MZK75wC/NSrkgqeNIa7jexam9uWzhLmFTSCPI/kn0=