Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorVladimir Shushlin <v.shushlin@gmail.com>2021-12-14 15:02:13 +0300
committerVladimir Shushlin <v.shushlin@gmail.com>2021-12-14 17:11:30 +0300
commit097c4c0aec8ddb0028ed8be8ed338d87020c5a9b (patch)
treea1cb6d0b4b5ca99a0604d93a106b21a22d1b7dc4 /test
parentcc23d6ef34be2fd5e6dff719dd1eb62a51b7a82f (diff)
refactor: extract common logic for env feature flags
Diffstat (limited to 'test')
-rw-r--r--test/acceptance/ratelimiter_test.go3
-rw-r--r--test/acceptance/redirects_test.go8
-rw-r--r--test/acceptance/rewrites_test.go4
3 files changed, 8 insertions, 7 deletions
diff --git a/test/acceptance/ratelimiter_test.go b/test/acceptance/ratelimiter_test.go
index 5b3be98a..ae6184ca 100644
--- a/test/acceptance/ratelimiter_test.go
+++ b/test/acceptance/ratelimiter_test.go
@@ -8,11 +8,12 @@ import (
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitlab-pages/internal/feature"
"gitlab.com/gitlab-org/gitlab-pages/internal/testhelpers"
)
func TestSourceIPRateLimitMiddleware(t *testing.T) {
- testhelpers.SetEnvironmentVariable(t, testhelpers.FFEnableRateLimiter, "true")
+ testhelpers.StubFeatureFlagValue(t, feature.EnforceIPRateLimits.EnvVariable, true)
tcs := map[string]struct {
listener ListenSpec
diff --git a/test/acceptance/redirects_test.go b/test/acceptance/redirects_test.go
index 0cadea16..685e0fcb 100644
--- a/test/acceptance/redirects_test.go
+++ b/test/acceptance/redirects_test.go
@@ -6,15 +6,15 @@ import (
"net/http"
"testing"
- "github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitlab-pages/internal/feature"
- redirects "gitlab.com/gitlab-org/gitlab-pages/internal/redirects"
+ "github.com/stretchr/testify/require"
)
func TestRedirectStatusPage(t *testing.T) {
RunPagesProcess(t,
withListeners([]ListenSpec{httpListener}),
- withEnv([]string{redirects.FFEnablePlaceholders + "=true"}),
+ withEnv([]string{feature.RedirectsPlaceholders.EnvVariable + "=true"}),
)
rsp, err := GetPageFromListener(t, httpListener, "group.redirects.gitlab-example.com", "/project-redirects/_redirects")
@@ -31,7 +31,7 @@ func TestRedirectStatusPage(t *testing.T) {
func TestRedirect(t *testing.T) {
RunPagesProcess(t,
withListeners([]ListenSpec{httpListener}),
- withEnv([]string{redirects.FFEnablePlaceholders + "=true"}),
+ withEnv([]string{feature.RedirectsPlaceholders.EnvVariable + "=true"}),
)
// Test that serving a file still works with redirects enabled
diff --git a/test/acceptance/rewrites_test.go b/test/acceptance/rewrites_test.go
index 5ac16070..aa105789 100644
--- a/test/acceptance/rewrites_test.go
+++ b/test/acceptance/rewrites_test.go
@@ -7,13 +7,13 @@ import (
"github.com/stretchr/testify/require"
- redirects "gitlab.com/gitlab-org/gitlab-pages/internal/redirects"
+ "gitlab.com/gitlab-org/gitlab-pages/internal/feature"
)
func TestRewrites(t *testing.T) {
RunPagesProcess(t,
withListeners([]ListenSpec{httpListener}),
- withEnv([]string{redirects.FFEnablePlaceholders + "=true"}),
+ withEnv([]string{feature.RedirectsPlaceholders.EnvVariable + "=true"}),
)
tests := map[string]struct {