Skip to content

Mila/bloom filter add integration test - #7045

Merged
milaGGL merged 6 commits into
mila/BloomFilterfrom
mila/BloomFilter-add-integration-test
Feb 17, 2023
Merged

Mila/bloom filter add integration test#7045
milaGGL merged 6 commits into
mila/BloomFilterfrom
mila/BloomFilter-add-integration-test

Conversation

@milaGGL

@milaGGL milaGGL commented Feb 16, 2023

Copy link
Copy Markdown
Contributor

Integration Test 1 - Typical Case

  • Create 100 randomly-named documents.
  • Run a query to sync these 100 documents locally with a resume token.
  • Delete 50 of the documents using a transaction (so as not to affect the local cache).
  • Wait 10 seconds, during which the CLC will stop tracking the query and will send an existence filter rather than "delete" events.
  • Re-run the same query from step 2 (which will use the resume token).
  • Verify that a snapshot eventually gets raised with the 50 documents that were not deleted.
@changeset-bot

changeset-bot Bot commented Feb 16, 2023

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 4cb8e3f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@milaGGL
milaGGL changed the base branch from mila/BloomFilter to master February 16, 2023 21:49
@milaGGL
milaGGL changed the base branch from master to mila/BloomFilter February 16, 2023 21:49
@google-oss-bot

google-oss-bot commented Feb 16, 2023

Copy link
Copy Markdown
Collaborator
@google-oss-bot

google-oss-bot commented Feb 16, 2023

Copy link
Copy Markdown
Collaborator
@milaGGL
milaGGL requested a review from dconeybe February 17, 2023 02:12

// eslint-disable-next-line no-restricted-properties
(persistence ? it.skip : it)(
'can raise expected snapshot when resume query after deleting docs',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider renaming this test to something like "resuming a query should remove deleted documents indicated by existence filter"

() => {
const testDocs = {};
for (let i = 1; i <= 100; i++) {
Object.assign(testDocs, { ['doc' + i]: { key: i } });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can

Object.assign(testDocs, { ['doc' + i]: { key: i } })

be simplified to

testDocs['doc' + i] = { key: i }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typescript is not quite happy about with that:
Screenshot 2023-02-16 at 6 26 04 PM

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can convince TypeScript to be happy. Does this work:

Change

const testDocs = {};

to

const testDocs: { [key: string]: Object } = {}; 
txn.delete(doc(coll, 'doc' + i));
}
});
// Wait 10 seconds, during which the watch will stop tracking the query

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "the watch" -> "Watch" (with a capital "W")

});
// Wait 10 seconds, during which the watch will stop tracking the query
// and will send an existence filter rather than "delete" events.
await (function () {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can

await (function () {
  return new Promise(resolve => setTimeout(resolve, 10000));
})();

be simplified to

await new Promise(resolve => setTimeout(resolve, 10000));
@milaGGL
milaGGL requested a review from dconeybe February 17, 2023 02:50
@milaGGL
milaGGL merged commit 97ca3ee into mila/BloomFilter Feb 17, 2023
@milaGGL
milaGGL deleted the mila/BloomFilter-add-integration-test branch February 17, 2023 23:04
@firebase firebase locked and limited conversation to collaborators Mar 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

3 participants