Commit ed799c04 authored by Andrejs Cunskis's avatar Andrejs Cunskis

Merge branch 'acunskis-group-import-improvements' into 'master'

E2E: Validate error presence for group imports

See merge request gitlab-org/gitlab!76085
parents 946c6482 fcb55244
...@@ -68,7 +68,8 @@ module QA ...@@ -68,7 +68,8 @@ module QA
path: path, path: path,
name: path, name: path,
visibility: 'public', visibility: 'public',
require_two_factor_authentication: @require_two_factor_authentication require_two_factor_authentication: @require_two_factor_authentication,
avatar: avatar
} }
end end
......
...@@ -7,7 +7,7 @@ module QA ...@@ -7,7 +7,7 @@ module QA
class GroupBase < Base class GroupBase < Base
include Members include Members
attr_accessor :path attr_accessor :path, :avatar
attributes :id, attributes :id,
:runners_token, :runners_token,
......
...@@ -69,7 +69,8 @@ module QA ...@@ -69,7 +69,8 @@ module QA
{ {
path: path, path: path,
name: path, name: path,
visibility: 'public' visibility: 'public',
avatar: avatar
} }
end end
......
...@@ -26,6 +26,7 @@ module QA ...@@ -26,6 +26,7 @@ module QA
Resource::Sandbox.fabricate_via_api! do |group| Resource::Sandbox.fabricate_via_api! do |group|
group.api_client = api_client group.api_client = api_client
group.path = "source-group-for-import-#{SecureRandom.hex(4)}" group.path = "source-group-for-import-#{SecureRandom.hex(4)}"
group.avatar = File.new('qa/fixtures/designs/tanuki.jpg', 'r')
end end
end end
...@@ -37,6 +38,10 @@ module QA ...@@ -37,6 +38,10 @@ module QA
end end
end end
let(:import_failures) do
imported_group.import_details.sum([]) { |details| details[:failures] }
end
before do before do
sandbox.add_member(user, Resource::Members::AccessLevel::MAINTAINER) sandbox.add_member(user, Resource::Members::AccessLevel::MAINTAINER)
end end
...@@ -73,6 +78,8 @@ module QA ...@@ -73,6 +78,8 @@ module QA
label.group = subgroup label.group = subgroup
label.title = "subgroup-#{SecureRandom.hex(4)}" label.title = "subgroup-#{SecureRandom.hex(4)}"
end end
imported_group # trigger import
end end
it( it(
...@@ -87,6 +94,8 @@ module QA ...@@ -87,6 +94,8 @@ module QA
expect(imported_subgroup.reload!).to eq(subgroup) expect(imported_subgroup.reload!).to eq(subgroup)
expect(imported_subgroup.labels).to include(*subgroup.labels) expect(imported_subgroup.labels).to include(*subgroup.labels)
expect(import_failures).to be_empty, "Expected no errors, received: #{import_failures}"
end end
end end
end end
...@@ -108,6 +117,8 @@ module QA ...@@ -108,6 +117,8 @@ module QA
badge.link_url = "http://example.com/badge" badge.link_url = "http://example.com/badge"
badge.image_url = "http://shields.io/badge" badge.image_url = "http://shields.io/badge"
end end
imported_group # trigger import
end end
it( it(
...@@ -124,6 +135,8 @@ module QA ...@@ -124,6 +135,8 @@ module QA
expect(imported_milestone.updated_at).to eq(source_milestone.updated_at) expect(imported_milestone.updated_at).to eq(source_milestone.updated_at)
expect(imported_group.badges).to eq(source_group.badges) expect(imported_group.badges).to eq(source_group.badges)
expect(import_failures).to be_empty, "Expected no errors, received: #{import_failures}"
end end
end end
end end
...@@ -139,6 +152,8 @@ module QA ...@@ -139,6 +152,8 @@ module QA
before do before do
member.set_public_email member.set_public_email
source_group.add_member(member, Resource::Members::AccessLevel::DEVELOPER) source_group.add_member(member, Resource::Members::AccessLevel::DEVELOPER)
imported_group # trigger import
end end
after do after do
...@@ -153,8 +168,11 @@ module QA ...@@ -153,8 +168,11 @@ module QA
imported_member = imported_group.reload!.members.find { |usr| usr.username == member.username } imported_member = imported_group.reload!.members.find { |usr| usr.username == member.username }
aggregate_failures do
expect(imported_member).not_to be_nil expect(imported_member).not_to be_nil
expect(imported_member.access_level).to eq(Resource::Members::AccessLevel::DEVELOPER) expect(imported_member.access_level).to eq(Resource::Members::AccessLevel::DEVELOPER)
expect(import_failures).to be_empty, "Expected no errors, received: #{import_failures}"
end
end end
end end
end end
......
...@@ -33,6 +33,7 @@ module QA ...@@ -33,6 +33,7 @@ module QA
Resource::Sandbox.fabricate_via_api! do |group| Resource::Sandbox.fabricate_via_api! do |group|
group.api_client = api_client group.api_client = api_client
group.path = "source-group-for-import-#{SecureRandom.hex(4)}" group.path = "source-group-for-import-#{SecureRandom.hex(4)}"
group.avatar = File.new('qa/fixtures/designs/tanuki.jpg', 'r')
end end
end end
...@@ -54,6 +55,10 @@ module QA ...@@ -54,6 +55,10 @@ module QA
end end
end end
let(:import_failures) do
imported_group.import_details.sum([]) { |details| details[:failures] }
end
# Find epic by title # Find epic by title
# #
# @param [Array] epics # @param [Array] epics
...@@ -86,6 +91,8 @@ module QA ...@@ -86,6 +91,8 @@ module QA
child_epic.award_emoji('thumbsdown') child_epic.award_emoji('thumbsdown')
source_iteration source_iteration
imported_group # trigger import
end end
after do after do
...@@ -115,6 +122,8 @@ module QA ...@@ -115,6 +122,8 @@ module QA
expect(imported_iteration.iid).to eq(source_iteration.iid) expect(imported_iteration.iid).to eq(source_iteration.iid)
expect(imported_iteration.created_at).to eq(source_iteration.created_at) expect(imported_iteration.created_at).to eq(source_iteration.created_at)
expect(imported_iteration.updated_at).to eq(source_iteration.updated_at) expect(imported_iteration.updated_at).to eq(source_iteration.updated_at)
expect(import_failures).to be_empty, "Expected no errors, received: #{import_failures}"
end end
end 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