-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mixedversion: add public API to disable individual mutators
With this API, tests are now able to disable individual mutators if they are incompatible with the test (e.g., setting a cluster setting that conflicts with what the test is trying to do). Tests should be able to disable mutators with something like the following: ```go mvt := mixedversion.NewTest(..., mixedversion.DisableMutators(mixedversion.ClusterSetting("foo")), ) ``` Note: this is just an example -- individual mutator implementatios are not yet available. Epic: none Release note: None
- Loading branch information
1 parent
cc4fdff
commit a05283d
Showing
5 changed files
with
222 additions
and
17 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
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
47 changes: 47 additions & 0 deletions
47
pkg/cmd/roachtest/roachtestutil/mixedversion/testdata/planner/conflicting_mutators
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Tests that we are able to deal with mutators that insert relative to | ||
# steps that are later removed by subsequent mutations. The initial | ||
# insertion should create a concurrent step with user-hooks (see | ||
# `mutator_probabilities` test) and the second mutator removes user | ||
# hooks, flattening that concurrent run. | ||
|
||
add-mutators concurrent_user_hooks_mutator remove_user_hooks_mutator | ||
---- | ||
ok | ||
|
||
# ensure both mutators are always applied | ||
mixed-version-test num_upgrades=1 mutator_probabilities=(concurrent_user_hooks_mutator, 1, remove_user_hooks_mutator, 1) | ||
---- | ||
ok | ||
|
||
in-mixed-version name=(my mixed version feature) | ||
---- | ||
ok | ||
|
||
plan debug=true | ||
---- | ||
mixed-version test plan for upgrading from "v22.2.8" to "<current>" with mutators {concurrent_user_hooks_mutator, remove_user_hooks_mutator}: | ||
├── install fixtures for version "v22.2.8" (1) [stage=cluster-setup] | ||
├── start cluster at version "v22.2.8" (2) [stage=cluster-setup] | ||
├── wait for nodes :1-4 to reach cluster version '22.2' (3) [stage=cluster-setup] | ||
└── upgrade cluster from "v22.2.8" to "<current>" | ||
├── prevent auto-upgrades by setting `preserve_downgrade_option` (4) [stage=init] | ||
├── upgrade nodes :1-4 from "v22.2.8" to "<current>" | ||
│ ├── restart node 4 with binary version <current> (5) [stage=temporary-upgrade] | ||
│ ├── restart node 2 with binary version <current> (6) [stage=temporary-upgrade] | ||
│ ├── restart node 3 with binary version <current> (7) [stage=temporary-upgrade] | ||
│ ├── testSingleStep (8) [stage=temporary-upgrade] | ||
│ └── restart node 1 with binary version <current> (9) [stage=temporary-upgrade] | ||
├── downgrade nodes :1-4 from "<current>" to "v22.2.8" | ||
│ ├── restart node 2 with binary version v22.2.8 (10) [stage=rollback-upgrade] | ||
│ ├── restart node 4 with binary version v22.2.8 (11) [stage=rollback-upgrade] | ||
│ ├── testSingleStep (12) [stage=rollback-upgrade] | ||
│ ├── restart node 1 with binary version v22.2.8 (13) [stage=rollback-upgrade] | ||
│ └── restart node 3 with binary version v22.2.8 (14) [stage=rollback-upgrade] | ||
├── upgrade nodes :1-4 from "v22.2.8" to "<current>" | ||
│ ├── restart node 2 with binary version <current> (15) [stage=last-upgrade] | ||
│ ├── restart node 4 with binary version <current> (16) [stage=last-upgrade] | ||
│ ├── testSingleStep (17) [stage=last-upgrade] | ||
│ ├── restart node 1 with binary version <current> (18) [stage=last-upgrade] | ||
│ └── restart node 3 with binary version <current> (19) [stage=last-upgrade] | ||
├── finalize upgrade by resetting `preserve_downgrade_option` (20) [stage=running-upgrade-migrations] | ||
└── wait for nodes :1-4 to reach cluster version <current> (21) [stage=running-upgrade-migrations] |
49 changes: 49 additions & 0 deletions
49
pkg/cmd/roachtest/roachtestutil/mixedversion/testdata/planner/mutator_probabilities
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Tests that we are able to override probabilities for specific mutators. | ||
|
||
add-mutators concurrent_user_hooks_mutator | ||
---- | ||
ok | ||
|
||
# ensure our `test_mutator` is always applied | ||
mixed-version-test num_upgrades=1 mutator_probabilities=(concurrent_user_hooks_mutator, 1) | ||
---- | ||
ok | ||
|
||
in-mixed-version name=(my mixed version feature) | ||
---- | ||
ok | ||
|
||
plan debug=true | ||
---- | ||
mixed-version test plan for upgrading from "v22.2.8" to "<current>" with mutators {concurrent_user_hooks_mutator}: | ||
├── install fixtures for version "v22.2.8" (1) [stage=cluster-setup] | ||
├── start cluster at version "v22.2.8" (2) [stage=cluster-setup] | ||
├── wait for nodes :1-4 to reach cluster version '22.2' (3) [stage=cluster-setup] | ||
└── upgrade cluster from "v22.2.8" to "<current>" | ||
├── prevent auto-upgrades by setting `preserve_downgrade_option` (4) [stage=init] | ||
├── upgrade nodes :1-4 from "v22.2.8" to "<current>" | ||
│ ├── restart node 4 with binary version <current> (5) [stage=temporary-upgrade] | ||
│ ├── restart node 2 with binary version <current> (6) [stage=temporary-upgrade] | ||
│ ├── restart node 3 with binary version <current> (7) [stage=temporary-upgrade] | ||
│ ├── run following steps concurrently | ||
│ │ ├── run "my mixed version feature", after 500ms delay (8) [stage=temporary-upgrade] | ||
│ │ └── testSingleStep, after 5s delay (9) [stage=temporary-upgrade] | ||
│ └── restart node 1 with binary version <current> (10) [stage=temporary-upgrade] | ||
├── downgrade nodes :1-4 from "<current>" to "v22.2.8" | ||
│ ├── restart node 2 with binary version v22.2.8 (11) [stage=rollback-upgrade] | ||
│ ├── restart node 4 with binary version v22.2.8 (12) [stage=rollback-upgrade] | ||
│ ├── run following steps concurrently | ||
│ │ ├── run "my mixed version feature", after 0s delay (13) [stage=rollback-upgrade] | ||
│ │ └── testSingleStep, after 30s delay (14) [stage=rollback-upgrade] | ||
│ ├── restart node 1 with binary version v22.2.8 (15) [stage=rollback-upgrade] | ||
│ └── restart node 3 with binary version v22.2.8 (16) [stage=rollback-upgrade] | ||
├── upgrade nodes :1-4 from "v22.2.8" to "<current>" | ||
│ ├── restart node 2 with binary version <current> (17) [stage=last-upgrade] | ||
│ ├── restart node 4 with binary version <current> (18) [stage=last-upgrade] | ||
│ ├── run following steps concurrently | ||
│ │ ├── run "my mixed version feature", after 500ms delay (19) [stage=last-upgrade] | ||
│ │ └── testSingleStep, after 30s delay (20) [stage=last-upgrade] | ||
│ ├── restart node 1 with binary version <current> (21) [stage=last-upgrade] | ||
│ └── restart node 3 with binary version <current> (22) [stage=last-upgrade] | ||
├── finalize upgrade by resetting `preserve_downgrade_option` (23) [stage=running-upgrade-migrations] | ||
└── wait for nodes :1-4 to reach cluster version <current> (24) [stage=running-upgrade-migrations] |