diff options
author | Scott Hernandez <scotthernandez@gmail.com> | 2015-01-05 11:56:27 -0500 |
---|---|---|
committer | Scott Hernandez <scotthernandez@gmail.com> | 2015-01-05 13:59:19 -0500 |
commit | f6abd4665a04ac54df8b0c92302d4a1b2f9579f1 (patch) | |
tree | f9c744a2e48aeb148901d0774fdaa897155c2d21 /jstests | |
parent | e578d9ec131dd3332ae65beb9350b5ab18450194 (diff) | |
download | mongo-f6abd4665a04ac54df8b0c92302d4a1b2f9579f1.tar.gz |
SERVER-16711: no_db_created test
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/core/no_db_created.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/jstests/core/no_db_created.js b/jstests/core/no_db_created.js new file mode 100644 index 00000000000..56b7ee0307f --- /dev/null +++ b/jstests/core/no_db_created.js @@ -0,0 +1,35 @@ +// checks that operations do not create a database + +(function() { + "use strict"; + var adminDB = db.getSiblingDB("admin") + var noDB = function(db) { + var dbName = db.getName(); + var dbsRes = assert.commandWorked(adminDB.runCommand("listDatabases")); + dbsRes.databases.forEach(function(e) { + assert.neq(dbName, + e.name, + "Found db which shouldn't exist:" + dbName + "; " + tojson(dbsRes)); + }) + } + var mydb = db.getSiblingDB("neverCreated") + mydb.dropDatabase(); + noDB(mydb); + + var coll = mydb.fake; + + assert.commandFailed(coll.runCommand("compact")); + noDB(mydb); + assert.writeOK(coll.insert({})); + mydb.dropDatabase(); + + assert.commandFailed(coll.runCommand("dropIndexes")); + noDB(mydb); + assert.writeOK(coll.insert({})); + mydb.dropDatabase(); + + assert.commandFailed(coll.runCommand("collMod", {expireAfterSeconds:1})); + noDB(mydb); + assert.writeOK(coll.insert({})); + mydb.dropDatabase(); +}());
\ No newline at end of file |