Commit 5737d7f7 authored by Etienne Baqué's avatar Etienne Baqué

Merge branch...

Merge branch '345135-spec-failure-in-spec-controllers-projects-issues_controller_spec-rb-projects' into 'master'

Set issues_create_limit lower to reduce flakiness

See merge request gitlab-org/gitlab!74149
parents 9805fa27 c1a9e22b
...@@ -495,13 +495,12 @@ RSpec.describe Groups::EpicsController do ...@@ -495,13 +495,12 @@ RSpec.describe Groups::EpicsController do
context 'when the endpoint receives requests above the limit', :freeze_time, :clean_gitlab_redis_rate_limiting do context 'when the endpoint receives requests above the limit', :freeze_time, :clean_gitlab_redis_rate_limiting do
before do before do
stub_application_setting(issues_create_limit: 5) stub_application_setting(issues_create_limit: 1)
end end
it 'prevents from creating more epics' do it 'prevents from creating more epics' do
5.times { post :create, params: { group_id: group, epic: { title: 'new epic', description: 'description' } } } 2.times { post :create, params: { group_id: group, epic: { title: 'new epic', description: 'description' } } }
post :create, params: { group_id: group, epic: { title: 'new epic', description: 'description' } }
expect(response.body).to eq(_('This endpoint has been requested too many times. Try again later.')) expect(response.body).to eq(_('This endpoint has been requested too many times. Try again later.'))
expect(response).to have_gitlab_http_status(:too_many_requests) expect(response).to have_gitlab_http_status(:too_many_requests)
end end
...@@ -519,7 +518,7 @@ RSpec.describe Groups::EpicsController do ...@@ -519,7 +518,7 @@ RSpec.describe Groups::EpicsController do
expect(Gitlab::AuthLogger).to receive(:error).with(attributes).once expect(Gitlab::AuthLogger).to receive(:error).with(attributes).once
6.times { post :create, params: { group_id: group, epic: { title: 'new epic', description: 'description' } } } 2.times { post :create, params: { group_id: group, epic: { title: 'new epic', description: 'description' } } }
end end
end end
end end
......
...@@ -1410,12 +1410,12 @@ RSpec.describe Projects::IssuesController do ...@@ -1410,12 +1410,12 @@ RSpec.describe Projects::IssuesController do
context 'when the endpoint receives requests above the limit', :freeze_time, :clean_gitlab_redis_rate_limiting do context 'when the endpoint receives requests above the limit', :freeze_time, :clean_gitlab_redis_rate_limiting do
before do before do
stub_application_setting(issues_create_limit: 5) stub_application_setting(issues_create_limit: 1)
end end
context 'when issue creation limits imposed' do context 'when issue creation limits imposed' do
it 'prevents from creating more issues', :request_store do it 'prevents from creating more issues', :request_store do
5.times { post_new_issue } post_new_issue
expect { post_new_issue } expect { post_new_issue }
.to change { Gitlab::GitalyClient.get_request_count }.by(1) # creates 1 projects and 0 issues .to change { Gitlab::GitalyClient.get_request_count }.by(1) # creates 1 projects and 0 issues
...@@ -1442,7 +1442,7 @@ RSpec.describe Projects::IssuesController do ...@@ -1442,7 +1442,7 @@ RSpec.describe Projects::IssuesController do
project.add_developer(user) project.add_developer(user)
sign_in(user) sign_in(user)
6.times do 2.times do
post :create, params: { post :create, params: {
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project, project_id: project,
......
...@@ -309,7 +309,7 @@ RSpec.describe Gitlab::Email::Handler::ServiceDeskHandler do ...@@ -309,7 +309,7 @@ RSpec.describe Gitlab::Email::Handler::ServiceDeskHandler do
context 'when limit is higher than sent emails' do context 'when limit is higher than sent emails' do
before do before do
stub_application_setting(issues_create_limit: 3) stub_application_setting(issues_create_limit: 2)
end end
it 'creates 2 issues' do it 'creates 2 issues' do
......
...@@ -329,9 +329,9 @@ RSpec.describe Issues::CreateService do ...@@ -329,9 +329,9 @@ RSpec.describe Issues::CreateService do
end end
end end
context 'when limit is higher than counf of issues being created' do context 'when limit is higher than count of issues being created' do
before do before do
stub_application_setting(issues_create_limit: 3) stub_application_setting(issues_create_limit: 2)
end end
it 'creates 2 issues' do it 'creates 2 issues' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment