summaryrefslogtreecommitdiff
path: root/jstests/hooks/run_validate_collections.js
diff options
context:
space:
mode:
authorRobert Guo <robert.guo@10gen.com>2016-03-22 13:20:14 -0400
committerRobert Guo <robert.guo@10gen.com>2016-05-18 13:47:18 -0400
commitf2f6163b0b26f1b18951c3d4d0f88a833c344523 (patch)
tree6d5a4b8b8d9bcfdec12f5b34ce2afd0bede5b5bb /jstests/hooks/run_validate_collections.js
parent756d6ee26bcc3e219892475868ca145564559205 (diff)
downloadmongo-f2f6163b0b26f1b18951c3d4d0f88a833c344523.tar.gz
SERVER-22860 allow resmoke.py to run JS hooks
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