From 8011c2899bb31ca316eed7fec1321fae2016863d Mon Sep 17 00:00:00 2001 From: Jaime Martinez Date: Fri, 1 Jul 2022 13:30:43 +1000 Subject: Enable FF_ENABLE_PLACEHOLDERS by default Changelog: added --- internal/feature/feature.go | 3 ++- internal/redirects/matching_test.go | 3 +++ internal/redirects/validations_test.go | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/feature/feature.go b/internal/feature/feature.go index a012fc49..337bf2f1 100644 --- a/internal/feature/feature.go +++ b/internal/feature/feature.go @@ -34,7 +34,8 @@ var EnforceIPTLSRateLimits = Feature{ // RedirectsPlaceholders enables support for placeholders in redirects file // TODO: remove https://gitlab.com/gitlab-org/gitlab-pages/-/issues/620 var RedirectsPlaceholders = Feature{ - EnvVariable: "FF_ENABLE_PLACEHOLDERS", + EnvVariable: "FF_ENABLE_PLACEHOLDERS", + defaultEnabled: true, } // HandleReadErrors reports vfs.ReadErrors to sentry and enable error handling diff --git a/internal/redirects/matching_test.go b/internal/redirects/matching_test.go index 1460dfb1..23815b97 100644 --- a/internal/redirects/matching_test.go +++ b/internal/redirects/matching_test.go @@ -312,6 +312,9 @@ func Test_matchesRule(t *testing.T) { // feature flag is not enabled. These tests can be removed when the // `FF_ENABLE_PLACEHOLDERS` flag is removed. func Test_matchesRule_NoPlaceholders(t *testing.T) { + // disable placeholders on purpose + t.Setenv(feature.RedirectsPlaceholders.EnvVariable, "false") + tests := mergeTestSuites(testsWithoutPlaceholders, map[string]testCaseData{ // Note: the following 3 case behaves differently when // placeholders are enabled. See the similar test cases above. diff --git a/internal/redirects/validations_test.go b/internal/redirects/validations_test.go index 0d6df3ec..5f3a24ec 100644 --- a/internal/redirects/validations_test.go +++ b/internal/redirects/validations_test.go @@ -73,6 +73,9 @@ func TestRedirectsValidateUrl(t *testing.T) { // feature flag is not enabled. These tests can be removed when the // `FF_ENABLE_PLACEHOLDERS` flag is removed. func TestRedirectsValidateUrlNoPlaceholders(t *testing.T) { + // disable placeholders on purpose + t.Setenv(feature.RedirectsPlaceholders.EnvVariable, "false") + tests := map[string]struct { url string expectedErr error -- cgit v1.2.3