diff options
author | Geert Bosch <geert@mongodb.com> | 2017-04-10 11:32:49 -0400 |
---|---|---|
committer | Geert Bosch <geert@mongodb.com> | 2017-04-11 17:42:02 -0400 |
commit | fba4777564145f7f673a23659d06c9eb75fdb54e (patch) | |
tree | 56af4a32e96d527d1efc706599e03e7dcad6866c | |
parent | e0d69be0ed9628034b70aacdc24fb843e640a10d (diff) | |
download | mongo-fba4777564145f7f673a23659d06c9eb75fdb54e.tar.gz |
SERVER-28645 Add unit test and integration test tweaks
(cherry picked from commit 305db93cc0b8d167534b761f6920590c9ffa266f)
-rw-r--r-- | jstests/core/apply_ops_atomicity.js | 6 | ||||
-rw-r--r-- | src/mongo/db/concurrency/fast_map_noalloc_test.cpp | 12 |
2 files changed, 15 insertions, 3 deletions
diff --git a/jstests/core/apply_ops_atomicity.js b/jstests/core/apply_ops_atomicity.js index afc131959b9..911ce32a311 100644 --- a/jstests/core/apply_ops_atomicity.js +++ b/jstests/core/apply_ops_atomicity.js @@ -43,12 +43,12 @@ for (let i = 0; i < n; i++) { // Write to a capped collection, as that may require a lock for serialization. let cappedName = "capped" + n + "-" + i; - newDB.createCollection(cappedName, {capped: true, size: 100}); + assert.commandWorked(newDB.createCollection(cappedName, {capped: true, size: 100})); cappedOps.push({op: 'i', ns: newDBName + "." + cappedName, o: {_id: 0}}); // Make an index multi-key, as that may require a lock for updating the catalog. - let multiName = "multi" + +n + "-" + i; - newDB[multiName].createIndex({x: 1}); + let multiName = "multi" + n + "-" + i; + assert.commandWorked(newDB[multiName].createIndex({x: 1})); multiOps.push({op: 'i', ns: newDBName + "." + multiName, o: {_id: 0, x: [0, 1]}}); } diff --git a/src/mongo/db/concurrency/fast_map_noalloc_test.cpp b/src/mongo/db/concurrency/fast_map_noalloc_test.cpp index e9a013427df..18efc4b0595 100644 --- a/src/mongo/db/concurrency/fast_map_noalloc_test.cpp +++ b/src/mongo/db/concurrency/fast_map_noalloc_test.cpp @@ -84,6 +84,18 @@ TEST(FastMapNoAlloc, NotEmpty) { ASSERT(!it); } +TEST(FastMapNoAlloc, ExceedCapacity) { + TestFastMapNoAlloc map; + + for (int i = 0; i < 6; i++) { + map.insert(ResourceId(RESOURCE_COLLECTION, i)) + ->initNew(i, "Item" + boost::lexical_cast<std::string>(i)); + } + + ASSERT_THROWS_CODE( + map.insert(ResourceId(RESOURCE_COLLECTION, 6)), UserException, ErrorCodes::TooManyLocks); +} + TEST(FastMapNoAlloc, FindNonExisting) { TestFastMapNoAlloc map; |