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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-08-19 12:08:42 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-08-19 12:08:42 +0300
commitb76ae638462ab0f673e5915986070518dd3f9ad3 (patch)
treebdab0533383b52873be0ec0eb4d3c66598ff8b91 /spec/controllers/search_controller_spec.rb
parent434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff)
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'spec/controllers/search_controller_spec.rb')
-rw-r--r--spec/controllers/search_controller_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/controllers/search_controller_spec.rb b/spec/controllers/search_controller_spec.rb
index 3a2986f6cbe..e0870e17d99 100644
--- a/spec/controllers/search_controller_spec.rb
+++ b/spec/controllers/search_controller_spec.rb
@@ -53,6 +53,20 @@ RSpec.describe SearchController do
end
end
+ shared_examples_for 'support for active record query timeouts' do |action, params, method_to_stub, format|
+ before do
+ allow_next_instance_of(SearchService) do |service|
+ allow(service).to receive(method_to_stub).and_raise(ActiveRecord::QueryCanceled)
+ end
+ end
+
+ it 'renders a 408 when a timeout occurs' do
+ get action, params: params, format: format
+
+ expect(response).to have_gitlab_http_status(:request_timeout)
+ end
+ end
+
describe 'GET #show' do
it_behaves_like 'when the user cannot read cross project', :show, { search: 'hello' } do
it 'still allows accessing the search page' do
@@ -63,6 +77,7 @@ RSpec.describe SearchController do
end
it_behaves_like 'with external authorization service enabled', :show, { search: 'hello' }
+ it_behaves_like 'support for active record query timeouts', :show, { search: 'hello' }, :search_objects, :html
context 'uses the right partials depending on scope' do
using RSpec::Parameterized::TableSyntax
@@ -230,6 +245,7 @@ RSpec.describe SearchController do
describe 'GET #count' do
it_behaves_like 'when the user cannot read cross project', :count, { search: 'hello', scope: 'projects' }
it_behaves_like 'with external authorization service enabled', :count, { search: 'hello', scope: 'projects' }
+ it_behaves_like 'support for active record query timeouts', :count, { search: 'hello', scope: 'projects' }, :search_results, :json
it 'returns the result count for the given term and scope' do
create(:project, :public, name: 'hello world')