Commit 1352f433 authored by Walmyr Lima e Silva Filho's avatar Walmyr Lima e Silva Filho

Merge branch 'qa-ml-fail-early-if-template-not-found' into 'master'

Fail E2E tests early if template not found via API

See merge request gitlab-org/gitlab-ce!31955
parents 681fca60 99327de2
......@@ -12,6 +12,10 @@ module QA
@session_address = Runtime::Address.new(api_client.address, request_path)
end
def mask_url
@session_address.address.sub(/private_token=.*/, "private_token=[****]")
end
def url
@session_address.address
end
......
......@@ -3,10 +3,19 @@
module QA
module Runtime
module Fixtures
include Support::Api
TemplateNotFoundError = Class.new(RuntimeError)
def fetch_template_from_api(api_path, key)
request = Runtime::API::Request.new(api_client, "/templates/#{api_path}/#{key}")
get request.url
json_body[:content]
response = get(request.url)
unless response.code == HTTP_STATUS_OK
raise TemplateNotFoundError, "Template at #{request.mask_url} could not be found (#{response.code}): `#{response}`."
end
parse_body(response)[:content]
end
private
......
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