summaryrefslogtreecommitdiff
path: root/spec/requests/api
diff options
context:
space:
mode:
Diffstat (limited to 'spec/requests/api')
-rw-r--r--spec/requests/api/ci/jobs_spec.rb38
1 files changed, 8 insertions, 30 deletions
diff --git a/spec/requests/api/ci/jobs_spec.rb b/spec/requests/api/ci/jobs_spec.rb
index 25871beeb4f..ed0cec46a42 100644
--- a/spec/requests/api/ci/jobs_spec.rb
+++ b/spec/requests/api/ci/jobs_spec.rb
@@ -546,40 +546,18 @@ RSpec.describe API::Ci::Jobs, feature_category: :continuous_integration do
describe 'GET /projects/:id/jobs rate limited' do
let(:query) { {} }
- context 'with the ci_enforce_rate_limits_jobs_api feature flag on' do
- before do
- stub_feature_flags(ci_enforce_rate_limits_jobs_api: true)
-
- allow_next_instance_of(Gitlab::ApplicationRateLimiter::BaseStrategy) do |strategy|
- threshold = Gitlab::ApplicationRateLimiter.rate_limits[:jobs_index][:threshold]
- allow(strategy).to receive(:increment).and_return(threshold + 1)
- end
-
- get api("/projects/#{project.id}/jobs", api_user), params: query
+ before do
+ allow_next_instance_of(Gitlab::ApplicationRateLimiter::BaseStrategy) do |strategy|
+ threshold = Gitlab::ApplicationRateLimiter.rate_limits[:jobs_index][:threshold]
+ allow(strategy).to receive(:increment).and_return(threshold + 1)
end
- it 'enforces rate limits for the endpoint' do
- expect(response).to have_gitlab_http_status :too_many_requests
- expect(json_response['message']['error']).to eq('This endpoint has been requested too many times. Try again later.')
- end
+ get api("/projects/#{project.id}/jobs", api_user), params: query
end
- context 'with the ci_enforce_rate_limits_jobs_api feature flag off' do
- before do
- stub_feature_flags(ci_enforce_rate_limits_jobs_api: false)
-
- allow_next_instance_of(Gitlab::ApplicationRateLimiter::BaseStrategy) do |strategy|
- threshold = Gitlab::ApplicationRateLimiter.rate_limits[:jobs_index][:threshold]
- allow(strategy).to receive(:increment).and_return(threshold + 1)
- end
-
- get api("/projects/#{project.id}/jobs", api_user), params: query
- end
-
- it 'makes a successful request' do
- expect(response).to have_gitlab_http_status(:ok)
- expect(response).to include_limited_pagination_headers
- end
+ it 'enforces rate limits for the endpoint' do
+ expect(response).to have_gitlab_http_status :too_many_requests
+ expect(json_response['message']['error']).to eq('This endpoint has been requested too many times. Try again later.')
end
end