diff options
author | Randolph Tan <randolph@10gen.com> | 2014-03-03 15:04:57 -0500 |
---|---|---|
committer | Randolph Tan <randolph@10gen.com> | 2014-03-03 15:29:00 -0500 |
commit | f8534ae0d6c4e252d169c5bcf42f42cf6518ee7d (patch) | |
tree | e35db08d5d7ea3d70b6925f30bec0881efd2ee83 /jstests/index10.js | |
parent | 6a10de0bb8fe996daca5ecd5687f1072abb0dd8b (diff) | |
download | mongo-f8534ae0d6c4e252d169c5bcf42f42cf6518ee7d.tar.gz |
SERVER-12127 migrate js tests to jscore suite when not related to writes
Temporarily put back jstest in order not to lose test coverage
Diffstat (limited to 'jstests/index10.js')
-rw-r--r-- | jstests/index10.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/jstests/index10.js b/jstests/index10.js new file mode 100644 index 00000000000..92f5927097d --- /dev/null +++ b/jstests/index10.js @@ -0,0 +1,32 @@ +// unique index, drop dups + +t = db.jstests_index10; +t.drop(); + +t.save( {i:1} ); +t.save( {i:2} ); +t.save( {i:1} ); +t.save( {i:3} ); +t.save( {i:1} ); + +t.ensureIndex( {i:1} ); +assert.eq( 5, t.count() ); +t.dropIndexes(); +t.ensureIndex( {i:1}, true ); +err = db.getLastErrorObj(); +assert( err.err , "err.err" ); +assert.eq( 11000, err.code ); +assert( 1 == db.system.indexes.count( {ns:"test.jstests_index10" } ), "only id index" ); +// t.dropIndexes(); + +ts = t.totalIndexSize(); +t.ensureIndex( {i:1}, [ true, true ] ); +ts2 = t.totalIndexSize(); + +assert.eq( ts * 2, ts2, "totalIndexSize fail" ); + +assert.eq( 3, t.count() ); +assert.eq( 1, t.count( {i:1} ) ); + +t.ensureIndex( {j:1}, [ true, true ] ); +assert.eq( 1, t.count() ); |