summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-03 00:09:03 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-03 00:09:03 +0000
commita2a712139fc7fa58aa02b143f2767286d28ef28d (patch)
treeb62661ce7c26bfa679bec8f360c99b8214ec4ae5 /qa
parentedfec24c1d7adefa03568c97b50f730a6196f9d2 (diff)
downloadgitlab-ce-a2a712139fc7fa58aa02b143f2767286d28ef28d.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r--qa/Gemfile.lock2
-rw-r--r--qa/qa/runtime/search.rb19
2 files changed, 17 insertions, 4 deletions
diff --git a/qa/Gemfile.lock b/qa/Gemfile.lock
index 6d48a9449a5..cd73e1b6539 100644
--- a/qa/Gemfile.lock
+++ b/qa/Gemfile.lock
@@ -94,7 +94,7 @@ GEM
rspec-core (>= 2, < 4, != 2.12.0)
ruby-debug-ide (0.7.0)
rake (>= 0.8.1)
- rubyzip (1.2.2)
+ rubyzip (1.3.0)
selenium-webdriver (3.142.6)
childprocess (>= 0.5, < 4.0)
rubyzip (>= 1.2.2)
diff --git a/qa/qa/runtime/search.rb b/qa/qa/runtime/search.rb
index 74402301098..29a71b2815c 100644
--- a/qa/qa/runtime/search.rb
+++ b/qa/qa/runtime/search.rb
@@ -35,6 +35,8 @@ module QA
)
end
+ verify_search_engine_ok(search_term)
+
find_commit(commit, "commit*#{search_term}")
find_project(project, "to-search*#{search_term}")
end
@@ -74,9 +76,7 @@ module QA
end
def search(scope, term)
- QA::Runtime::Logger.debug("Search scope '#{scope}' for '#{term}'...")
- request = Runtime::API::Request.new(api_client, "/search?scope=#{scope}&search=#{term}")
- response = get(request.url)
+ response = get_response(scope, term)
unless response.code == singleton_class::HTTP_STATUS_OK
msg = "Search attempt failed. Request returned (#{response.code}): `#{response}`."
@@ -87,6 +87,19 @@ module QA
parse_body(response)
end
+ def get_response(scope, term)
+ QA::Runtime::Logger.debug("Search scope '#{scope}' for '#{term}'...")
+ request = Runtime::API::Request.new(api_client, "/search?scope=#{scope}&search=#{term}")
+ get(request.url)
+ end
+
+ def verify_search_engine_ok(search_term)
+ response = get_response('commits', search_term)
+ if response.code.to_s =~ /5[0-9][0-9]/
+ raise ElasticSearchServerError, "elasticsearch attempt returned code #{response.code}. Check that search was conducted on the appropriate url and port."
+ end
+ end
+
def api_client
@api_client ||= Runtime::API::Client.new(:gitlab)
end