diff options
author | Eliot Horowitz <eliot@10gen.com> | 2014-08-04 12:33:52 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2014-08-05 08:51:41 -0400 |
commit | addfc302ecf617dfe46e4ce09d629e6bf8367f85 (patch) | |
tree | 2bfe6c2196492faf2052d46a2ea07c1ead623824 /jstests | |
parent | 5d311d9f0583e3d74ce1aa47c66965cd0b39276f (diff) | |
download | mongo-addfc302ecf617dfe46e4ce09d629e6bf8367f85.tar.gz |
SERVER-13635: make all capped jstests generic
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/core/capped.js | 3 | ||||
-rw-r--r-- | jstests/core/capped8.js | 2 | ||||
-rw-r--r-- | jstests/core/capped_convertToCapped1.js | 33 | ||||
-rw-r--r-- | jstests/mmap_v1/capped2.js (renamed from jstests/core/capped2.js) | 0 | ||||
-rw-r--r-- | jstests/mmap_v1/capped3.js (renamed from jstests/core/capped3.js) | 0 | ||||
-rw-r--r-- | jstests/mmap_v1/capped7.js (renamed from jstests/core/capped7.js) | 0 |
6 files changed, 36 insertions, 2 deletions
diff --git a/jstests/core/capped.js b/jstests/core/capped.js index 421132b6f75..72eddb8de2f 100644 --- a/jstests/core/capped.js +++ b/jstests/core/capped.js @@ -1,8 +1,9 @@ db.jstests_capped.drop(); db.createCollection("jstests_capped", {capped:true, size:30000}); -assert.eq( 1, db.system.indexes.find( {ns:"test.jstests_capped"} ).count(), "expected a count of one index for new capped collection" ); t = db.jstests_capped; +assert.eq( 1, t.getIndexes().length, "expected a count of one index for new capped collection" ); + t.save({x:1}); t.save({x:2}); diff --git a/jstests/core/capped8.js b/jstests/core/capped8.js index 0f30e37aebf..9eaa4aedd10 100644 --- a/jstests/core/capped8.js +++ b/jstests/core/capped8.js @@ -54,7 +54,7 @@ function insertAndTruncate( first ) { insertManyRollingOver( 150 ); myFiftyCount = t.count(); // Insert documents that are too big to fit in the smaller extents. - insertManyRollingOver( 5000 ); + insertManyRollingOver( 3000 ); myTwokCount = t.count(); if ( first ) { initialCount = myInitialCount; 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() ); + diff --git a/jstests/core/capped2.js b/jstests/mmap_v1/capped2.js index 65bb82f4c07..65bb82f4c07 100644 --- a/jstests/core/capped2.js +++ b/jstests/mmap_v1/capped2.js diff --git a/jstests/core/capped3.js b/jstests/mmap_v1/capped3.js index 2e5e6790cb7..2e5e6790cb7 100644 --- a/jstests/core/capped3.js +++ b/jstests/mmap_v1/capped3.js diff --git a/jstests/core/capped7.js b/jstests/mmap_v1/capped7.js index 0405cefa5a0..0405cefa5a0 100644 --- a/jstests/core/capped7.js +++ b/jstests/mmap_v1/capped7.js |