summaryrefslogtreecommitdiff
path: root/jstests/hooks/run_validate_collections.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/hooks/run_validate_collections.js')
-rw-r--r--jstests/hooks/run_validate_collections.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/jstests/hooks/run_validate_collections.js b/jstests/hooks/run_validate_collections.js
new file mode 100644
index 00000000000..1e910b3e6cf
--- /dev/null
+++ b/jstests/hooks/run_validate_collections.js
@@ -0,0 +1,16 @@
+// Runner for validateCollections that runs full validation on all collections when loaded into
+// the mongo shell.
+'use strict';
+
+(function() {
+ assert.eq(typeof db, 'object', 'Invalid `db` object, is the shell connected to a mongod?');
+ load('jstests/hooks/validate_collections.js'); // For validateCollections
+
+ var dbNames = db.getMongo().getDBNames();
+
+ for (var dbName of dbNames) {
+ if (!validateCollections(db.getSiblingDB(dbName), {full: true})) {
+ throw new Error('Collection validation failed');
+ }
+ }
+})(); \ No newline at end of file