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:
Diffstat (limited to 'spec/requests/api/search_spec.rb')
-rw-r--r--spec/requests/api/search_spec.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/requests/api/search_spec.rb b/spec/requests/api/search_spec.rb
index 8012892a571..b75fe11b06d 100644
--- a/spec/requests/api/search_spec.rb
+++ b/spec/requests/api/search_spec.rb
@@ -122,6 +122,23 @@ RSpec.describe API::Search do
end
end
+ context 'when DB timeouts occur from global searches', :aggregate_errors do
+ %w(
+ issues
+ merge_requests
+ milestones
+ projects
+ snippet_titles
+ users
+ ).each do |scope|
+ it "returns a 408 error if search with scope: #{scope} times out" do
+ allow(SearchService).to receive(:new).and_raise ActiveRecord::QueryCanceled
+ get api(endpoint, user), params: { scope: scope, search: 'awesome' }
+ expect(response).to have_gitlab_http_status(:request_timeout)
+ end
+ end
+ end
+
context 'when scope is not supported' do
it 'returns 400 error' do
get api(endpoint, user), params: { scope: 'unsupported', search: 'awesome' }