Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flaky unit test - fails to update DRCluster manifest work #936

Merged
merged 1 commit into from
Jun 23, 2023

Conversation

ELENAGER
Copy link
Member

Flaky unit test (DRClusterController DRCluster resource CIDR validation when provided CIDR value is changed to be correct [It] reports validated)
Fixes: #901

types.NamespacedName{Name: mw.Name, Namespace: managedClusternamespace},
foundMW)

if err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of the Get operation here?

Also, if the error we got was a conflict err, should we not retry the update after getting it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inside the RetryOnConflict function we need to do 3 steps:

  1. Reload manifest work resource
  2. Update it's status (deepcopy)
  3. Update the manifest work resource

Get function can't have conflicts, if we failed in it - no need to proceed, it's real error
Update function return value is inspected by RetryOnConflict function itself and the decision if exit or proceed is taken by it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion, implementing this pattern is good for the ManifestWork. Because it can be modified by an external entity at runtime and we have no control over it.

@ELENAGER ELENAGER force-pushed the unit_tests_fix branch 2 times, most recently from 57fa2d9 to ba31b3e Compare June 22, 2023 15:59
Signed-off-by: Elena Gershkovich <elenage@il.ibm.com>
@raghavendra-talur raghavendra-talur merged commit d0cce87 into RamenDR:main Jun 23, 2023
9 checks passed
@ELENAGER ELENAGER deleted the unit_tests_fix branch July 4, 2023 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants