From f0fe4541450746a70e5e3a559dfb2352e25876dd Mon Sep 17 00:00:00 2001 From: jochen Date: Mon, 26 Oct 2026 12:23:57 +0100 Subject: [PATCH] Checker: a result with skipped tests keeps no verdict, so a skipped pass is run again (issue 890) --- .../mesh-delivery-checker/internal/check/kept.go | 8 +++++++- .../internal/check/kept_test.go | 13 +++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/modules/mesh-delivery-checker/internal/check/kept.go b/modules/mesh-delivery-checker/internal/check/kept.go index 25d92ad..71bd97e 100644 --- a/modules/mesh-delivery-checker/internal/check/kept.go +++ b/modules/mesh-delivery-checker/internal/check/kept.go @@ -56,9 +56,15 @@ func (k Kept) Keep(ctx context.Context, level, digest string, v delivery.Kept) ( // KeepPasses keeps, for the packages of a test result that passed with tests, a verdict under the digest the build module // named for the package at the level. A package that failed, has no tests or has no digest is never kept (ADR 0444 clause -// 1): it runs every check. It answers the packages it kept now. +// 1): it runs every check. A result in which any test skipped keeps nothing: the build module counts skips per result, +// not per package, so no package of it is known to have run whole, and a pass that skipped (a test needing a toolchain the +// node lacks) would otherwise be reused for its digest and never run anywhere (issue 890). It answers the packages it +// kept now. func (k Kept) KeepPasses(ctx context.Context, repository, level, toolchain string, res Tested, digests map[string]string, at time.Time) ([]string, error) { var kept []string + if res.Skipped > 0 { + return kept, nil + } for _, p := range res.Packages { digest, ok := digests[p.Package] if !ok || !p.Passed || p.NoTests || p.Tests == 0 { diff --git a/modules/mesh-delivery-checker/internal/check/kept_test.go b/modules/mesh-delivery-checker/internal/check/kept_test.go index c2ff33b..da63eca 100644 --- a/modules/mesh-delivery-checker/internal/check/kept_test.go +++ b/modules/mesh-delivery-checker/internal/check/kept_test.go @@ -74,6 +74,19 @@ func TestOnlyPassingPackagesWithADigestAreKept(t *testing.T) { // 1287/AC3, AC4 } } +func TestAResultWithSkippedTestsKeepsNothing(t *testing.T) { // issue 890: a pass that skipped proved nothing + ctx, st := context.Background(), newMemKV() + k := Kept{Store: st} + res := Tested{Level: "integration", Passed: true, Skipped: 2, Packages: []GoPackage{{Package: "m/a", Passed: true, Tests: 4}}} + kept, err := k.KeepPasses(ctx, "novox/mesh-catalog", "integration", "go1.26.0", res, map[string]string{"m/a": digA}, at0) + if err != nil || len(kept) != 0 { + t.Fatalf("kept %v, %v, want nothing", kept, err) + } + if keys, _ := st.Keys(ctx); len(keys) != 0 { + t.Errorf("the bucket holds %v, want none", keys) + } +} + func TestAKeptValueOfAnotherDigestIsNotRead(t *testing.T) { // 1287/AC7 ctx, st := context.Background(), newMemKV() k := Kept{Store: st}