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

Firestore: 'test_watch_collection' systest flakes #7130

Closed
tseaver opened this issue Jan 16, 2019 · 3 comments
Closed

Firestore: 'test_watch_collection' systest flakes #7130

tseaver opened this issue Jan 16, 2019 · 3 comments
Assignees
Labels
api: firestore Issues related to the Firestore API. flaky testing type: process A process-related concern. May include testing, release, or the like.

Comments

@tseaver
Copy link
Contributor

tseaver commented Jan 16, 2019

Similar to #6605, #6921.

From this Kokoro Firestore run:

____________________________ test_watch_collection _____________________________
client = <google.cloud.firestore_v1beta1.client.Client object at 0x7ff27e1c25d0>
cleanup = <built-in method append of list object at 0x7ff27e1ac878>
    def test_watch_collection(client, cleanup):
        db = client
        doc_ref = db.collection(u"users").document(u"alovelace" + unique_resource_id())
        collection_ref = db.collection(u"users")
        # Initial setting
        doc_ref.set({u"first": u"Jane", u"last": u"Doe", u"born": 1900})
        # Setup listener
        def on_snapshot(docs, changes, read_time):
            on_snapshot.called_count += 1
            for doc in [doc for doc in docs if doc.id == doc_ref.id]:
                on_snapshot.born = doc.get("born")
        on_snapshot.called_count = 0
        on_snapshot.born = 0
        collection_ref.on_snapshot(on_snapshot)
        # delay here so initial on_snapshot occurs and isn't combined with set
        sleep(1)
        doc_ref.set({u"first": u"Ada", u"last": u"Lovelace", u"born": 1815})
        for _ in range(10):
            if on_snapshot.born == 1815:
                break
            sleep(1)
        if on_snapshot.born != 1815:
            raise AssertionError(
>               "Expected the last document update to update born: " + str(on_snapshot.born)
            )
E AssertionError: Expected the last document update to update born: 1900
@tseaver tseaver added testing api: firestore Issues related to the Firestore API. type: process A process-related concern. May include testing, release, or the like. flaky labels Jan 16, 2019
tseaver added a commit that referenced this issue Jul 10, 2019
H/t to @pchauhan-qlogic for identifying the need to unsubscribe.

Also, use unique collection IDs for 'watch' tests.

Exception for 'test_watch_query_order', which requires that we use the
special 'users' collection, in order to take advantage of its index.

Supersedes #8497.

Closes #6605, #7130.
@HemangChothani
Copy link
Contributor

closing the issue as solved in 8638

@tseaver
Copy link
Contributor Author

tseaver commented Oct 4, 2019

PR #8638 did not address this issue: it was related to improving how the Firestore system tests clean up resources.

@tseaver tseaver reopened this Oct 4, 2019
@tseaver
Copy link
Contributor Author

tseaver commented Oct 4, 2019

Hmm, looks like I spoke too soon: changing to use a unique collection ID was part of #8638, and was likely a fix for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the Firestore API. flaky testing type: process A process-related concern. May include testing, release, or the like.
Projects
None yet
Development

No branches or pull requests

3 participants