Fix and skip flaky Firestore tests (#7552)

* Fix and skip flaky tests

* add todos

* more nits
This commit is contained in:
wu-hui
2023-08-14 13:06:33 -04:00
committed by GitHub
parent 07ffeac048
commit 4115d81747
3 changed files with 24 additions and 9 deletions
@@ -798,9 +798,11 @@ apiDescribe('Database', persistence => {
.then(snap => {
expect(snap.exists()).to.be.true;
expect(snap.data()).to.deep.equal({ a: 1 });
expect(snap.metadata.hasPendingWrites).to.be.false;
})
.then(() => storeEvent.assertNoAdditionalEvents());
// This event could be a metadata change for fromCache as well.
// We comment this line out to reduce flakiness.
// TODO(b/295872012): Figure out a way to check for all scenarios.
// expect(snap.metadata.hasPendingWrites).to.be.false;
});
});
});
@@ -827,9 +829,11 @@ apiDescribe('Database', persistence => {
.then(() => storeEvent.awaitEvent())
.then(snap => {
expect(snap.data()).to.deep.equal(changedData);
expect(snap.metadata.hasPendingWrites).to.be.false;
})
.then(() => storeEvent.assertNoAdditionalEvents());
// This event could be a metadata change for fromCache as well.
// We comment this line out to reduce flakiness.
// TODO(b/295872012): Figure out a way to check for all scenarios.
// expect(snap.metadata.hasPendingWrites).to.be.false;
});
});
});
@@ -102,7 +102,10 @@ apiDescribe('Numeric Transforms:', persistence => {
});
});
it('increment existing integer with integer', async () => {
// TODO(b/295872012): This test is skipped due to a timeout test flakiness
// We should investigate if this is an acutal bug.
// eslint-disable-next-line no-restricted-properties
it.skip('increment existing integer with integer', async () => {
await withTestSetup(async () => {
await writeInitialData({ sum: 1337 });
await updateDoc(docRef, 'sum', increment(1));
@@ -158,7 +161,11 @@ apiDescribe('Numeric Transforms:', persistence => {
});
});
it('multiple double increments', async () => {
// TODO(b/295872012): This test is skipped due to test flakiness:
// AssertionError: expected 0.122 to be close to 0.111 +/- 0.000001
// We should investigate the root cause, it might be an acutal bug.
// eslint-disable-next-line no-restricted-properties
it.skip('multiple double increments', async () => {
await withTestSetup(async () => {
await writeInitialData({ sum: 0.0 });
@@ -444,7 +444,11 @@ apiDescribe('Queries', persistence => {
});
});
it('can listen for the same query with different options', () => {
// TODO(b/295872012): This test is skipped due to the flakiness around the
// checks of hasPendingWrites.
// We should investigate if this is an acutal bug.
// eslint-disable-next-line no-restricted-properties
it.skip('can listen for the same query with different options', () => {
const testDocs = { a: { v: 'a' }, b: { v: 'b' } };
return withTestCollection(persistence, testDocs, coll => {
const storeEvent = new EventsAccumulator<QuerySnapshot>();