summaryrefslogtreecommitdiff
path: root/jstests/core/capped_convertToCapped1.js
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2014-08-04 12:33:52 -0400
committerEliot Horowitz <eliot@10gen.com>2014-08-05 08:51:41 -0400
commitaddfc302ecf617dfe46e4ce09d629e6bf8367f85 (patch)
tree2bfe6c2196492faf2052d46a2ea07c1ead623824 /jstests/core/capped_convertToCapped1.js
parent5d311d9f0583e3d74ce1aa47c66965cd0b39276f (diff)
downloadmongo-addfc302ecf617dfe46e4ce09d629e6bf8367f85.tar.gz
SERVER-13635: make all capped jstests generic
Diffstat (limited to 'jstests/core/capped_convertToCapped1.js')
-rw-r--r--jstests/core/capped_convertToCapped1.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/jstests/core/capped_convertToCapped1.js b/jstests/core/capped_convertToCapped1.js
new file mode 100644
index 00000000000..4ee9ff2785e
--- /dev/null
+++ b/jstests/core/capped_convertToCapped1.js
@@ -0,0 +1,33 @@
+// test cloneCollectionAsCapped
+
+source = db.capped_convertToCapped1;
+dest = db.capped_convertToCapped1_clone;
+
+source.drop();
+dest.drop();
+
+N = 1000;
+
+for( i = 0; i < N; ++i ) {
+ source.save( {i:i} );
+}
+assert.eq( N, source.count() );
+
+// should all fit
+res = db.runCommand( { cloneCollectionAsCapped:source.getName(),
+ toCollection:dest.getName(),
+ size:100000 } );
+assert.commandWorked( res );
+assert.eq( source.count(), dest.count() );
+assert.eq( N, source.count() ); // didn't delete source
+
+dest.drop();
+// should NOT all fit
+assert.commandWorked( db.runCommand( { cloneCollectionAsCapped:source.getName(),
+ toCollection:dest.getName(),
+ size:1000 } ) );
+
+
+assert.eq( N, source.count() ); // didn't delete source
+assert.gt( source.count(), dest.count() );
+