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: Failing system tests. #8090

Closed
busunkim96 opened this issue May 21, 2019 · 2 comments
Closed

Firestore: Failing system tests. #8090

busunkim96 opened this issue May 21, 2019 · 2 comments
Assignees
Labels
api: firestore Issues related to the Firestore API. help wanted We'd love to have community involvement on this issue. status: duplicate Duplicate. testing type: process A process-related concern. May include testing, release, or the like.

Comments

@busunkim96
Copy link
Contributor

See log.

Example PRs: #8076 #8075 #8074

The same test fails for 2.7 and 3.7 system tests, so it seems like a real failure?

py.test --quiet tests/system.py
............F...........                                                 [100%]
=================================== FAILURES ===================================
_____________________________ test_collection_add ______________________________
client = <google.cloud.firestore_v1.client.Client object at 0x7f60bd501450>
cleanup = <built-in method append of list object at 0x7f60bafc8ef0>
    def test_collection_add(client, cleanup):
        collection1 = client.collection("collek")
        collection2 = client.collection("collek", "shun", "child")
        collection3 = client.collection("collek", "table", "child")
        explicit_doc_id = "hula" + unique_resource_id("-")
        assert set(collection1.list_documents()) == set()
        assert set(collection2.list_documents()) == set()
        assert set(collection3.list_documents()) == set()
        # Auto-ID at top-level.
        data1 = {"foo": "bar"}
        update_time1, document_ref1 = collection1.add(data1)
        cleanup(document_ref1)
        assert set(collection1.list_documents()) == {document_ref1}
        assert set(collection2.list_documents()) == set()
        assert set(collection3.list_documents()) == set()
        snapshot1 = document_ref1.get()
        assert snapshot1.to_dict() == data1
        assert snapshot1.update_time == update_time1
        assert RANDOM_ID_REGEX.match(document_ref1.id)
        # Explicit ID at top-level.
        data2 = {"baz": 999}
        update_time2, document_ref2 = collection1.add(data2, document_id=explicit_doc_id)
        cleanup(document_ref2)
>       assert set(collection1.list_documents()) == {document_ref1, document_ref2}
E       AssertionError: assert set([<google....f60bafcba50>]) == set([<google.c...f60bafcb7d0>])
E         Extra items in the left set:
E         <google.cloud.firestore_v1.document.DocumentReference object at 0x7f60bafcba50>
E         Full diff:
E         - set([<google.cloud.firestore_v1.document.DocumentReference object at 0x7f60bafcb810>,
E         ?                                                                                 ^^
E         + set([<google.cloud.firestore_v1.document.DocumentReference object at 0x7f60bafcb690>,
E         ?                                                                                 ^^...
E
E         ...Full output truncated (6 lines hidden), use '-vv' to show
tests/system.py:427: AssertionError
1 failed, 23 passed in 34.10 seconds
Command py.test --quiet tests/system.py failed with exit code 1
Session system-2.7 failed.
Running session system-3.7
Creating virtualenv using python3.7 in /tmpfs/src/github/google-cloud-python/firestore/.nox/system-3-7
pip install --pre grpcio
pip install mock pytest
pip install -e ../api_core
pip install -e ../core
pip install -e ../test_utils/
pip install -e .
py.test --quiet tests/system.py
............F...........                                                 [100%]
=================================== FAILURES ===================================
_____________________________ test_collection_add ______________________________
client = <google.cloud.firestore_v1.client.Client object at 0x7fcf24e2b080>
cleanup = <built-in method append of list object at 0x7fcf22e15fc8>
    def test_collection_add(client, cleanup):
        collection1 = client.collection("collek")
        collection2 = client.collection("collek", "shun", "child")
        collection3 = client.collection("collek", "table", "child")
        explicit_doc_id = "hula" + unique_resource_id("-")
        assert set(collection1.list_documents()) == set()
        assert set(collection2.list_documents()) == set()
        assert set(collection3.list_documents()) == set()
        # Auto-ID at top-level.
        data1 = {"foo": "bar"}
        update_time1, document_ref1 = collection1.add(data1)
        cleanup(document_ref1)
        assert set(collection1.list_documents()) == {document_ref1}
        assert set(collection2.list_documents()) == set()
        assert set(collection3.list_documents()) == set()
        snapshot1 = document_ref1.get()
        assert snapshot1.to_dict() == data1
        assert snapshot1.update_time == update_time1
        assert RANDOM_ID_REGEX.match(document_ref1.id)
        # Explicit ID at top-level.
        data2 = {"baz": 999}
        update_time2, document_ref2 = collection1.add(data2, document_id=explicit_doc_id)
        cleanup(document_ref2)
        assert set(collection1.list_documents()) == {document_ref1, document_ref2}
        assert set(collection2.list_documents()) == set()
        assert set(collection3.list_documents()) == set()
        snapshot2 = document_ref2.get()
        assert snapshot2.to_dict() == data2
        assert snapshot2.create_time == update_time2
        assert snapshot2.update_time == update_time2
        assert document_ref2.id == explicit_doc_id
        nested_ref = collection1.document("shun")
        # Auto-ID for nested collection.
        data3 = {"quux": b"\x00\x01\x02\x03"}
        update_time3, document_ref3 = collection2.add(data3)
        cleanup(document_ref3)
        assert set(collection1.list_documents()) == {
            document_ref1,
            document_ref2,
            nested_ref,
        }
        assert set(collection2.list_documents()) == {document_ref3}
        assert set(collection3.list_documents()) == set()
        snapshot3 = document_ref3.get()
        assert snapshot3.to_dict() == data3
        assert snapshot3.update_time == update_time3
        assert RANDOM_ID_REGEX.match(document_ref3.id)
        # Explicit for nested collection.
        data4 = {"kazaam": None, "bad": False}
        update_time4, document_ref4 = collection2.add(data4, document_id=explicit_doc_id)
        cleanup(document_ref4)
        assert set(collection1.list_documents()) == {
            document_ref1,
            document_ref2,
            nested_ref,
        }
        assert set(collection2.list_documents()) == {document_ref3, document_ref4}
        assert set(collection3.list_documents()) == set()
        snapshot4 = document_ref4.get()
        assert snapshot4.to_dict() == data4
        assert snapshot4.create_time == update_time4
        assert snapshot4.update_time == update_time4
        assert document_ref4.id == explicit_doc_id
        # Exercise "missing" document (no doc, but subcollection).
        data5 = {"bam": 123, "folyk": False}
        update_time5, document_ref5 = collection3.add(data5)
        cleanup(document_ref5)
        missing_ref = collection1.document("table")
>       assert set(collection1.list_documents()) == {
            document_ref1,
            document_ref2,
            nested_ref,
            missing_ref,
        }
E       AssertionError: assert {<google.clou...7fcf21f78278>} == {<google.cloud...7fcf21f74710>}
E         Extra items in the left set:
E         <google.cloud.firestore_v1.document.DocumentReference object at 0x7fcf21f78198>
E         Full diff:
E         - {<google.cloud.firestore_v1.document.DocumentReference object at 0x7fcf21f74e10>,
E         ?                                                                             - ^
E         + {<google.cloud.firestore_v1.document.DocumentReference object at 0x7fcf21f74128>,
E         ?                                                                              ^^...
E
E         ...Full output truncated (14 lines hidden), use '-vv' to show
tests/system.py:476: AssertionError
@busunkim96 busunkim96 added the api: firestore Issues related to the Firestore API. label May 21, 2019
@tseaver tseaver added testing type: process A process-related concern. May include testing, release, or the like. labels May 22, 2019
@tseaver
Copy link
Contributor

tseaver commented May 22, 2019

This could be racy (more than one CI run hitting the collection). The fix should be use use a collection which embeds the unique ID for the test run in its name.

@crwilcox crwilcox added the help wanted We'd love to have community involvement on this issue. label Jun 25, 2019
@tseaver
Copy link
Contributor

tseaver commented Jun 26, 2019

Duplicate of #7829.

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. help wanted We'd love to have community involvement on this issue. status: duplicate Duplicate. 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