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 <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
This commit is contained in:
Tatiana Bradley 2024-06-04 16:59:28 -04:00
Родитель a75c727173
Коммит 922b5d4313
1 изменённых файлов: 8 добавлений и 5 удалений

Просмотреть файл

@ -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.