-
Notifications
You must be signed in to change notification settings - Fork 929
Add spec test support for target-scoped resume tokens #969
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
Conversation
c4a2f52
to
e71e202
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM as-is but I have a few questions / comments for consideration. I can take another look if you make any major changes.
let protoJSON = this.serializer.toTestWatchChange(watchChange); | ||
this.connection.watchStream!.callOnMessage(protoJSON); | ||
|
||
private doWatchSnapshot(watchSnapshot: SpecWatchSnapshot): Promise<void> { | ||
// The client will only respond to watchSnapshots if they are on a target | ||
// change with an empty set of target IDs. So we should be sure to send a | ||
// separate event. TODO(klimt): We should make the spec tests behave more | ||
// like the backend. Alternatively, we could hook in to the system at a | ||
// level higher than the stream. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know what this TODO is referring to exactly? This PR definitely moves us closer to behaving like the backend. Maybe the TODO could be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO removed.
@@ -1109,7 +1124,7 @@ export interface SpecStep { | |||
* Optional snapshot version that can be additionally specified on any other | |||
* watch event | |||
*/ | |||
watchSnapshot?: SpecSnapshotVersion; | |||
watchSnapshot?: SpecWatchSnapshot; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment ("snapshot version") is a bit out of date (maybe just change to "snapshot"?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Updated the rest of this too.
@@ -556,7 +559,7 @@ abstract class TestRunner { | |||
|
|||
private doWatchAck( | |||
ackedTargets: SpecWatchAck, | |||
watchSnapshot?: SpecSnapshotVersion | |||
watchSnapshot?: SpecWatchSnapshot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW it seems like we could probably remove "watchSnapshot?" from all of these and just have the test do the watchSnapshot step explicitly as a separate step. I don't care strongly though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
this.assertStep('Watch snapshot requires previous watch step'); | ||
this.currentStep!.watchSnapshot = version; | ||
|
||
if (this.currentStep!.watchSnapshot !== undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we just always make the watchSnapshot a separate step (i.e. remove this check? and perhaps the assert above?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I considered that (and added it as a suggestion to the PR description. cough cough). Now consider it done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated PR to make watchSnapshot a separate step everywhere.
This meant that I had to fix a bug in the test "Existence filter limbo resolution is denied". The limbo resolution actually happens at the watchRemove
step and not at the snapshot. This was previously masked since we did not drain the queue right away.
this.assertStep('Watch snapshot requires previous watch step'); | ||
this.currentStep!.watchSnapshot = version; | ||
|
||
if (this.currentStep!.watchSnapshot !== undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I considered that (and added it as a suggestion to the PR description. cough cough). Now consider it done.
@@ -556,7 +559,7 @@ abstract class TestRunner { | |||
|
|||
private doWatchAck( | |||
ackedTargets: SpecWatchAck, | |||
watchSnapshot?: SpecSnapshotVersion | |||
watchSnapshot?: SpecWatchSnapshot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
let protoJSON = this.serializer.toTestWatchChange(watchChange); | ||
this.connection.watchStream!.callOnMessage(protoJSON); | ||
|
||
private doWatchSnapshot(watchSnapshot: SpecWatchSnapshot): Promise<void> { | ||
// The client will only respond to watchSnapshots if they are on a target | ||
// change with an empty set of target IDs. So we should be sure to send a | ||
// separate event. TODO(klimt): We should make the spec tests behave more | ||
// like the backend. Alternatively, we could hook in to the system at a | ||
// level higher than the stream. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO removed.
@@ -1109,7 +1124,7 @@ export interface SpecStep { | |||
* Optional snapshot version that can be additionally specified on any other | |||
* watch event | |||
*/ | |||
watchSnapshot?: SpecSnapshotVersion; | |||
watchSnapshot?: SpecWatchSnapshot; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Updated the rest of this too.
…/firebase-js-sdk into mrschmidt-querysnapshot
…/firebase-js-sdk into mrschmidt-querysnapshot
This PR adds some SpecTest functionality that I thought I needed for Multi-Tab but was then able to proceed without. This give us the option to either just ignore that this ever happened, or to see if we want to merge this change to Master nonetheless.
BTW, this might also be a good time to treat
watchSnapshot
as a separate operation altogether and not piggy-back on the previous watch operation.