Extend epic work item validation checks
What does this MR do and why?
As we now sync more attributes to the work_item, this adds more checks to validate that the epic and the work item are in sync.
We now check for the hierarchy, the start_date, the due_date, and the related epic links.
This change also introduces the optional strict_equal
parameter that
is false
by default now. When strict_equal
is true
we expect that
all relationships are synced. This is the case when we have backfilled
all data.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
How to set up and validate locally
-
Restart
rails-web
andrails-background-job
(background jobs often get stuck, and to register new events, rails needs to be restarted) -
Feature.enable(:validate_epic_work_item_sync)
-
Feature.enable(:epic_creation_with_synced_work_item)
-
Apply the diff to create a mismatch of data:
diff --git a/ee/app/services/concerns/epics/sync_as_work_item.rb b/ee/app/services/concerns/epics/sync_as_work_item.rb index f9822034f2f2..c92193419293 100644 --- a/ee/app/services/concerns/epics/sync_as_work_item.rb +++ b/ee/app/services/concerns/epics/sync_as_work_item.rb @@ -15,7 +15,7 @@ def create_work_item_for!(epic) service_response = ::WorkItems::CreateService.new( container: epic.group, current_user: current_user, - params: create_params(epic) + params: create_params(epic).merge(title: "WRONG SYNCED TITLE") ).execute_without_rate_limiting handle_response!(:create, service_response, epic) @@ -31,7 +31,7 @@ def update_work_item_for!(epic) service_response = ::WorkItems::UpdateService.new( container: epic.group, current_user: current_user, - params: update_params(epic) + params: update_params(epic).merge(description: "WRONG SYNCED DESCRIPTION") ).execute(epic.work_item) handle_response!(:update, service_response, epic)
-
Watch the log
tail -f log/epic_work_item_sync.log
-
Create an epic
-
Update an epic
-
Watch the log printing out the mismatched attributes
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.