From 922b5d431313dfc36484b2bde4521c3b3af3c979 Mon Sep 17 00:00:00 2001 From: Tatiana Bradley Date: Tue, 4 Jun 2024 16:59:28 -0400 Subject: [PATCH] all_test: allow duplicate summaries for unreviewed reports Modify the corpus-wide report lint check to allow unreviewed reports to have the same summary as other (reviewed or unreviwed) reports. Reviewed reports must still have unique summaries (but may share a summary with one or more unreviewed reports). Change-Id: I8ab4fc259e019c0fb529ed0ef332cc9cfe634483 Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/590279 LUCI-TryBot-Result: Go LUCI Reviewed-by: Damien Neil --- all_test.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/all_test.go b/all_test.go index 1ab57392..54cec790 100644 --- a/all_test.go +++ b/all_test.go @@ -112,11 +112,14 @@ func TestLintReports(t *testing.T) { aliases[alias] = filename } } - if summary := r.Summary.String(); summary != "" { - if report, ok := summaries[summary]; ok { - t.Errorf("report %s shares duplicate summary %q with report %s", filename, summary, report) - } else { - summaries[summary] = filename + // Ensure that each reviewed report has a unique summary. + if r.IsReviewed() { + if summary := r.Summary.String(); summary != "" { + if report, ok := summaries[summary]; ok { + t.Errorf("report %s shares duplicate summary %q with report %s", filename, summary, report) + } else { + summaries[summary] = filename + } } } // Check that a correct OSV file was generated for each YAML report.