File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
google-cloud-clients/google-cloud-firestore/src
main/java/com/google/cloud/firestore
test/java/com/google/cloud/firestore Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -406,7 +406,6 @@ public void run() {
406406 Preconditions .checkState (stream == null );
407407
408408 current = false ;
409- hasPushed = false ;
410409 nextAttempt = backoff .createNextAttempt (nextAttempt );
411410
412411 stream = firestore .streamRequest (Watch .this , firestore .getClient ().listenCallable ());
Original file line number Diff line number Diff line change @@ -304,6 +304,35 @@ public void queryWatchReopensOnUnexceptedStreamEnd() throws InterruptedException
304304 awaitQuerySnapshot (new SnapshotDocument (ChangeType .ADDED , "coll/doc" , SINGLE_FIELD_MAP ));
305305 }
306306
307+ @ Test
308+ public void queryWatchDoesntSendRaiseSnapshotOnReset () throws InterruptedException {
309+ // This test is meant to reproduce https://github.com/googleapis/google-cloud-dotnet/issues/2542
310+ addQueryListener ();
311+
312+ awaitAddTarget ();
313+
314+ send (addTarget ());
315+ send (current ());
316+ send (snapshot ());
317+
318+ awaitQuerySnapshot ();
319+
320+ close ();
321+ awaitClose ();
322+ awaitAddTarget ();
323+
324+ send (addTarget ());
325+ send (current ());
326+ // This should not raise a snapshot, since nothing has changed since the last snapshot.
327+ send (snapshot ());
328+
329+ send (doc ("coll/doc" , SINGLE_FIELD_PROTO ));
330+ send (snapshot ());
331+
332+ // Verify that we only receveived one snapshot.
333+ awaitQuerySnapshot (new SnapshotDocument (ChangeType .ADDED , "coll/doc" , SINGLE_FIELD_MAP ));
334+ }
335+
307336 @ Test
308337 public void queryWatchDoesntReopenInactiveStream () throws InterruptedException {
309338 addQueryListener ();
You can’t perform that action at this time.
0 commit comments