Repository navigation
test(secrets): fault injection for the test keyring backend and regression tests for a failing keyring - #1779
Merged
Conversation
…on tests for a failing keyring The memory backend counts calls and can fail the Nth call of a kind or every call until healed, before it touches the stored values. The tests cover a save that fails part-way (add, add with SSH secrets, update), a read that fails on the second key, and a retry after the refusal.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
MemorySecretsStorageBackend(tests only) could fail only the next call. It now also:clear()andresetCounts()restart the numbering;failOnCall(op, n, error)fails the Nth call once,failAlways(op, error)fails every call untilheal(op);failNext*flags keep working and win over the other faults;keysshows what is stored, to check that no secret is left behind.Nothing is added to the production backend; default behaviour is unchanged.
Tests
memory_secrets_backend_test.dart: the guarantees above.secrets_failure_test.dart: what the app does when the keyring refuses a request part-way.addConnectionfails on the 2nd write and on an SSH key write (no row, no secret left, original error rethrown, also when the cleanup is refused);updateConnectionrestores the old row and both old secrets after the new password was stored; a read that fails on the 2nd key isSecretsStoreUnavailableException, not "no password"; the list loads without the password while the keyring is down; retries after a refusal.save_new_connection_test.dart: a save that fails on the 2nd secret leaves nothing and the same row saves on retry.Checked by removing
deleteForConnectionfrom the rollback inaddConnection: three of the new tests fail.Only tests were run (the files above plus
local_db_secrets_testandsecrets_unavailable_connect_test), anddart analyze; no live check of a locked keyring.Not covered
The contract is not written down for: the restore failing too in
updateConnection(#1778), andTeamProfileCodec.importIntostopping at the first failed save (#1759).