Commit 6aeaa97d authored by Sanad Liaquat's avatar Sanad Liaquat

Merge branch 'qa-shl-raise-server-error-on-500' into 'master'

Raise Internal Server Error on 500 in `api_get_from`

See merge request gitlab-org/gitlab!30844
parents 0d07b239 21da0ff7
......@@ -14,6 +14,7 @@ module QA
ResourceQueryError = Class.new(RuntimeError)
ResourceUpdateFailedError = Class.new(RuntimeError)
ResourceURLMissingError = Class.new(RuntimeError)
InternalServerError = Class.new(RuntimeError)
attr_reader :api_resource, :api_response
attr_writer :api_client
......@@ -85,7 +86,9 @@ module QA
url = Runtime::API::Request.new(api_client, get_path).url
response = get(url)
unless response.code == HTTP_STATUS_OK
if response.code == HTTP_STATUS_SERVER_ERROR
raise InternalServerError, "Failed to GET #{url} - (#{response.code}): `#{response}`."
elsif response.code != HTTP_STATUS_OK
raise ResourceNotFoundError, "Resource at #{url} could not be found (#{response.code}): `#{response}`."
end
......
......@@ -7,6 +7,7 @@ module QA
HTTP_STATUS_CREATED = 201
HTTP_STATUS_NO_CONTENT = 204
HTTP_STATUS_ACCEPTED = 202
HTTP_STATUS_SERVER_ERROR = 500
def post(url, payload)
RestClient::Request.execute(
......
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