Skip to content

Index-Free: Port LocalStore tests #2173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Sep 17, 2019

Conversation

schmidt-sebastian
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian commented Sep 12, 2019

This ports the new LocalStore tests for Index-Free starting from https://github.com/firebase/firebase-android-sdk/blob/master/firebase-firestore/src/test/java/com/google/firebase/firestore/local/LocalStoreTestCase.java#L1035

During the porting, I realized that the new number of documents counter doesn't quite work (as predicted by @mikelehen). I had to modify it to differentiate between documents returned during query execution and documents read by single-key lookup.

I also added a second commit that uses it.skip instead of exiting out of tests early when gcIsEager is not set correctly. This ports some of the changes made to the Android LocalStore tests, but I just realized that there are still some test that exit early on Android. With that said, I don't feel very strongly about 944d445.

Copy link
Contributor

@mikelehen mikelehen left a comment

Choose a reason for hiding this comment

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

LGTM with nits.

@@ -324,9 +348,9 @@ export function docAddedRemoteEvent(
doc
);
aggregator.handleDocumentChange(docChange);
version = doc.version.compareTo(version) ? doc.version : version;
Copy link
Contributor

Choose a reason for hiding this comment

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

What does this do? It seems like doc.version.compareTo(version) will be falsey iff the versions are equal and so this is equivalent to version = doc.version. Or maybe you meant to implement something else?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's see:

version = doc.version.compareTo(version) ? doc.version : version;
=> 
version = doc.version != version ? doc.version : doc.version;
=>
version = doc.version

So you are right. It's a fancy way of picking the last version.

I rewrote it to pick the highest version instead.

* @param expectedCount.documentsByQuery The number of mutations read by
* executing a query against the RemoteDocumentCache.
* @param expectedCount.documentsByKey The number of documents read by
* single-key lookups.
Copy link
Contributor

Choose a reason for hiding this comment

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

FWIW single-key is a bit misleading here and above since the count includes multi-key lookups as well (IFIUC).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to "document key lookups".

@schmidt-sebastian schmidt-sebastian changed the base branch from mrschmidt/engine to mrschmidt/indexfree-master September 17, 2019 21:03
@schmidt-sebastian schmidt-sebastian merged commit 7a3a2d1 into mrschmidt/indexfree-master Sep 17, 2019
@schmidt-sebastian schmidt-sebastian deleted the mrschmidt/missingtests branch October 10, 2019 22:55
@firebase firebase locked and limited conversation to collaborators Oct 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants