summaryrefslogtreecommitdiff
path: root/jstests/hooks/validate_collections.js
diff options
context:
space:
mode:
authorKyle Suarez <kyle.suarez@mongodb.com>2016-08-24 14:48:20 -0400
committerKyle Suarez <kyle.suarez@mongodb.com>2016-08-24 17:39:00 -0400
commit7486388e02d31c3ef31ffd399d4304843527a12e (patch)
treefa11b7108d8f9f78c267eb318d56bd198bbe0050 /jstests/hooks/validate_collections.js
parent4a19bd94247f4356229f2f3a7b95f76451f41a9b (diff)
downloadmongo-7486388e02d31c3ef31ffd399d4304843527a12e.tar.gz
SERVER-25768 skip hooks in fuzzer suites when invalid views present
Skips the validate and dbhash hooks for jstestfuzz* suites when listCollections fails with an InvalidViewDefinition error.
Diffstat (limited to 'jstests/hooks/validate_collections.js')
-rw-r--r--jstests/hooks/validate_collections.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/jstests/hooks/validate_collections.js b/jstests/hooks/validate_collections.js
index 946a0663894..eac734b4d61 100644
--- a/jstests/hooks/validate_collections.js
+++ b/jstests/hooks/validate_collections.js
@@ -23,7 +23,13 @@ function validateCollections(db, obj) {
// Don't run validate on view namespaces.
let listCollectionsRes = db.runCommand({listCollections: 1, filter: {"type": "collection"}});
+ if (jsTest.options().skipValidationOnInvalidViewDefinitions && listCollectionsRes.ok === 0) {
+ assert.commandFailedWithCode(listCollectionsRes, ErrorCodes.InvalidViewDefinition);
+ print('Skipping validate hook because of invalid views in system.views');
+ return true;
+ }
assert.commandWorked(listCollectionsRes);
+
let collInfo = new DBCommandCursor(db.getMongo(), listCollectionsRes).toArray();
for (var collDocument of collInfo) {