Commit ab67de6f authored by Andrejs Cunskis's avatar Andrejs Cunskis

Merge branch 'acunskis-aggregate-all-failures' into 'master'

E2E: log import failures in case of failed spec

See merge request gitlab-org/gitlab!76452
parents 1044a437 96aeab5c
...@@ -4,7 +4,7 @@ module QA ...@@ -4,7 +4,7 @@ module QA
# run only base UI validation on staging because test requires top level group creation which is problematic # run only base UI validation on staging because test requires top level group creation which is problematic
# on staging environment # on staging environment
RSpec.describe 'Manage', :requires_admin, except: { subdomain: :staging } do RSpec.describe 'Manage', :requires_admin, except: { subdomain: :staging } do
describe 'Bulk project import' do describe 'Gitlab migration' do
let(:import_wait_duration) { { max_duration: 300, sleep_interval: 2 } } let(:import_wait_duration) { { max_duration: 300, sleep_interval: 2 } }
let(:admin_api_client) { Runtime::API::Client.as_admin } let(:admin_api_client) { Runtime::API::Client.as_admin }
let(:user) do let(:user) do
...@@ -49,10 +49,8 @@ module QA ...@@ -49,10 +49,8 @@ module QA
imported_group.reload!.projects imported_group.reload!.projects
end end
let(:project_import_failures) do let(:import_failures) do
imported_group.import_details imported_group.import_details.sum([]) { |details| details[:failures] }
.find { |entity| entity[:destination_name] == source_project.name }
&.fetch(:failures)
end end
before do before do
...@@ -63,7 +61,11 @@ module QA ...@@ -63,7 +61,11 @@ module QA
source_project.tap { |project| project.add_push_rules(member_check: true) } # fabricate source group and project source_project.tap { |project| project.add_push_rules(member_check: true) } # fabricate source group and project
end end
after do after do |example|
# Checking for failures in the test currently makes test very flaky
# Just log in case of failure until cause of network errors is found
Runtime::Logger.warn("Import failures: #{import_failures}") if example.exception && !import_failures.empty?
user.remove_via_api! user.remove_via_api!
ensure ensure
Runtime::Feature.disable(:bulk_import_projects) Runtime::Feature.disable(:bulk_import_projects)
...@@ -80,11 +82,7 @@ module QA ...@@ -80,11 +82,7 @@ module QA
) do ) do
expect { imported_group.import_status }.to eventually_eq('finished').within(import_wait_duration) expect { imported_group.import_status }.to eventually_eq('finished').within(import_wait_duration)
expect(imported_projects.count).to eq(1), 'Expected to have 1 imported project' expect(imported_projects.count).to eq(1), 'Expected to have 1 imported project'
aggregate_failures do
expect(imported_projects.first).to eq(source_project) expect(imported_projects.first).to eq(source_project)
expect(project_import_failures).to be_empty, "Expected no errors, was: #{project_import_failures}"
end
end end
end end
...@@ -125,7 +123,6 @@ module QA ...@@ -125,7 +123,6 @@ module QA
aggregate_failures do aggregate_failures do
expect(imported_issues.count).to eq(1) expect(imported_issues.count).to eq(1)
expect(imported_issue.reload!).to eq(source_issue) expect(imported_issue.reload!).to eq(source_issue)
expect(project_import_failures).to be_empty, "Expected no errors, was: #{project_import_failures}"
end end
end end
end end
...@@ -182,7 +179,6 @@ module QA ...@@ -182,7 +179,6 @@ module QA
expect(imported_commits).to match_array(source_commits) expect(imported_commits).to match_array(source_commits)
expect(imported_tags).to match_array(source_tags) expect(imported_tags).to match_array(source_tags)
expect(imported_branches).to match_array(source_branches) expect(imported_branches).to match_array(source_branches)
expect(project_import_failures).to be_empty, "Expected no errors, was: #{project_import_failures}"
end end
end end
end end
...@@ -199,11 +195,7 @@ module QA ...@@ -199,11 +195,7 @@ module QA
) do ) do
expect { imported_group.import_status }.to eventually_eq('finished').within(import_wait_duration) expect { imported_group.import_status }.to eventually_eq('finished').within(import_wait_duration)
expect(imported_projects.count).to eq(1), 'Expected to have 1 imported project' expect(imported_projects.count).to eq(1), 'Expected to have 1 imported project'
aggregate_failures do
expect(imported_projects.first.wikis).to eq(source_project.wikis) expect(imported_projects.first.wikis).to eq(source_project.wikis)
expect(project_import_failures).to be_empty, "Expected no errors, was: #{project_import_failures}"
end
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