Commit 4756edbe authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch 'georgekoltsov/import-epic-system-notes' into 'master'

Add epic's note system_note_meta to Import/Export

See merge request gitlab-org/gitlab!63551
parents 7574ed6c ca32a0f9
This diff is collapsed.
......@@ -362,6 +362,85 @@
}
}
]
},
{
"id": 17527,
"group_id": 1277,
"author_id": 1,
"assignee_id": null,
"iid": 3,
"updated_by_id": null,
"last_edited_by_id": null,
"lock_version": 0,
"start_date": null,
"end_date": null,
"last_edited_at": null,
"created_at": "2021-06-08T14:49:25.041Z",
"updated_at": "2021-06-08T14:49:43.877Z",
"title": "system notes",
"description": "system notes",
"start_date_sourcing_milestone_id": null,
"due_date_sourcing_milestone_id": null,
"start_date_fixed": null,
"due_date_fixed": null,
"start_date_is_fixed": false,
"due_date_is_fixed": false,
"closed_by_id": null,
"closed_at": null,
"parent_id": null,
"relative_position": null,
"state_id": "opened",
"start_date_sourcing_epic_id": null,
"due_date_sourcing_epic_id": null,
"confidential": false,
"external_key": null,
"notes": [
{
"id": 529568,
"note": "added epic u00261 as child epic",
"noteable_type": "Epic",
"author_id": 1,
"created_at": "2021-06-08T14:49:43.774Z",
"updated_at": "2021-06-08T14:49:43.811Z",
"project_id": null,
"attachment": {
"url": null
},
"line_code": null,
"commit_id": null,
"noteable_id": 17527,
"system": true,
"st_diff": null,
"updated_by_id": null,
"position": null,
"original_position": null,
"resolved_at": null,
"resolved_by_id": null,
"discussion_id": "63c7b8f0862ebde74eb806a2fd0d84bd53734730",
"change_position": null,
"resolved_by_push": null,
"review_id": null,
"confidential": null,
"last_edited_at": "2021-06-08T14:49:43.811Z",
"system_note_metadata": {
"id": 196422,
"note_id": 529568,
"commit_count": null,
"action": "relate_epic",
"created_at": "2021-06-08T14:49:43.843Z",
"updated_at": "2021-06-08T14:49:43.843Z",
"description_version_id": null
},
"author": {
"id": 1,
"email": "",
"created_at": "2021-04-14T14:42:15.926Z",
"updated_at": "2021-06-08T16:32:26.109Z",
"name": "Administrator"
},
"award_emoji": []
}
]
}
]
}
{"id":13622,"milestone_id":null,"group_id":4351,"author_id":1,"assignee_id":null,"iid":1,"updated_by_id":null,"last_edited_by_id":null,"lock_version":0,"start_date":null,"end_date":null,"last_edited_at":null,"created_at":"2019-11-20T17:02:09.754Z","updated_at":"2019-11-20T18:38:40.054Z","title":"Provident neque consequatur numquam ad laboriosam voluptatem magnam.","description":"Fugit nisi est ut numquam quia rerum vitae qui. Et in est aliquid voluptas et ut vitae. In distinctio voluptates ut deleniti iste.\n\nReiciendis eum sunt vero blanditiis at quia. Voluptate eum facilis illum ea distinctio maiores. Doloribus aut nemo ea distinctio.\n\nNihil cum distinctio voluptates quam. Laboriosam distinctio ea accusantium soluta perspiciatis nesciunt impedit. Id qui natus quis minima voluptatum velit ut reprehenderit. Molestiae quia est harum sapiente rem error architecto id. Et minus ipsa et ut ut.","start_date_sourcing_milestone_id":null,"due_date_sourcing_milestone_id":null,"start_date_fixed":null,"due_date_fixed":null,"start_date_is_fixed":null,"due_date_is_fixed":null,"closed_by_id":null,"closed_at":null,"parent_id":null,"relative_position":null,"state":"opened","start_date_sourcing_epic_id":null,"due_date_sourcing_epic_id":null,"notes":[{"id":44164,"note":"added epic &2 as child epic","noteable_type":"Epic","author_id":1,"created_at":"2019-11-20T18:38:26.689Z","updated_at":"2019-11-20T18:38:26.724Z","project_id":null,"attachment":{"url":null},"line_code":null,"commit_id":null,"noteable_id":13622,"system":true,"st_diff":null,"updated_by_id":null,"position":null,"original_position":null,"resolved_at":null,"resolved_by_id":null,"discussion_id":"133f0c3001860fa8d2031e398a65db74477378c4","change_position":null,"resolved_by_push":null,"review_id":null,"type":null,"author":{"name":"Administrator"},"award_emoji":[{"id":12,"name":"drum","user_id":1,"awardable_type":"Note","awardable_id":44170,"created_at":"2019-11-05T15:32:21.287Z","updated_at":"2019-11-05T15:32:21.287Z"}]}],"award_emoji":[{"id":12,"name":"thumbsup","user_id":1,"awardable_type":"Epic","awardable_id":13622,"created_at":"2019-11-05T15:37:21.287Z","updated_at":"2019-11-05T15:37:21.287Z"}],"label_links":[{"id":1,"label_id":2,"target_id":3,"target_type":"Epic","created_at":"2021-04-14 14:42:21.717503","updated_at":"2021-04-14 14:42:21.717503","label":{"title":"title","description":"description","color":"#cd2c5c","created_at":"2021-04-14 14:42:21.717503","updated_at":"2021-04-14 14:42:21.717503","type":"GroupLabel"}}]}
{"id":13623,"milestone_id":null,"group_id":4351,"author_id":1,"assignee_id":null,"iid":2,"updated_by_id":null,"last_edited_by_id":null,"lock_version":0,"start_date":null,"end_date":null,"last_edited_at":null,"created_at":"2019-12-20T17:02:09.754Z","updated_at":"2019-12-20T18:38:40.054Z","title":"Provident neque consequatur numquam ad voluptatem magnam.","description":"Fugit nisi","start_date_sourcing_milestone_id":null,"due_date_sourcing_milestone_id":null,"start_date_fixed":null,"due_date_fixed":null,"start_date_is_fixed":null,"due_date_is_fixed":null,"closed_by_id":null,"closed_at":null,"parent_id":null,"relative_position":null,"state":"closed","start_date_sourcing_epic_id":null,"due_date_sourcing_epic_id":null,"notes":[],"label_links":[{"id":1,"label_id":2,"target_id":3,"target_type":"Epic","created_at":"2021-04-14 14:42:21.717503","updated_at":"2021-04-14 14:42:21.717503","label":{"title":"title","description":"description","color":"#cd2c5c","created_at":"2021-04-14 14:42:21.717503","updated_at":"2021-04-14 14:42:21.717503","type":"GroupLabel"}}]}
{"id":17527,"group_id":1277,"author_id":1,"assignee_id":null,"iid":3,"updated_by_id":null,"last_edited_by_id":null,"lock_version":0,"start_date":null,"end_date":null,"last_edited_at":null,"created_at":"2021-06-08T14:49:25.041Z","updated_at":"2021-06-08T14:49:43.877Z","title":"system notes","description":"system notes","start_date_sourcing_milestone_id":null,"due_date_sourcing_milestone_id":null,"start_date_fixed":null,"due_date_fixed":null,"start_date_is_fixed":false,"due_date_is_fixed":false,"closed_by_id":null,"closed_at":null,"parent_id":null,"relative_position":null,"state_id":"opened","start_date_sourcing_epic_id":null,"due_date_sourcing_epic_id":null,"confidential":false,"external_key":null,"notes":[{"id":529568,"note":"added epic u00261 as child epic","noteable_type":"Epic","author_id":1,"created_at":"2021-06-08T14:49:43.774Z","updated_at":"2021-06-08T14:49:43.811Z","project_id":null,"attachment":{"url":null},"line_code":null,"commit_id":null,"noteable_id":17527,"system":true,"st_diff":null,"updated_by_id":null,"position":null,"original_position":null,"resolved_at":null,"resolved_by_id":null,"discussion_id":"63c7b8f0862ebde74eb806a2fd0d84bd53734730","change_position":null,"resolved_by_push":null,"review_id":null,"confidential":null,"last_edited_at":"2021-06-08T14:49:43.811Z","system_note_metadata":{"id":196422,"note_id":529568,"commit_count":null,"action":"relate_epic","created_at":"2021-06-08T14:49:43.843Z","updated_at":"2021-06-08T14:49:43.843Z","description_version_id":null},"author":{"id":1,"email":"","created_at":"2021-04-14T14:42:15.926Z","updated_at":"2021-06-08T16:32:26.109Z","name":"Administrator"},"award_emoji":[]}]}
......@@ -6,7 +6,7 @@ RSpec.describe BulkImports::Groups::Pipelines::EpicsPipeline do
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group) }
let_it_be(:bulk_import) { create(:bulk_import, user: user) }
let_it_be(:filepath) { 'spec/fixtures/bulk_imports/epics.ndjson.gz' }
let_it_be(:filepath) { 'ee/spec/fixtures/bulk_imports/gz/epics.ndjson.gz' }
let_it_be(:entity) do
create(
:bulk_import_entity,
......@@ -32,19 +32,30 @@ RSpec.describe BulkImports::Groups::Pipelines::EpicsPipeline do
subject { described_class.new(context) }
describe '#run' do
it 'imports group epics into destination group' do
before do
allow(Dir).to receive(:mktmpdir).and_return(tmpdir)
allow_next_instance_of(BulkImports::FileDownloadService) do |service|
allow(service).to receive(:execute)
end
expect { subject.run }.to change(::Epic, :count).by(5)
subject.run
end
it 'imports group epics into destination group' do
expect(group.epics.count).to eq(6)
end
it 'imports epic award emoji' do
expect(group.epics.first.award_emoji.first.name).to eq('thumbsup')
end
it 'imports epic notes' do
expect(group.epics.first.state).to eq('opened')
expect(group.epics.first.notes.count).to eq(4)
expect(group.epics.first.notes.first.award_emoji.first.name).to eq('drum')
end
it 'imports epic labels' do
label = group.epics.first.labels.first
expect(group.epics.first.labels.count).to eq(1)
......@@ -52,6 +63,13 @@ RSpec.describe BulkImports::Groups::Pipelines::EpicsPipeline do
expect(label.description).to eq('description')
expect(label.color).to eq('#cd2c5c')
end
it 'imports epic system note metadata' do
note = group.epics.find_by_title('system notes').notes.first
expect(note.system).to eq(true)
expect(note.system_note_metadata.action).to eq('relate_epic')
end
end
describe '#load' do
......
......@@ -21,26 +21,34 @@ RSpec.describe Gitlab::ImportExport::Group::TreeRestorer do
describe 'restore group tree' do
context 'epics' do
it 'has group epics' do
expect(group.epics.count).to eq(2)
expect(group.epics.count).to eq(3)
end
it 'has award emoji' do
expect(group.epics.first.award_emoji.first.name).to eq('thumbsup')
expect(group.epics.find_by_iid(1).award_emoji.first.name).to eq('thumbsup')
end
it 'preserves epic state' do
expect(group.epics.first.state).to eq('opened')
expect(group.epics.last.state).to eq('closed')
expect(group.epics.find_by_iid(1).state).to eq('opened')
expect(group.epics.find_by_iid(2).state).to eq('closed')
expect(group.epics.find_by_iid(3).state).to eq('opened')
end
end
context 'epic notes' do
it 'has epic notes' do
expect(group.epics.first.notes.count).to eq(1)
expect(group.epics.find_by_iid(1).notes.count).to eq(1)
end
it 'has award emoji on epic notes' do
expect(group.epics.first.notes.first.award_emoji.first.name).to eq('drum')
expect(group.epics.find_by_iid(1).notes.first.award_emoji.first.name).to eq('drum')
end
it 'has system note metadata' do
note = group.epics.find_by_title('system notes').notes.first
expect(note.system).to eq(true)
expect(note.system_note_metadata.action).to eq('relate_epic')
end
end
......
......@@ -77,6 +77,7 @@ ee:
- :award_emoji
- events:
- :push_event_payload
- :system_note_metadata
- boards:
- :board_assignee
- :milestone
......
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