diff options
author | William Schultz <william.schultz@mongodb.com> | 2018-11-14 15:14:02 -0500 |
---|---|---|
committer | William Schultz <william.schultz@mongodb.com> | 2018-11-14 15:16:48 -0500 |
commit | dd2b355042d8f64e2a10d7b9986265ba563dddd8 (patch) | |
tree | a82a97fda1162a388bca5326da82b07742762d13 | |
parent | 2f0271a86b127a95cd04d878673d9c097de7a975 (diff) | |
download | mongo-dd2b355042d8f64e2a10d7b9986265ba563dddd8.tar.gz |
SERVER-37935 Remove read concern 'majority' overrides from all change streams test suites
14 files changed, 43 insertions, 53 deletions
diff --git a/buildscripts/resmokeconfig/suites/change_streams.yml b/buildscripts/resmokeconfig/suites/change_streams.yml index c066c811d49..2a409696df5 100644 --- a/buildscripts/resmokeconfig/suites/change_streams.yml +++ b/buildscripts/resmokeconfig/suites/change_streams.yml @@ -5,13 +5,11 @@ selector: - jstests/change_streams/**/*.js exclude_with_any_tags: ## - # The next three tags correspond to the special errors thrown by the + # The next tags correspond to the special errors thrown by the # set_read_and_write_concerns.js override when it refuses to replace the readConcern or # writeConcern of a particular command. Above each tag are the message(s) that cause the tag to be # warranted. ## - # "Cowardly refusing to override read concern of command: ..." - - assumes_read_concern_unchanged # "Cowardly refusing to override write concern of command: ..." - assumes_write_concern_unchanged @@ -25,7 +23,7 @@ executor: shell_options: global_vars: TestData: - defaultReadConcernLevel: majority + defaultReadConcernLevel: null enableMajorityReadConcern: '' eval: "var testingReplication = true; load('jstests/libs/override_methods/set_read_and_write_concerns.js');" readMode: commands diff --git a/buildscripts/resmokeconfig/suites/change_streams_mongos_passthrough.yml b/buildscripts/resmokeconfig/suites/change_streams_mongos_passthrough.yml index 742ff569647..40b8f972df9 100644 --- a/buildscripts/resmokeconfig/suites/change_streams_mongos_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/change_streams_mongos_passthrough.yml @@ -9,13 +9,11 @@ selector: - jstests/change_streams/report_latest_observed_oplog_timestamp.js exclude_with_any_tags: ## - # The next three tags correspond to the special errors thrown by the + # The next tags correspond to the special errors thrown by the # set_read_and_write_concerns.js override when it refuses to replace the readConcern or # writeConcern of a particular command. Above each tag are the message(s) that cause the tag to be # warranted. ## - # "Cowardly refusing to override read concern of command: ..." - - assumes_read_concern_unchanged # "Cowardly refusing to override write concern of command: ..." - assumes_write_concern_unchanged # Transactions not supported on sharded clusters. @@ -30,7 +28,7 @@ executor: shell_options: global_vars: TestData: - defaultReadConcernLevel: majority + defaultReadConcernLevel: null enableMajorityReadConcern: '' eval: "var testingReplication = true; load('jstests/libs/override_methods/set_read_and_write_concerns.js');" readMode: commands diff --git a/buildscripts/resmokeconfig/suites/change_streams_mongos_sessions_passthrough.yml b/buildscripts/resmokeconfig/suites/change_streams_mongos_sessions_passthrough.yml index 78d8804b2a6..a6b968ee5aa 100644 --- a/buildscripts/resmokeconfig/suites/change_streams_mongos_sessions_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/change_streams_mongos_sessions_passthrough.yml @@ -9,13 +9,11 @@ selector: - jstests/change_streams/report_latest_observed_oplog_timestamp.js exclude_with_any_tags: ## - # The next three tags correspond to the special errors thrown by the + # The next tags correspond to the special errors thrown by the # set_read_and_write_concerns.js override when it refuses to replace the readConcern or # writeConcern of a particular command. Above each tag are the message(s) that cause the tag to be # warranted. ## - # "Cowardly refusing to override read concern of command: ..." - - assumes_read_concern_unchanged # "Cowardly refusing to override write concern of command: ..." - assumes_write_concern_unchanged # Transactions not supported on sharded clusters. @@ -30,7 +28,7 @@ executor: shell_options: global_vars: TestData: - defaultReadConcernLevel: majority + defaultReadConcernLevel: null enableMajorityReadConcern: '' eval: >- var testingReplication = true; diff --git a/buildscripts/resmokeconfig/suites/change_streams_secondary_reads.yml b/buildscripts/resmokeconfig/suites/change_streams_secondary_reads.yml index 741cb9941a3..b8854217199 100644 --- a/buildscripts/resmokeconfig/suites/change_streams_secondary_reads.yml +++ b/buildscripts/resmokeconfig/suites/change_streams_secondary_reads.yml @@ -11,13 +11,11 @@ selector: - jstests/change_streams/report_latest_observed_oplog_timestamp.js exclude_with_any_tags: ## - # The next three tags correspond to the special errors thrown by the + # The next tags correspond to the special errors thrown by the # set_read_and_write_concerns.js override when it refuses to replace the readConcern or # writeConcern of a particular command. Above each tag are the message(s) that cause the tag to be # warranted. ## - # "Cowardly refusing to override read concern of command: ..." - - assumes_read_concern_unchanged # "Cowardly refusing to override write concern of command: ..." - assumes_write_concern_unchanged ## @@ -41,7 +39,7 @@ executor: shell_options: global_vars: TestData: - defaultReadConcernLevel: majority + defaultReadConcernLevel: null eval: >- var testingReplication = true; load('jstests/libs/override_methods/set_read_and_write_concerns.js'); diff --git a/buildscripts/resmokeconfig/suites/change_streams_sharded_collections_passthrough.yml b/buildscripts/resmokeconfig/suites/change_streams_sharded_collections_passthrough.yml index 23c0fe537ee..76a1b7e5850 100644 --- a/buildscripts/resmokeconfig/suites/change_streams_sharded_collections_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/change_streams_sharded_collections_passthrough.yml @@ -8,13 +8,11 @@ selector: - jstests/change_streams/report_latest_observed_oplog_timestamp.js exclude_with_any_tags: ## - # The next three tags correspond to the special errors thrown by the + # The next tags correspond to the special errors thrown by the # set_read_and_write_concerns.js override when it refuses to replace the readConcern or # writeConcern of a particular command. Above each tag are the message(s) that cause the tag to be # warranted. ## - # "Cowardly refusing to override read concern of command: ..." - - assumes_read_concern_unchanged # "Cowardly refusing to override write concern of command: ..." - assumes_write_concern_unchanged # Transactions not supported on sharded clusters. @@ -29,7 +27,7 @@ executor: shell_options: global_vars: TestData: - defaultReadConcernLevel: majority + defaultReadConcernLevel: null enableMajorityReadConcern: '' eval: >- var testingReplication = true; diff --git a/buildscripts/resmokeconfig/suites/change_streams_whole_cluster_mongos_passthrough.yml b/buildscripts/resmokeconfig/suites/change_streams_whole_cluster_mongos_passthrough.yml index 61563e20081..53a55cd91f1 100644 --- a/buildscripts/resmokeconfig/suites/change_streams_whole_cluster_mongos_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/change_streams_whole_cluster_mongos_passthrough.yml @@ -9,13 +9,11 @@ selector: - jstests/change_streams/report_latest_observed_oplog_timestamp.js exclude_with_any_tags: ## - # The next three tags correspond to the special errors thrown by the + # The next tags correspond to the special errors thrown by the # set_read_and_write_concerns.js override when it refuses to replace the readConcern or # writeConcern of a particular command. Above each tag are the message(s) that cause the tag to be # warranted. ## - # "Cowardly refusing to override read concern of command: ..." - - assumes_read_concern_unchanged # "Cowardly refusing to override write concern of command: ..." - assumes_write_concern_unchanged # Transactions not supported on sharded clusters. @@ -32,7 +30,7 @@ executor: shell_options: global_vars: TestData: - defaultReadConcernLevel: majority + defaultReadConcernLevel: null enableMajorityReadConcern: '' eval: >- var testingReplication = true; diff --git a/buildscripts/resmokeconfig/suites/change_streams_whole_cluster_passthrough.yml b/buildscripts/resmokeconfig/suites/change_streams_whole_cluster_passthrough.yml index fe558dcc627..34c0869c3f8 100644 --- a/buildscripts/resmokeconfig/suites/change_streams_whole_cluster_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/change_streams_whole_cluster_passthrough.yml @@ -5,13 +5,11 @@ selector: - jstests/change_streams/**/*.js exclude_with_any_tags: ## - # The next three tags correspond to the special errors thrown by the + # The next tags correspond to the special errors thrown by the # set_read_and_write_concerns.js override when it refuses to replace the readConcern or # writeConcern of a particular command. Above each tag are the message(s) that cause the tag to be # warranted. ## - # "Cowardly refusing to override read concern of command: ..." - - assumes_read_concern_unchanged # "Cowardly refusing to override write concern of command: ..." - assumes_write_concern_unchanged # Not relevant for whole-cluster change streams. @@ -27,7 +25,7 @@ executor: shell_options: global_vars: TestData: - defaultReadConcernLevel: majority + defaultReadConcernLevel: null enableMajorityReadConcern: '' eval: >- var testingReplication = true; diff --git a/buildscripts/resmokeconfig/suites/change_streams_whole_cluster_secondary_reads_passthrough.yml b/buildscripts/resmokeconfig/suites/change_streams_whole_cluster_secondary_reads_passthrough.yml index 05c21082896..1ba24f910b5 100644 --- a/buildscripts/resmokeconfig/suites/change_streams_whole_cluster_secondary_reads_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/change_streams_whole_cluster_secondary_reads_passthrough.yml @@ -11,13 +11,11 @@ selector: - jstests/change_streams/report_latest_observed_oplog_timestamp.js exclude_with_any_tags: ## - # The next three tags correspond to the special errors thrown by the + # The next tags correspond to the special errors thrown by the # set_read_and_write_concerns.js override when it refuses to replace the readConcern or # writeConcern of a particular command. Above each tag are the message(s) that cause the tag to be # warranted. ## - # "Cowardly refusing to override read concern of command: ..." - - assumes_read_concern_unchanged # "Cowardly refusing to override write concern of command: ..." - assumes_write_concern_unchanged ## @@ -43,7 +41,7 @@ executor: shell_options: global_vars: TestData: - defaultReadConcernLevel: majority + defaultReadConcernLevel: null eval: >- var testingReplication = true; load('jstests/libs/override_methods/set_read_and_write_concerns.js'); diff --git a/buildscripts/resmokeconfig/suites/change_streams_whole_cluster_sharded_collections_passthrough.yml b/buildscripts/resmokeconfig/suites/change_streams_whole_cluster_sharded_collections_passthrough.yml index dfdfeaf16bd..44a3a14759a 100644 --- a/buildscripts/resmokeconfig/suites/change_streams_whole_cluster_sharded_collections_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/change_streams_whole_cluster_sharded_collections_passthrough.yml @@ -8,13 +8,11 @@ selector: - jstests/change_streams/report_latest_observed_oplog_timestamp.js exclude_with_any_tags: ## - # The next three tags correspond to the special errors thrown by the + # The next tags correspond to the special errors thrown by the # set_read_and_write_concerns.js override when it refuses to replace the readConcern or # writeConcern of a particular command. Above each tag are the message(s) that cause the tag to be # warranted. ## - # "Cowardly refusing to override read concern of command: ..." - - assumes_read_concern_unchanged # "Cowardly refusing to override write concern of command: ..." - assumes_write_concern_unchanged # Transactions not supported on sharded clusters. @@ -31,7 +29,7 @@ executor: shell_options: global_vars: TestData: - defaultReadConcernLevel: majority + defaultReadConcernLevel: null enableMajorityReadConcern: '' eval: >- var testingReplication = true; diff --git a/buildscripts/resmokeconfig/suites/change_streams_whole_db_mongos_passthrough.yml b/buildscripts/resmokeconfig/suites/change_streams_whole_db_mongos_passthrough.yml index fb777e33aa8..070b892dc0b 100644 --- a/buildscripts/resmokeconfig/suites/change_streams_whole_db_mongos_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/change_streams_whole_db_mongos_passthrough.yml @@ -15,13 +15,11 @@ selector: - jstests/change_streams/metadata_notifications.js exclude_with_any_tags: ## - # The next three tags correspond to the special errors thrown by the + # The next tags correspond to the special errors thrown by the # set_read_and_write_concerns.js override when it refuses to replace the readConcern or # writeConcern of a particular command. Above each tag are the message(s) that cause the tag to be # warranted. ## - # "Cowardly refusing to override read concern of command: ..." - - assumes_read_concern_unchanged # "Cowardly refusing to override write concern of command: ..." - assumes_write_concern_unchanged # Transactions not supported on sharded clusters. @@ -36,7 +34,7 @@ executor: shell_options: global_vars: TestData: - defaultReadConcernLevel: majority + defaultReadConcernLevel: null enableMajorityReadConcern: '' eval: >- var testingReplication = true; diff --git a/buildscripts/resmokeconfig/suites/change_streams_whole_db_passthrough.yml b/buildscripts/resmokeconfig/suites/change_streams_whole_db_passthrough.yml index 3cd4cd39df7..ce186dfe9ef 100644 --- a/buildscripts/resmokeconfig/suites/change_streams_whole_db_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/change_streams_whole_db_passthrough.yml @@ -8,13 +8,11 @@ selector: - jstests/change_streams/metadata_notifications.js exclude_with_any_tags: ## - # The next three tags correspond to the special errors thrown by the + # The next tags correspond to the special errors thrown by the # set_read_and_write_concerns.js override when it refuses to replace the readConcern or # writeConcern of a particular command. Above each tag are the message(s) that cause the tag to be # warranted. ## - # "Cowardly refusing to override read concern of command: ..." - - assumes_read_concern_unchanged # "Cowardly refusing to override write concern of command: ..." - assumes_write_concern_unchanged @@ -28,7 +26,7 @@ executor: shell_options: global_vars: TestData: - defaultReadConcernLevel: majority + defaultReadConcernLevel: null enableMajorityReadConcern: '' eval: >- var testingReplication = true; diff --git a/buildscripts/resmokeconfig/suites/change_streams_whole_db_secondary_reads_passthrough.yml b/buildscripts/resmokeconfig/suites/change_streams_whole_db_secondary_reads_passthrough.yml index b6dce87e1a7..9f95d36c6f7 100644 --- a/buildscripts/resmokeconfig/suites/change_streams_whole_db_secondary_reads_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/change_streams_whole_db_secondary_reads_passthrough.yml @@ -14,13 +14,11 @@ selector: exclude_with_any_tags: ## - # The next three tags correspond to the special errors thrown by the + # The next tags correspond to the special errors thrown by the # set_read_and_write_concerns.js override when it refuses to replace the readConcern or # writeConcern of a particular command. Above each tag are the message(s) that cause the tag to be # warranted. ## - # "Cowardly refusing to override read concern of command: ..." - - assumes_read_concern_unchanged # "Cowardly refusing to override write concern of command: ..." - assumes_write_concern_unchanged ## @@ -44,7 +42,7 @@ executor: shell_options: global_vars: TestData: - defaultReadConcernLevel: majority + defaultReadConcernLevel: null eval: >- var testingReplication = true; load('jstests/libs/override_methods/set_read_and_write_concerns.js'); diff --git a/buildscripts/resmokeconfig/suites/change_streams_whole_db_sharded_collections_passthrough.yml b/buildscripts/resmokeconfig/suites/change_streams_whole_db_sharded_collections_passthrough.yml index ddf8b1798ec..2aa5cba08a7 100644 --- a/buildscripts/resmokeconfig/suites/change_streams_whole_db_sharded_collections_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/change_streams_whole_db_sharded_collections_passthrough.yml @@ -10,13 +10,11 @@ selector: - jstests/change_streams/metadata_notifications.js exclude_with_any_tags: ## - # The next three tags correspond to the special errors thrown by the + # The next tags correspond to the special errors thrown by the # set_read_and_write_concerns.js override when it refuses to replace the readConcern or # writeConcern of a particular command. Above each tag are the message(s) that cause the tag to be # warranted. ## - # "Cowardly refusing to override read concern of command: ..." - - assumes_read_concern_unchanged # "Cowardly refusing to override write concern of command: ..." - assumes_write_concern_unchanged # Transactions not supported on sharded clusters. @@ -31,7 +29,7 @@ executor: shell_options: global_vars: TestData: - defaultReadConcernLevel: majority + defaultReadConcernLevel: null enableMajorityReadConcern: '' eval: >- var testingReplication = true; diff --git a/jstests/libs/override_methods/set_read_and_write_concerns.js b/jstests/libs/override_methods/set_read_and_write_concerns.js index cd043451316..2fbdcc16e59 100644 --- a/jstests/libs/override_methods/set_read_and_write_concerns.js +++ b/jstests/libs/override_methods/set_read_and_write_concerns.js @@ -1,5 +1,18 @@ /** * Use prototype overrides to set read concern and write concern while running tests. + * + * A test can override the default read and write concern of commands by loading this library before + * the test is run and setting the 'TestData.defaultReadConcernLevel' or + * 'TestData.defaultWriteConcern' variables with the desired read/write concern level. For example, + * setting: + * + * TestData.defaultReadConcernLevel = "majority" + * TestData.writeConcernLevel = {w: "majority"} + * + * will run all commands with read/write concern "majority". It is also possible to only override + * the write concern of commands, by setting 'TestData.defaultReadConcernLevel' = null. This will + * not affect the default read concern of commands in any way. + * */ (function() { "use strict"; @@ -12,6 +25,8 @@ " property on the global TestData object"); } + // If the default read concern level is null, that indicates that no read concern overrides + // should be applied. const kDefaultReadConcern = {level: TestData.defaultReadConcernLevel}; const kDefaultWriteConcern = (TestData.hasOwnProperty("defaultWriteConcern")) ? TestData.defaultWriteConcern : { @@ -164,7 +179,8 @@ const inWrappedForm = commandObj !== commandObjUnwrapped; - if (shouldForceReadConcern) { + // Only override read concern if an override level was specified. + if (shouldForceReadConcern && (kDefaultReadConcern.level !== null)) { // We create a copy of 'commandObj' to avoid mutating the parameter the caller // specified. commandObj = Object.assign({}, commandObj); |