diff options
10 files changed, 36 insertions, 0 deletions
diff --git a/buildscripts/resmokeconfig/suites/jstestfuzz_interrupt_replication.yml b/buildscripts/resmokeconfig/suites/jstestfuzz_interrupt_replication.yml index 3d4f33fb61e..85d20ea5863 100644 --- a/buildscripts/resmokeconfig/suites/jstestfuzz_interrupt_replication.yml +++ b/buildscripts/resmokeconfig/suites/jstestfuzz_interrupt_replication.yml @@ -18,6 +18,7 @@ executor: eval: load('jstests/libs/jstestfuzz/check_for_interrupt_hook.js') readMode: commands hooks: + - class: FuzzerRestoreClusterSettings # The CheckReplDBHash hook waits until all operations have replicated to and have been applied # on the secondaries, so we run the ValidateCollections hook after it to ensure we're # validating the entire contents of the collection. diff --git a/buildscripts/resmokeconfig/suites/jstestfuzz_replication.yml b/buildscripts/resmokeconfig/suites/jstestfuzz_replication.yml index eb7e8394a4c..9a5f82025ba 100644 --- a/buildscripts/resmokeconfig/suites/jstestfuzz_replication.yml +++ b/buildscripts/resmokeconfig/suites/jstestfuzz_replication.yml @@ -18,6 +18,7 @@ executor: # Other fuzzers test commands against replica sets with logical session ids. disableImplicitSessions: true hooks: + - class: FuzzerRestoreClusterSettings # The CheckReplDBHash hook waits until all operations have replicated to and have been applied # on the secondaries, so we run the ValidateCollections hook after it to ensure we're # validating the entire contents of the collection. diff --git a/buildscripts/resmokeconfig/suites/jstestfuzz_replication_continuous_stepdown.yml b/buildscripts/resmokeconfig/suites/jstestfuzz_replication_continuous_stepdown.yml index 1dff83bc3b7..10f24f4ff69 100644 --- a/buildscripts/resmokeconfig/suites/jstestfuzz_replication_continuous_stepdown.yml +++ b/buildscripts/resmokeconfig/suites/jstestfuzz_replication_continuous_stepdown.yml @@ -17,6 +17,7 @@ executor: ignoreCommandsIncompatibleWithRollback: true hooks: - class: ContinuousStepdown + - class: FuzzerRestoreClusterSettings # The CheckReplDBHash hook waits until all operations have replicated to and have been applied # on the secondaries, so we run the ValidateCollections hook after it to ensure we're # validating the entire contents of the collection. diff --git a/buildscripts/resmokeconfig/suites/jstestfuzz_replication_session.yml b/buildscripts/resmokeconfig/suites/jstestfuzz_replication_session.yml index e9ce5c1f0f4..e77e920ce21 100644 --- a/buildscripts/resmokeconfig/suites/jstestfuzz_replication_session.yml +++ b/buildscripts/resmokeconfig/suites/jstestfuzz_replication_session.yml @@ -15,6 +15,7 @@ executor: eval: load("jstests/libs/override_methods/enable_sessions.js") readMode: commands hooks: + - class: FuzzerRestoreClusterSettings # The CheckReplDBHash hook waits until all operations have replicated to and have been applied # on the secondaries, so we run the ValidateCollections hook after it to ensure we're # validating the entire contents of the collection. diff --git a/buildscripts/resmokeconfig/suites/jstestfuzz_sharded.yml b/buildscripts/resmokeconfig/suites/jstestfuzz_sharded.yml index 6926c24a2da..0ef03428e29 100644 --- a/buildscripts/resmokeconfig/suites/jstestfuzz_sharded.yml +++ b/buildscripts/resmokeconfig/suites/jstestfuzz_sharded.yml @@ -17,6 +17,7 @@ executor: disableImplicitSessions: true readMode: commands hooks: + - class: FuzzerRestoreClusterSettings - class: CheckReplDBHash shell_options: global_vars: diff --git a/buildscripts/resmokeconfig/suites/jstestfuzz_sharded_causal_consistency.yml b/buildscripts/resmokeconfig/suites/jstestfuzz_sharded_causal_consistency.yml index d113ac626ef..17a5df00682 100644 --- a/buildscripts/resmokeconfig/suites/jstestfuzz_sharded_causal_consistency.yml +++ b/buildscripts/resmokeconfig/suites/jstestfuzz_sharded_causal_consistency.yml @@ -18,6 +18,7 @@ executor: runningWithCausalConsistency: true usingReplicaSetShards: true hooks: + - class: FuzzerRestoreClusterSettings - class: CheckReplDBHash shell_options: global_vars: diff --git a/buildscripts/resmokeconfig/suites/jstestfuzz_sharded_continuous_stepdown.yml b/buildscripts/resmokeconfig/suites/jstestfuzz_sharded_continuous_stepdown.yml index b09fa1047c0..adb550db64a 100644 --- a/buildscripts/resmokeconfig/suites/jstestfuzz_sharded_continuous_stepdown.yml +++ b/buildscripts/resmokeconfig/suites/jstestfuzz_sharded_continuous_stepdown.yml @@ -21,6 +21,7 @@ executor: - class: ContinuousStepdown config_stepdown: true shard_stepdown: true + - class: FuzzerRestoreClusterSettings # The CheckReplDBHash hook waits until all operations have replicated to and have been applied # on the secondaries, so we run the ValidateCollections hook after it to ensure we're # validating the entire contents of the collection. diff --git a/buildscripts/resmokeconfig/suites/jstestfuzz_sharded_session.yml b/buildscripts/resmokeconfig/suites/jstestfuzz_sharded_session.yml index 492d2c5f807..76d01058408 100644 --- a/buildscripts/resmokeconfig/suites/jstestfuzz_sharded_session.yml +++ b/buildscripts/resmokeconfig/suites/jstestfuzz_sharded_session.yml @@ -14,6 +14,7 @@ executor: eval: load("jstests/libs/override_methods/enable_sessions.js") readMode: commands hooks: + - class: FuzzerRestoreClusterSettings - class: CheckReplDBHash shell_options: global_vars: diff --git a/buildscripts/resmokelib/testing/hooks/fuzzer_restore_cluster_settings.py b/buildscripts/resmokelib/testing/hooks/fuzzer_restore_cluster_settings.py new file mode 100644 index 00000000000..4325f22e3fa --- /dev/null +++ b/buildscripts/resmokelib/testing/hooks/fuzzer_restore_cluster_settings.py @@ -0,0 +1,20 @@ +"""Test hook for resetting the server in a sane state. + +The main use case is to ensure that other hooks that will run against the server will not +encounter unexpected failures. +""" + +import os.path + +from . import jsfile + + +class FuzzerRestoreClusterSettings(jsfile.JSHook): + """Cleans up unwanted changes from fuzzer.""" + + def __init__(self, hook_logger, fixture, shell_options=None): + """Run fuzzer cleanup.""" + description = "Clean up unwanted changes from fuzzer" + js_filename = os.path.join("jstests", "hooks", "run_fuzzer_restore_cluster_settings.js") + jsfile.JSHook.__init__(self, hook_logger, fixture, js_filename, description, + shell_options=shell_options) diff --git a/jstests/hooks/run_fuzzer_restore_cluster_settings.js b/jstests/hooks/run_fuzzer_restore_cluster_settings.js new file mode 100644 index 00000000000..0ffc864b621 --- /dev/null +++ b/jstests/hooks/run_fuzzer_restore_cluster_settings.js @@ -0,0 +1,8 @@ +(function() { +'use strict'; + +// Unsetting read/write settings. This command will also cause the server to refresh and get +// the new settings. +assert.commandWorked( + db.adminCommand({setDefaultRWConcern: 1, defaultReadConcern: {}, defaultWriteConcern: {}})); +})(); |