Skip to content

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

Merged
merged 10 commits into from
Jun 28, 2018

Conversation

schmidt-sebastian
Copy link
Contributor

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.

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.

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.
Copy link
Contributor

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?

Copy link
Contributor Author

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;
Copy link
Contributor

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"?)

Copy link
Contributor Author

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
Copy link
Contributor

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.

Copy link
Contributor Author

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) {
Copy link
Contributor

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?)

Copy link
Contributor Author

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.

Copy link
Contributor Author

@schmidt-sebastian schmidt-sebastian left a 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) {
Copy link
Contributor Author

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
Copy link
Contributor Author

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.
Copy link
Contributor Author

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;
Copy link
Contributor Author

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.

@schmidt-sebastian schmidt-sebastian merged commit cd4b9af into master Jun 28, 2018
@schmidt-sebastian schmidt-sebastian deleted the mrschmidt-querysnapshot branch August 3, 2018 17:22
@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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants