diff options
author | Kamran Khan <kamran.khan@mongodb.com> | 2015-12-14 15:13:03 -0500 |
---|---|---|
committer | Kamran Khan <kamran.khan@mongodb.com> | 2015-12-14 15:16:53 -0500 |
commit | ecbc309ccb22b18b96e136e2622b8f560e977bfd (patch) | |
tree | dce06f8f6266b40f525eaa0bfb1983ed222ff2a1 | |
parent | 337faaf74af1deb7aa600f5fe986d15440a09d92 (diff) | |
download | mongo-ecbc309ccb22b18b96e136e2622b8f560e977bfd.tar.gz |
SERVER-21885 Make capped_truncate.js work with resmoke.py --repeat
Previously, the test assumed that a collection would not exist prior
to calling 'create' on it. The collection is now dropped beforehand
to ensure this condition is true.
(cherry picked from commit 30d55cccf89160749c401e19fdc9872e24b01ef2)
-rw-r--r-- | jstests/noPassthroughWithMongod/capped_truncate.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/jstests/noPassthroughWithMongod/capped_truncate.js b/jstests/noPassthroughWithMongod/capped_truncate.js index eb98a77abe2..1c7771ce0bd 100644 --- a/jstests/noPassthroughWithMongod/capped_truncate.js +++ b/jstests/noPassthroughWithMongod/capped_truncate.js @@ -39,10 +39,13 @@ "captrunc didn't return an error for a nonexistent collection"); // It is an error to run the captrunc command on a non-capped collection. - assert.commandWorked(db.runCommand({ create: "noncapped", capped: false })); + var collName = "noncapped"; + db[collName].drop(); + + assert.commandWorked(db.runCommand({ create: collName, capped: false })); for (var j = 1; j <= 10; j++) { - assert.writeOK(db.noncapped.insert({x:j})); + assert.writeOK(db[collName].insert({x:j})); } - assert.commandFailed(db.runCommand({ captrunc: "noncapped", n: 5 }), + assert.commandFailed(db.runCommand({ captrunc: collName, n: 5 }), "captrunc didn't return an error for a non-capped collection"); })(); |