diff options
author | Mike Dirolf <mike@10gen.com> | 2009-10-06 14:20:49 -0400 |
---|---|---|
committer | Mike Dirolf <mike@10gen.com> | 2009-10-06 15:02:01 -0400 |
commit | 103ae4cb6a110b17909a1cd66de616ec6b0ab56c (patch) | |
tree | f884b2de0a294457f04f113c4f52804391d2964b /jstests/profile1.js | |
parent | 283572bebc03fb6b89a50430c7720377e12f9d5c (diff) | |
download | mongo-103ae4cb6a110b17909a1cd66de616ec6b0ab56c.tar.gz |
minor: add failing test case for profiler when system.profile doesn't exist
also test that dropping system.profile works, but only when profiling is off
Diffstat (limited to 'jstests/profile1.js')
-rw-r--r-- | jstests/profile1.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/jstests/profile1.js b/jstests/profile1.js new file mode 100644 index 00000000000..916b511f71a --- /dev/null +++ b/jstests/profile1.js @@ -0,0 +1,39 @@ + +/* With pre-created system.profile (capped) */ +db.runCommand({profile: 0}); +db.getCollection("system.profile").drop(); +assert(!db.getLastError(), "Z"); +assert.eq(0, db.runCommand({profile: -1}).was, "A"); + +db.createCollection("system.profile", {capped: true, size: 1000}); +db.runCommand({profile: 2}); +assert.eq(2, db.runCommand({profile: -1}).was, "B"); +assert.eq(1, db.system.profile.stats().capped, "C"); +var capped_size = db.system.profile.storageSize(); +assert.gt(capped_size, 999, "D"); +assert.lt(capped_size, 2000, "E"); + +/* Make sure we can't drop if profiling is still on */ +db.getCollection("system.profile").drop(); +assert(db.getLastError(), "Y"); + +/* With pre-created system.profile (un-capped) */ +db.runCommand({profile: 0}); +db.getCollection("system.profile").drop(); +assert.eq(0, db.runCommand({profile: -1}).was, "F"); + +db.createCollection("system.profile"); +db.runCommand({profile: 2}); +assert.eq(2, db.runCommand({profile: -1}).was, "G"); +assert.eq(null, db.system.profile.stats().capped, "G1"); + +/* With no system.profile collection */ +db.runCommand({profile: 0}); +db.getCollection("system.profile").drop(); +assert.eq(0, db.runCommand({profile: -1}).was, "H"); + +db.runCommand({profile: 2}); +assert.eq(2, db.runCommand({profile: -1}).was, "I"); +assert.eq(1, db.system.profile.stats().capped, "J"); +var auto_size = db.system.profile.storageSize(); +assert.gt(auto_size, capped_size, "K"); |