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

Making regression test put()'s transactional. #562

Merged
merged 1 commit into from
Jan 22, 2015

Conversation

dhermes
Copy link
Contributor

@dhermes dhermes commented Jan 22, 2015

This is to address flaky test failures.

See #535 for more discussion.

This is to address flaky test failures.

See googleapis#535 for more discussion.
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jan 22, 2015
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling e407a68 on dhermes:regression-transactional-puts into 1bfa469 on GoogleCloudPlatform:master.

@tseaver
Copy link
Contributor

tseaver commented Jan 22, 2015

LGTM

dhermes added a commit that referenced this pull request Jan 22, 2015
Making regression test put()'s transactional.
@dhermes dhermes merged commit 927c534 into googleapis:master Jan 22, 2015
@dhermes dhermes deleted the regression-transactional-puts branch January 22, 2015 19:13
@dhermes
Copy link
Contributor Author

dhermes commented Jan 22, 2015

The second time regression tests were run after this PR, the flake still occurred:
https://travis-ci.org/GoogleCloudPlatform/gcloud-python/builds/47970589

======================================================================
FAIL: test_save_key_self_reference (datastore.TestDatastoreSaveKeys)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/GoogleCloudPlatform/gcloud-python/regression/datastore.py", line 158, in test_save_key_self_reference
    self.assertEqual(len(stored_persons), 1)
AssertionError: 0 != 1

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 runQuery request also need to occur transactionally to make sure this passes always?

@pcostell
Copy link
Contributor

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.

@dhermes
Copy link
Contributor Author

dhermes commented Jan 22, 2015

Thanks. Sorry for the n00b question. I've been told that before, totally should not have forgotten.

@tseaver I'll jump on fixing this.

@pcostell
Copy link
Contributor

No worries, it's easy to mix up.

dhermes added a commit to dhermes/google-cloud-python that referenced this pull request Jan 22, 2015
Using an ancestor in queries to ensure consistency.

See googleapis#562 for context.
dhermes added a commit to dhermes/google-cloud-python that referenced this pull request Jan 27, 2015
Using an ancestor in queries to ensure consistency.

See googleapis#562 for context.
vchudnov-g pushed a commit that referenced this pull request Sep 20, 2023
Source-Link: googleapis/synthtool@fdba3ed
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:1f0dbd02745fb7cf255563dab5968345989308544e52b7f460deadd5e78e63b0
parthea pushed a commit that referenced this pull request Sep 22, 2023
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this pull request Oct 21, 2023
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants