Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions api/query/cache/index/index_filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,61 @@ func TestBindExecute_TestWebFeature(t *testing.T) {
assert.Equal(t, expectedResult, srs[0])
}

func TestBindExecute_TestWebFeature_PreservesCase(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
loader := NewMockReportLoader(ctrl)
idx, err := NewShardedWPTIndex(loader, testNumShards)
assert.Nil(t, err)

matchingTestName := "/custom-elements/Document-createElement-customized-builtins.html"
runs := mockTestRuns(loader, idx, []testRunData{
{
shared.TestRun{ID: 1},
&metrics.TestResultsReport{
Results: []*metrics.TestResults{
{
Test: matchingTestName,
Status: "PASS",
},
{
Test: "/custom-elements/other-test.html",
Status: "FAIL",
},
},
},
},
})

data := shared.WebFeaturesData{
matchingTestName: {"customized-built-in-elements": nil},
"/custom-elements/other-test.html": {"autonomous-custom-elements": nil},
}

testlabel := query.TestWebFeature{WebFeature: "customized-built-in-elements", WebFeaturesData: data}
plan, err := idx.Bind(runs, testlabel)
assert.Nil(t, err)

res := plan.Execute(runs, query.AggregationOpts{})
srs, ok := res.([]shared.SearchResult)
assert.True(t, ok)

assert.Equal(t, 1, len(srs))
expectedResult := shared.SearchResult{
Test: matchingTestName,
LegacyStatus: []shared.LegacySearchRunResult{
{
Passes: 1,
Total: 1,
Status: "",
NewAggProcess: true,
},
},
}

assert.Equal(t, expectedResult, srs[0])
}

func TestBindExecute_IsDifferent(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
Expand Down
2 changes: 1 addition & 1 deletion shared/web_features.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (d webFeaturesManifestV1Data) prepareTestWebFeatureFilter() WebFeaturesData
testToWebFeaturesMap := make(map[string]map[string]interface{})
for webFeature, tests := range d {
for _, test := range tests {
key := strings.ToLower(test)
key := test
value := strings.ToLower(webFeature)
if set, found := testToWebFeaturesMap[key]; found {
set[value] = nil
Expand Down
37 changes: 37 additions & 0 deletions shared/web_features_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,39 @@ func TestWebFeaturesData_TestMatchesWithWebFeature(t *testing.T) {
webFeature: "feature1",
expected: false,
},
{
name: "test name with uppercase characters matches exact case",
data: WebFeaturesData{
"/custom-elements/Document-createElement-customized-builtins.html": map[string]interface{}{
"customized-built-in-elements": nil,
},
},
test: "/custom-elements/Document-createElement-customized-builtins.html",
webFeature: "customized-built-in-elements",
expected: true,
},
{
name: "test name case must match exactly",
data: WebFeaturesData{
"/custom-elements/Document-createElement-customized-builtins.html": map[string]interface{}{
"customized-built-in-elements": nil,
},
},
test: "/custom-elements/document-createelement-customized-builtins.html",
webFeature: "customized-built-in-elements",
expected: false,
},
{
name: "web feature name remains case-insensitive",
data: WebFeaturesData{
"/custom-elements/Document-createElement-customized-builtins.html": map[string]interface{}{
"customized-built-in-elements": nil,
},
},
test: "/custom-elements/Document-createElement-customized-builtins.html",
webFeature: "Customized-Built-In-Elements",
expected: true,
},
}

for _, tc := range tests {
Expand Down Expand Up @@ -123,10 +156,14 @@ func TestWebFeaturesManifestV1Data_prepareTestWebFeatureFilter(t *testing.T) {
},
"feature2": []string{
"/test2",
},
"Feature3": []string{
"/Test3",
}}
expectedResult := WebFeaturesData{
"/test1": {"feature1": nil},
"/test2": {"feature1": nil, "feature2": nil},
"/Test3": {"feature3": nil},
}
result := data.prepareTestWebFeatureFilter()
assert.Equal(t, expectedResult, result)
Expand Down
4 changes: 2 additions & 2 deletions util/deploy-staging.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ if [[ "${APP_PATH}" == "" ]]; then fatal "app path not specified."; fi

APP_DEPS="${APP_PATH}"
if [[ "${APP_PATH}" == webapp/web* ]]; then APP_DEPS="webapp|api|shared"; fi
# Be more conservative: only deploy searchcache when it's directly modified.
if [[ "${APP_PATH}" == api/query/cache/service* ]]; then APP_DEPS="api/query"; fi
# Be more conservative: only deploy searchcache when it or shared are modified.
if [[ "${APP_PATH}" == api/query/cache/service* ]]; then APP_DEPS="api/query|shared"; fi
if [[ "${APP_PATH}" == "results-processor/app.staging.yaml" ]]; then APP_DEPS="results-processor"; fi
APP_DEPS_REGEX="^(${APP_DEPS})/"

Expand Down
Loading