-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
test(datastore): Add OptimisticConcurrency tests #12795
test(datastore): Add OptimisticConcurrency tests #12795
Conversation
Co-authored-by: David McAfee <mcafd@amazon.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks great! I do think removing the incorrect comment is a blocker, since it would lead to significant confusion (at least for me!) down the line. Other than that, just one correction to a typo :)
packages/datastore/__tests__/conflictResolutionBehavior.test.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: David McAfee <mcafd@amazon.com>
Co-authored-by: David McAfee <mcafd@amazon.com>
@david-mcafee - Appreciate the suggestions. I've accepted both suggested changes and have re-read all of the comments to make sure nothing else thats coming across is auto-merge centric. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🎉
} else { | ||
merged = { | ||
...this.populatedFields(existing), | ||
}; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This else
branch looks like a no-op. Since the fake is branching on canOccMerge()
first anyway, I think I'd prefer that this throw
to alert us that "we shouldn't be here", unless I'm failing to see or grok a use-case for this branch.
I think this is the only area of the PR that concerns me at the moment. Unless I'm just having a slow brain day, can we either turn this into a throw
or add a comment explaining the branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rereading this, I think this branch will never be reached since I have extracted the canOccMerge
function, we're essentially doing the version check twice. I'll get a refactor out around this.
Description of changes
Outcomes:
Description of how you validated changes
By comparing sample app results to test expectations and iterating until they align.
There is existing odd behavior where errors occur at in low latency conditions where the retry message includes null values for fields, which overwrites external updates. I will do sample app testing to confirm that this is consistent with the real world behavior.
Related changes
Checklist
yarn test
passesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.