-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create common scaffolding for saga undo tests (#3904)
Several of our saga undo tests have previously been found to have defects in which the test verifies that all attempts to execute a saga fail but doesn't verify that saga executions fail at the expected failure point. This loses test coverage, since the tests don't actually execute all of the undo actions of the saga under test. To try to prevent this problem, add a set of saga test helpers that provide common logic for writing undo tests. The scaffold functions handle the business of constructing a DAG, deciding where to inject an error, and verifying that errors occur in the right places. The callers provide a saga type and factory functions that run before and after each saga execution to set up state, provide saga parameters, check invariants, and clean up after each test iteration. Convert existing tests of these types to use the new scaffolds. This revealed that the no-pantry version of the disk snapshot test has a similar bug: the saga requires the disk being snapshotted to be attached to an instance, but the test wasn't creating an instance, so the saga never got past its "look up the instance that owns the disk" step. Fix this issue. Add an additional scaffold that repeats nodes in a successful saga. This case is less fragile than the undo case, but this gets rid of some copy-pasted code. Finally, coalesce some common instance operations (start, stop, delete, simulate) that were used by multiple saga tests into the test helpers. This is a test-only change, tested both by running `cargo test` and finding no errors and by introducing bugs into some sagas and verifying that tests run with the scaffolds catch those bugs. Fixes #3896.
- Loading branch information
Showing
11 changed files
with
869 additions
and
739 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Oops, something went wrong.