Commit 5a5feccb authored by Mark Lapierre's avatar Mark Lapierre Committed by Rémy Coutable

Fix group GET path when sandbox is a subgroup

parent 1f28d0e8
......@@ -57,7 +57,7 @@ module QA
end
def api_get_path
"/groups/#{CGI.escape("#{sandbox.path}/#{path}")}"
"/groups/#{CGI.escape("#{determine_full_path}")}"
end
def api_post_body
......@@ -100,6 +100,32 @@ module QA
'Timed out while waiting for the group repository storage move to finish'
)
end
private
# Determine the path up to the root group.
#
# This is equivalent to the full_path API attribute. We can't use the full_path attribute
# because it depends on the group being fabricated first, and we use this method to help
# _check_ if the group exists.
#
# @param [QA::Resource::GroupBase] sandbox the immediate parent group of this group
# @param [String] path the path name of this group (the leaf, not the full path)
# @return [String]
def determine_full_path
determine_parent_group_paths(sandbox, path)
end
# Recursively traverse the parents of this group up to the root group.
#
# @param [QA::Resource::GroupBase] parent the immediate parent group
# @param [String] path the path traversed so far
# @return [String]
def determine_parent_group_paths(parent, path)
return "#{parent.path}/#{path}" unless parent.respond_to?(:sandbox)
determine_parent_group_paths(parent.sandbox, "#{parent.path}/#{path}")
end
end
end
end
......@@ -92,14 +92,6 @@ module QA
aggregate_failures do
expect(import_page).to have_imported_group(source_group.path, wait: 120)
expect(imported_group).to eq(source_group)
expect(imported_subgroup).to eq(subgroup)
# TODO: Improve validation logic with some potential retry mechanism built in to custom rspec matcher
# https://gitlab.com/gitlab-org/gitlab/-/issues/331704
# expect(imported_group.labels).to include(*source_group.labels)
expect(imported_subgroup.labels).to include(*subgroup.labels)
end
end
end
......
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