summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuhong Zhang <yuhong.zhang@mongodb.com>2022-11-10 22:45:17 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-11-11 00:20:48 +0000
commit2ef0ee31539036523136230b93c8e7cbf62a0ddd (patch)
tree34664f66308cb62737ce73a8bdbda3eb9084a3af
parentebd7d857178f5585149a1a8d300aa3a5e10206a7 (diff)
downloadmongo-2ef0ee31539036523136230b93c8e7cbf62a0ddd.tar.gz
SERVER-71226 Skip collections with explicitly set conflicting validators in the background validation hook
-rw-r--r--jstests/core/views/invalid_system_views.js3
-rw-r--r--jstests/hooks/run_validate_collections_background.js25
2 files changed, 27 insertions, 1 deletions
diff --git a/jstests/core/views/invalid_system_views.js b/jstests/core/views/invalid_system_views.js
index d4151e34513..3585f510850 100644
--- a/jstests/core/views/invalid_system_views.js
+++ b/jstests/core/views/invalid_system_views.js
@@ -113,7 +113,8 @@ function runTest(badViewDefinition) {
}
assert.commandWorked(
- viewsDB.runCommand({collMod: "collection", validator: {x: {$type: "string"}}}),
+ viewsDB.runCommand(
+ {collMod: "collection", validator: {x: {$type: "string"}}, validationAction: "warn"}),
makeErrorMessage("collMod"));
const renameCommand = {
diff --git a/jstests/hooks/run_validate_collections_background.js b/jstests/hooks/run_validate_collections_background.js
index fc5b928d8aa..66dda29c6d9 100644
--- a/jstests/hooks/run_validate_collections_background.js
+++ b/jstests/hooks/run_validate_collections_background.js
@@ -45,6 +45,28 @@ const isIgnorableError = function ignorableError(codeName) {
*/
const validateCollectionsBackgroundThread = function validateCollectionsBackground(
host, isIgnorableErrorFunc) {
+ // Some tests explicitly mess with schema validation. We will skip running background validation
+ // on those collections.
+ const skippedCollections = new Set([
+ "collectionWithValidator",
+ "jstests_schema_encrypt",
+ "json_schema_additional_items",
+ "schema_allowed_properties",
+ "jstests_schema_bsontype",
+ "jstests_schema_dependencies",
+ "jstests_schema_encrypt",
+ "json_schema_items",
+ "jstests_json_schema",
+ "jstests_json_schema_logical",
+ "json_schema_min_max_items",
+ "jstests_schema_min_max_properties",
+ "schema_pattern_properties",
+ "jstests_schema_required",
+ "json_schema_unique_items",
+ "json_schema_test_corpus",
+ "jstests_json_schema_ignore_unsupported",
+ ]);
+
// Calls 'func' with the print() function overridden to be a no-op.
const quietly = (func) => {
const printOriginal = print;
@@ -106,6 +128,9 @@ const validateCollectionsBackgroundThread = function validateCollectionsBackgrou
});
for (let collectionName of collectionNames) {
+ if (dbName == "bypass_document_validation" || skippedCollections.has(collectionName)) {
+ continue;
+ }
let res = conn.getDB(dbName).getCollection(collectionName).runCommand({
"validate": collectionName,
background: true,