diff options
author | feistel <6742251-feistel@users.noreply.gitlab.com> | 2022-06-15 16:34:33 +0300 |
---|---|---|
committer | feistel <6742251-feistel@users.noreply.gitlab.com> | 2022-07-05 13:38:27 +0300 |
commit | 68a1d6a18d37061598bf7d74bec4bda8422f0cd2 (patch) | |
tree | b53f918941001b69224b3c200790f2cb48e04970 /internal/handlers/ratelimiter_test.go | |
parent | d23089e4c705d46c6ee61601df75e49ca2ebd677 (diff) |
Remove rate limits feature flags
Changelog: removed
Diffstat (limited to 'internal/handlers/ratelimiter_test.go')
-rw-r--r-- | internal/handlers/ratelimiter_test.go | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/internal/handlers/ratelimiter_test.go b/internal/handlers/ratelimiter_test.go index 1ff1c0e5..19414942 100644 --- a/internal/handlers/ratelimiter_test.go +++ b/internal/handlers/ratelimiter_test.go @@ -3,13 +3,11 @@ package handlers import ( "net/http" "net/http/httptest" - "strconv" "testing" "github.com/stretchr/testify/require" "gitlab.com/gitlab-org/gitlab-pages/internal/config" - "gitlab.com/gitlab-org/gitlab-pages/internal/feature" "gitlab.com/gitlab-org/gitlab-pages/internal/testhelpers" ) @@ -23,8 +21,6 @@ func TestRatelimiter(t *testing.T) { firstTarget string secondRemoteAddr string secondTarget string - sourceIPEnforced bool - domainEnforced bool expectedSecondCode int }{ "rejected_by_ip": { @@ -32,8 +28,6 @@ func TestRatelimiter(t *testing.T) { firstTarget: "https://domain.gitlab.io", secondRemoteAddr: "10.0.0.1", secondTarget: "https://different.gitlab.io", - sourceIPEnforced: true, - domainEnforced: true, expectedSecondCode: http.StatusTooManyRequests, }, "rejected_by_domain": { @@ -41,44 +35,19 @@ func TestRatelimiter(t *testing.T) { firstTarget: "https://domain.gitlab.io", secondRemoteAddr: "10.0.0.2", secondTarget: "https://domain.gitlab.io", - sourceIPEnforced: true, - domainEnforced: true, expectedSecondCode: http.StatusTooManyRequests, }, - "ip_rate_limiter_disabled": { - firstRemoteAddr: "10.0.0.1", - firstTarget: "https://domain.gitlab.io", - secondRemoteAddr: "10.0.0.1", - secondTarget: "https://different.gitlab.io", - sourceIPEnforced: false, - domainEnforced: true, - expectedSecondCode: http.StatusNoContent, - }, - "domain_rate_limiter_disabled": { - firstRemoteAddr: "10.0.0.1", - firstTarget: "https://domain.gitlab.io", - secondRemoteAddr: "10.0.0.2", - secondTarget: "https://domain.gitlab.io", - sourceIPEnforced: true, - domainEnforced: false, - expectedSecondCode: http.StatusNoContent, - }, "different_ip_and_domain_passes": { firstRemoteAddr: "10.0.0.1", firstTarget: "https://domain.gitlab.io", secondRemoteAddr: "10.0.0.2", secondTarget: "https://different.gitlab.io", - sourceIPEnforced: true, - domainEnforced: true, expectedSecondCode: http.StatusNoContent, }, } for name, tc := range tt { t.Run(name, func(t *testing.T) { - t.Setenv(feature.EnforceIPRateLimits.EnvVariable, strconv.FormatBool(tc.sourceIPEnforced)) - t.Setenv(feature.EnforceDomainRateLimits.EnvVariable, strconv.FormatBool(tc.domainEnforced)) - conf := config.RateLimit{ SourceIPLimitPerSecond: 0.1, SourceIPBurst: 1, |