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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(datastore): Add OptimisticConcurrency tests #86

Closed
wants to merge 3 commits into from

Conversation

stocaaro
Copy link
Owner

@stocaaro stocaaro commented Dec 19, 2023

Warning

PR reconstructed as part of a rebase - Please see #88

Description of changes

Outcomes:

  • Add OptimisticConcurrency (OCC) tests for all cases covered by the existing Automerge tests
  • Change test resolution so that latent tests processes subscription updates after mutation response update
    • This is more consistent with what is observed in the wild, where Datastore receives repeat updates
  • Raise returned object when errors are present aligning mock behavior with the client logic it overrides.
  • Wait for all subscriptions to be published before proceeding (remove a race condition between test assertions and subscription updates)

While adding OCC testing, I noticed my sample app result diverged from our test results. Investigating this led me to identify that this is substantially true for our existing Automerge tests. The difference comes from having subscription updates arrive into datastore before the mutation response is returned. This is possible, but not the common case. I have factored the latent tests towards the more common case which is has noisier redundant messages.

Description of how you validated changes

By comparing sample app results to test expectations and iterating until they align.

Related changes

  1. refactor(datastore): Move conflict resolution tests to their own file聽aws-amplify/amplify-js#12728
  2. refactor(datastore): Refactor conflict resolution tests optimize for concise/readable聽aws-amplify/amplify-js#12732
  3. test(datastore): Refactor test names/comment and add OCC fake聽#85
  4. 馃尡 refactor(datastore): Add OptimisticConcurrency tests
  5. fix(datastore): Update outbox comparison logic to fix update versioning problems聽#87

Checklist

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant