Skip to content

Clean up recovery spec tests #3085

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 1 commit into from
May 21, 2020
Merged

Conversation

schmidt-sebastian
Copy link
Contributor

Almost all recovery spec tests only fail a single Transaction type. This PR cleans up the spec tests to make the calling code a lot prettier.

@google-oss-bot
Copy link
Contributor

Binary Size Report

Affected SDKs

No changes between base commit (d656e03) and head commit (6433a50).

Test Logs

'Synchronize last document change read time': true,
'Lookup mutation documents': true
})
.failDatabaseTransactions('Lookup mutation documents')
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like a different test than what was here before. Previously the write of the mutation to IndexedDB would fail (as would the lookup) but now this is failing just the lookup and allowing the write to succeed?

Alternatively, if this is working as intended, better names would help make it clearer just which transaction is failing. For example, if this were named multitab.secondary.mutationLookup it would be much, much clearer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is already a dedicated test that test if "Locally write mutations" fails ("Recovers when write cannot be persisted"). The fact that "Locally write mutations" is part of this list seems like an oversight to me - the mutation gets written right before and not after we start injecting failures.

There are certainly improvements to the transaction names that we should make before we port to Android/iOS, but I would like to point out that 'Lookup mutation documents' is also used by the primary tab to load a mutation that has been written by a secondary tab.

'Lookup mutation documents': true,
'Get new document changes': true
})
.failDatabaseTransactions('Get new document changes')
Copy link
Contributor

Choose a reason for hiding this comment

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

Same concern here: previously this failed to allocate a target at all, which should have caused the listen to fail. Now this is only failing much later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Similar response: The target is already allocated and this seems like a copy/paste issue. Failed target allocations are tested in 'Fails targets that cannot be allocated'.
I am not 100% convinced we need multi-tab specific tests for these initial failures, since these failures happen before we kick off any multi-tab specific failures. If we add a test, it would be a sanity check to ensure that we don't write a Local Storage notification if we failed to persist the target/write.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK. I see it now. Thanks for talking it through with me.

Copy link
Contributor

@wilhuff wilhuff left a comment

Choose a reason for hiding this comment

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

LGTM

'Lookup mutation documents': true,
'Get new document changes': true
})
.failDatabaseTransactions('Get new document changes')
Copy link
Contributor

Choose a reason for hiding this comment

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

OK. I see it now. Thanks for talking it through with me.

@wilhuff wilhuff assigned schmidt-sebastian and unassigned wilhuff May 21, 2020
@schmidt-sebastian schmidt-sebastian merged commit 9d87d70 into master May 21, 2020
@firebase firebase locked and limited conversation to collaborators Jun 21, 2020
@schmidt-sebastian schmidt-sebastian deleted the mrschmidt/simplifyspecs branch July 9, 2020 17:44
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