summaryrefslogtreecommitdiff
path: root/jstests/hooks/validate_collections.js
diff options
context:
space:
mode:
authorDianna Hohensee <dianna.hohensee@mongodb.com>2019-10-21 18:23:49 +0000
committerevergreen <evergreen@mongodb.com>2019-10-21 18:23:49 +0000
commita5887f3a5bd5bcc7398bf2bddc8c537b679e6a58 (patch)
tree02e4cdb7aa3b103841bfc7687b3d2962b286227f /jstests/hooks/validate_collections.js
parentbabc552483a0f8a2fff4c20354089b78da14baeb (diff)
downloadmongo-a5887f3a5bd5bcc7398bf2bddc8c537b679e6a58.tar.gz
SERVER-42358 Add new background collection validation test hook. Runs concurrently with tests.
Diffstat (limited to 'jstests/hooks/validate_collections.js')
-rw-r--r--jstests/hooks/validate_collections.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/jstests/hooks/validate_collections.js b/jstests/hooks/validate_collections.js
index 69085b8a1d6..9f4a9e8fc5f 100644
--- a/jstests/hooks/validate_collections.js
+++ b/jstests/hooks/validate_collections.js
@@ -43,9 +43,11 @@ function CollectionValidator() {
jsTest.options().skipValidationNamespaces.length > 0) {
let skippedCollections = [];
for (let ns of jsTest.options().skipValidationNamespaces) {
- // Strip off the database name from 'ns' to extract the collName.
+ // Attempt to strip the name of the database we are about to validate off of the
+ // namespace we wish to skip. If the replace() function does find a match with the
+ // database, then we know that the collection we want to skip is in the database we
+ // are about to validate. We will then put it in the 'filter' for later use.
const collName = ns.replace(new RegExp('^' + db.getName() + '\.'), '');
- // Skip the collection 'collName' if the db name was removed from 'ns'.
if (collName !== ns) {
skippedCollections.push({name: {$ne: collName}});
}