Similar to #6605, #6921.
From this Kokoro Firestore run:
____________________________test_watch_collection_____________________________client=<google.cloud.firestore_v1beta1.client.Clientobjectat0x7ff27e1c25d0>cleanup=<built-inmethodappendoflistobjectat0x7ff27e1ac878>deftest_watch_collection(client, cleanup):
db=clientdoc_ref=db.collection(u"users").document(u"alovelace"+unique_resource_id())
collection_ref=db.collection(u"users")
# Initial settingdoc_ref.set({u"first": u"Jane", u"last": u"Doe", u"born": 1900})
# Setup listenerdefon_snapshot(docs, changes, read_time):
on_snapshot.called_count+=1fordocin [docfordocindocsifdoc.id==doc_ref.id]:
on_snapshot.born=doc.get("born")
on_snapshot.called_count=0on_snapshot.born=0collection_ref.on_snapshot(on_snapshot)
# delay here so initial on_snapshot occurs and isn't combined with setsleep(1)
doc_ref.set({u"first": u"Ada", u"last": u"Lovelace", u"born": 1815})
for_inrange(10):
ifon_snapshot.born==1815:
breaksleep(1)
ifon_snapshot.born!=1815:
raiseAssertionError(>"Expected the last document update to update born: "+str(on_snapshot.born)
)
EAssertionError: Expectedthelastdocumentupdatetoupdateborn: 1900
Similar to #6605, #6921.
From this Kokoro Firestore run: