-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Making regression test put()'s transactional. #562
Making regression test put()'s transactional. #562
Conversation
This is to address flaky test failures. See googleapis#535 for more discussion.
LGTM |
Making regression test put()'s transactional.
The second time regression tests were run after this PR, the flake still occurred:
The code at question is with datastore.Transaction():
datastore.put([entity])
query = datastore.Query(kind='Person')
query.add_filter('linkedTo', '=', key)
stored_persons = list(query.fetch(limit=2))
self.assertEqual(len(stored_persons), 1) @pcostell does the |
This doesn't actually do anything (a single put by itself is transactional). To make sure these tests always pass you need to make the entity have a parent then make the query do an ancestor query. |
Thanks. Sorry for the n00b question. I've been told that before, totally should not have forgotten. @tseaver I'll jump on fixing this. |
No worries, it's easy to mix up. |
Using an ancestor in queries to ensure consistency. See googleapis#562 for context.
Using an ancestor in queries to ensure consistency. See googleapis#562 for context.
Source-Link: googleapis/synthtool@fdba3ed Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:1f0dbd02745fb7cf255563dab5968345989308544e52b7f460deadd5e78e63b0
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
This is to address flaky test failures.
See #535 for more discussion.