diff options
author | 2018-01-05 10:56:16 -0800 | |
---|---|---|
committer | 2018-01-05 10:56:16 -0800 | |
commit | 2c6682c66ea7b86b3b7cb52e623086b4184d500a (patch) | |
tree | 8247e9786c78841e987a8199960ec245e32a8833 /Firestore/Example/Tests/Integration/API | |
parent | 275b4e5a7633d69b6de36551398e88943dca8432 (diff) | |
parent | ed6c6f9fea3e1e429972cbd0e65f3fc7c05e41e2 (diff) |
Merge pull request #621 from firebase/mrschmidt-fixrace
Fixing potential race in ServerTimestamp tests
Diffstat (limited to 'Firestore/Example/Tests/Integration/API')
-rw-r--r-- | Firestore/Example/Tests/Integration/API/FIRServerTimestampTests.m | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Firestore/Example/Tests/Integration/API/FIRServerTimestampTests.m b/Firestore/Example/Tests/Integration/API/FIRServerTimestampTests.m index 5cda053..cc0ab29 100644 --- a/Firestore/Example/Tests/Integration/API/FIRServerTimestampTests.m +++ b/Firestore/Example/Tests/Integration/API/FIRServerTimestampTests.m @@ -101,15 +101,19 @@ /** Waits for a snapshot with local writes. */ - (FIRDocumentSnapshot *)waitForLocalEvent { - FIRDocumentSnapshot *snapshot = [_accumulator awaitEventWithName:@"Local event."]; - XCTAssertTrue(snapshot.metadata.hasPendingWrites); + FIRDocumentSnapshot *snapshot; + do { + snapshot = [_accumulator awaitEventWithName:@"Local event."]; + } while (!snapshot.metadata.hasPendingWrites); return snapshot; } /** Waits for a snapshot that has no pending writes */ - (FIRDocumentSnapshot *)waitForRemoteEvent { - FIRDocumentSnapshot *snapshot = [_accumulator awaitEventWithName:@"Remote event."]; - XCTAssertFalse(snapshot.metadata.hasPendingWrites); + FIRDocumentSnapshot *snapshot; + do { + snapshot = [_accumulator awaitEventWithName:@"Remote event."]; + } while (snapshot.metadata.hasPendingWrites); return snapshot; } |