From a323b95b3092f6a1337b46ba11c2c5f70b6bb418 Mon Sep 17 00:00:00 2001 From: Sam Sneddon Date: Fri, 11 Oct 2024 14:48:56 -0700 Subject: [PATCH] Make is:tentative match tentative directories Per https://web-platform-tests.org/writing-tests/file-names.html, tentative can be set at a directory level via the directory being called "tentative". --- api/query/cache/index/filter.go | 2 +- api/query/cache/index/index_filter_test.go | 50 ++++++++++++++++------ 2 files changed, 39 insertions(+), 13 deletions(-) diff --git a/api/query/cache/index/filter.go b/api/query/cache/index/filter.go index dd319715288..27cf3692e31 100644 --- a/api/query/cache/index/filter.go +++ b/api/query/cache/index/filter.go @@ -385,7 +385,7 @@ func (q MetadataQuality) Filter(t TestID) bool { return false } - return strings.Contains(name, ".tentative.") + return strings.Contains(name, ".tentative.") || strings.Contains(name, "/tentative/") case query.MetadataQualityOptional: // is:optional only returns rows from tests with .optional. // in their name. See diff --git a/api/query/cache/index/index_filter_test.go b/api/query/cache/index/index_filter_test.go index a825ea8a2c2..cd3122a0be4 100644 --- a/api/query/cache/index/index_filter_test.go +++ b/api/query/cache/index/index_filter_test.go @@ -1037,6 +1037,14 @@ func TestBindExecute_IsTentative(t *testing.T) { Test: "/a/b/c.tentative.html", Status: "PASS", }, + { + Test: "/a/b/tentative/c", + Status: "PASS", + }, + { + Test: "/a/b/tentative/c.tentative.html", + Status: "PASS", + }, }, }, }, @@ -1050,20 +1058,38 @@ func TestBindExecute_IsTentative(t *testing.T) { srs, ok := res.([]shared.SearchResult) assert.True(t, ok) - assert.Equal(t, 1, len(srs)) - expectedResult := shared.SearchResult{ - Test: "/a/b/c.tentative.html", - LegacyStatus: []shared.LegacySearchRunResult{ - { - Passes: 1, - Total: 1, - Status: "", - NewAggProcess: true, + assert.Equal(t, 3, len(srs)) + assert.Equal(t, resultSet(t, []shared.SearchResult{ + { + Test: "/a/b/c.tentative.html", + LegacyStatus: []shared.LegacySearchRunResult{ + { + Passes: 1, + Total: 1, + Status: "", + NewAggProcess: true, + }, + }, + Test: "/a/b/tentative/c.html", + LegacyStatus: []shared.LegacySearchRunResult{ + { + Passes: 1, + Total: 1, + Status: "", + NewAggProcess: true, + }, + }, + Test: "/a/b/tentative/c.tentative.html", + LegacyStatus: []shared.LegacySearchRunResult{ + { + Passes: 1, + Total: 1, + Status: "", + NewAggProcess: true, + }, }, }, - } - - assert.Equal(t, expectedResult, srs[0]) + }), resultSet(t, srs)) } func TestBindExecute_IsOptional(t *testing.T) {