summaryrefslogtreecommitdiff
path: root/jstests/core
diff options
context:
space:
mode:
authorGregory Wlodarek <gregory.wlodarek@mongodb.com>2021-04-23 01:07:00 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-04-23 02:13:16 +0000
commit7b10322687bab4b0b0bba610b69a4dd5ecb99117 (patch)
tree3f1573afef6ac96aed70f8b1978da433bb38df08 /jstests/core
parenta385b13ad00b6c7d52e174a1e39161dde3930765 (diff)
downloadmongo-7b10322687bab4b0b0bba610b69a4dd5ecb99117.tar.gz
SERVER-16049 Replicate capped collection deletes
Diffstat (limited to 'jstests/core')
-rw-r--r--jstests/core/capped_large_docs.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/jstests/core/capped_large_docs.js b/jstests/core/capped_large_docs.js
new file mode 100644
index 00000000000..d27231ee17b
--- /dev/null
+++ b/jstests/core/capped_large_docs.js
@@ -0,0 +1,33 @@
+/**
+ * Tests inserting large documents into a capped collection.
+ *
+ * TODO SERVER-56262 remove 'requires_non_retryable_writes' tag.
+ *
+ * @tags: [
+ * requires_capped,
+ * requires_collstats,
+ * requires_fastcount,
+ * requires_non_retryable_writes,
+ * requires_fcv_49
+ * ]
+ */
+(function() {
+const coll = db.capped_large_docs;
+coll.drop();
+
+const maxSize = 25 * 1024 * 1024; // 25MB.
+assert.commandWorked(db.createCollection(coll.getName(), {capped: true, size: maxSize}));
+
+// Insert ~50MB of data.
+const doc = {
+ key: "a".repeat(10 * 1024 * 1024)
+};
+for (let i = 0; i < 5; i++) {
+ assert.commandWorked(coll.insert(doc));
+}
+
+// With a capped collection capacity of 25MB, we should have 2 documents.
+const stats = assert.commandWorked(coll.stats());
+assert.eq(2, stats.count);
+assert(stats.size <= maxSize);
+}());