Commit fc9a7371 authored by Mark Lapierre's avatar Mark Lapierre

Handle errors when removing a runner

A QA test failed in staging while trying to remove a runner, but it's
not clear why. This adds error handling to provide some feedback.
parent 2bfa0357
......@@ -115,8 +115,8 @@ module QA
post_body
end
def runners
response = get Runtime::API::Request.new(api_client, api_runners_path).url
def runners(tag_list: nil)
response = get Runtime::API::Request.new(api_client, "#{api_runners_path}?tag_list=#{tag_list.compact.join(',')}").url
parse_body(response)
end
......
......@@ -41,7 +41,17 @@ module QA
end
def remove_via_api!
@id = project.runners.find { |runner| runner[:description] == name }[:id]
runners = project.runners(tag_list: tags)
unless runners && !runners.empty?
raise "Project #{project.path_with_namespace} has no runners with tags #{tags}."
end
this_runner = runners.find { |runner| runner[:description] == name }
unless this_runner
raise "Project #{project.path_with_namespace} does not have a runner with a description matching #{name} and tags #{tags}. Runners available: #{runners}"
end
@id = this_runner[:id]
super
......
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