vdk-control-service: fix race condition in test - #1227
Merged
Conversation
Signed-off-by: murphp15 <murphp15@tcd.ie>
Contributor
|
I will try to provide a review by end of the day or Monday morning. But please fix the title of the PR to follow the recommended format: https://github.com/vmware/versatile-data-kit/blob/main/support/git-commit-template.txt (add component and move the link to the ticket somewhere else). That format is used later when making release documentation so it's kinda important. |
Contributor
Author
Done. |
mivanov1988
approved these changes
Oct 7, 2022
Contributor
|
Good catch. |
antoniivanov
approved these changes
Oct 10, 2022
antoniivanov
left a comment
Contributor
There was a problem hiding this comment.
Looks ok to me. If you can explain the unit test.
… flaxey tests. Signed-off-by: murphp15 <murphp15@tcd.ie>
murphp15
enabled auto-merge (squash)
October 10, 2022 09:27
murphp15
disabled auto-merge
October 13, 2022 14:44
murphp15
force-pushed
the
person/murphp15/fix_race_condition_in_test
branch
from
October 17, 2022 10:28
e022304 to
3254b21
Compare
murphp15
enabled auto-merge (squash)
October 17, 2022 10:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why?
There is an intermittent failure in the integration tests for the control plane.
The stacktrace can be found here #1129.
It happens because the job watcher sees a job in kubernetes before a row exists in the database.
So it creates a row from nothing instead of updating the existing row.
When the watcher creates a row from scratch it doesn't have the startedBy value.
Because deploying the job and updating the database can't be an atomic operation we need to make sure that the job isn't submitted unless the row exists in the database.
What
We now add the row into the database before deploying to k8s to prevent the race condition.
If there is a failure during the deployment we roll back the commit to the database.
How has this been tested?
I added a test to make sure that we rollback correctly.
I also added back in the assertion to check that the started by is set correctly.
What type of change are you making?
bug fix.
Signed-off-by: murphp15 murphp15@tcd.ie