diff options
Diffstat (limited to 'qa/qa/runtime/api/repository_storage_moves.rb')
-rw-r--r-- | qa/qa/runtime/api/repository_storage_moves.rb | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/qa/qa/runtime/api/repository_storage_moves.rb b/qa/qa/runtime/api/repository_storage_moves.rb index d0211d3f66d..5630a9c02c5 100644 --- a/qa/qa/runtime/api/repository_storage_moves.rb +++ b/qa/qa/runtime/api/repository_storage_moves.rb @@ -9,9 +9,9 @@ module QA RepositoryStorageMovesError = Class.new(RuntimeError) - def has_status?(project, status, destination_storage = Env.additional_repository_storage) - find_any do |move| - next unless move[:project][:path_with_namespace] == project.path_with_namespace + def has_status?(resource, status, destination_storage = Env.additional_repository_storage) + find_any(resource) do |move| + next unless resource_equals?(resource, move) QA::Runtime::Logger.debug("Move data: #{move}") @@ -20,16 +20,28 @@ module QA end end - def find_any + def find_any(resource) Logger.debug('Getting repository storage moves') Support::Waiter.wait_until do - with_paginated_response_body(Request.new(api_client, '/project_repository_storage_moves', per_page: '100').url) do |page| + with_paginated_response_body(Request.new(api_client, "/#{resource_name(resource)}_repository_storage_moves", per_page: '100').url) do |page| break true if page.any? { |item| yield item } end end end + def resource_equals?(resource, move) + if resource.class.name.include?('Snippet') + move[:snippet][:id] == resource.id + else + move[:project][:path_with_namespace] == resource.path_with_namespace + end + end + + def resource_name(resource) + resource.class.name.split('::').last.downcase + end + private def api_client |