diff options
author | Siyuan Zhou <siyuan.zhou@mongodb.com> | 2014-03-27 23:41:24 -0400 |
---|---|---|
committer | Siyuan Zhou <siyuan.zhou@mongodb.com> | 2014-03-27 23:41:24 -0400 |
commit | b47447b17e4b9b04d06b663c0c9e81dcd949c530 (patch) | |
tree | a8e17bc34ba8ba303d8bb189d27fc4f3643618ae /jstests/gle/core | |
parent | 113d4a9e3d22f6d81e29252ea8170d5f48ad3c5d (diff) | |
download | mongo-b47447b17e4b9b04d06b663c0c9e81dcd949c530.tar.gz |
Revert "SERVER-13386 Move tests with getPrevError to gle test suite."
This reverts commit 2850ecc726d6ef33ff4284e1ce0378fb42d3b854.
getPrevError is not supported for sharded environments.
Diffstat (limited to 'jstests/gle/core')
-rw-r--r-- | jstests/gle/core/remove5.js | 24 | ||||
-rw-r--r-- | jstests/gle/core/unique2.js | 112 | ||||
-rw-r--r-- | jstests/gle/core/update4.js | 33 |
3 files changed, 0 insertions, 169 deletions
diff --git a/jstests/gle/core/remove5.js b/jstests/gle/core/remove5.js deleted file mode 100644 index be4f0b49ec1..00000000000 --- a/jstests/gle/core/remove5.js +++ /dev/null @@ -1,24 +0,0 @@ -f = db.jstests_remove5; -f.drop(); - -getLastError = function() { - return db.runCommand( { getlasterror : 1 } ); -} - -f.remove( {} ); -assert.eq( 0, getLastError().n ); -f.save( {a:1} ); -f.remove( {} ); -assert.eq( 1, getLastError().n ); -for( i = 0; i < 10; ++i ) { - f.save( {i:i} ); -} -f.remove( {} ); -assert.eq( 10, getLastError().n ); -assert.eq( 10, db.getPrevError().n ); -assert.eq( 1, db.getPrevError().nPrev ); - -f.findOne(); -assert.eq( 0, getLastError().n ); -assert.eq( 10, db.getPrevError().n ); -assert.eq( 2, db.getPrevError().nPrev ); diff --git a/jstests/gle/core/unique2.js b/jstests/gle/core/unique2.js deleted file mode 100644 index 0d3993630c3..00000000000 --- a/jstests/gle/core/unique2.js +++ /dev/null @@ -1,112 +0,0 @@ -// Test unique and dropDups index options. - -function checkNprev( np ) { - // getPrevError() is not available sharded. - if ( typeof( myShardingTest ) == 'undefined' ) { - assert.eq( np, db.getPrevError().nPrev ); - } -} - -t = db.jstests_unique2; - -t.drop(); - -/* test for good behavior when indexing multikeys */ - -t.insert({k:3}); -t.insert({k:[2,3]}); -t.insert({k:[4,3]}); -t.insert({k:[4,3]}); // tests SERVER-4770 - -t.ensureIndex({k:1}, {unique:true, dropDups:true}); - -assert( t.count() == 1 ) ; -assert( t.find().sort({k:1}).toArray().length == 1 ) ; -assert( t.find().sort({k:1}).count() == 1 ) ; - -t.drop(); - -/* same test wtih background:true*/ - -t.insert({k:3}); -t.insert({k:[2,3]}); -t.insert({k:[4,3]}); -t.insert({k:[4,3]}); - -t.ensureIndex({k:1}, {unique:true, dropDups:true, background:true}); - -assert( t.count() == 1 ) ; -assert( t.find().sort({k:1}).toArray().length == 1 ) ; -assert( t.find().sort({k:1}).count() == 1 ) ; - -t.drop(); - -/* */ - -t.ensureIndex({k:1}, {unique:true}); - -t.insert({k:3}); -t.insert({k:[2,3]}); -assert( db.getLastError() ); -t.insert({k:[4,3]}); -assert( db.getLastError() ); - -assert( t.count() == 1 ) ; -assert( t.find().sort({k:1}).toArray().length == 1 ) ; -assert( t.find().sort({k:1}).count() == 1 ) ; - -t.dropIndexes(); - -t.insert({k:[2,3]}); -t.insert({k:[4,3]}); -assert( t.count() == 3 ) ; - -// Trigger an error, so we can test n of getPrevError() later. -t.update({ x : 1 }, { $invalid : true }); -assert.neq(null, db.getLastError()); -checkNprev( 1 ); - -t.ensureIndex({k:1}, {unique:true, dropDups:true}); -// Check error flag was not set SERVER-2054. -assert.eq(null, db.getLastError() ); -// Check that offset of previous error is correct. -checkNprev( 2 ); - -// Check the dups were dropped. -assert( t.count() == 1 ) ; -assert( t.find().sort({k:1}).toArray().length == 1 ) ; -assert( t.find().sort({k:1}).count() == 1 ) ; - -// Check that a new conflicting insert will cause an error. -t.insert({k:[2,3]}); -assert( db.getLastError() ); - -t.drop(); - -t.insert({k:3}); -t.insert({k:[2,3]}); -t.insert({k:[4,3]}); -assert( t.count() == 3 ) ; - - -// Now try with a background index op. - -// Trigger an error, so we can test n of getPrevError() later. -t.update({ x : 1 }, { $invalid : true }); -assert( db.getLastError() ); -checkNprev( 1 ); - -t.ensureIndex({k:1}, {background:true, unique:true, dropDups:true}); -// Check error flag was not set SERVER-2054. -assert( !db.getLastError() ); -// Check that offset of pervious error is correct. -checkNprev( 2 ); - -// Check the dups were dropped. -assert( t.count() == 1 ) ; -assert( t.find().sort({k:1}).toArray().length == 1 ) ; -assert( t.find().sort({k:1}).count() == 1 ) ; - -// Check that a new conflicting insert will cause an error. -t.insert({k:[2,3]}); -assert( db.getLastError() ); diff --git a/jstests/gle/core/update4.js b/jstests/gle/core/update4.js deleted file mode 100644 index 1502f672a50..00000000000 --- a/jstests/gle/core/update4.js +++ /dev/null @@ -1,33 +0,0 @@ -f = db.jstests_update4; -f.drop(); - -getLastError = function() { - ret = db.runCommand( { getlasterror : 1 } ); -// printjson( ret ); - return ret; -} - -f.save( {a:1} ); -f.update( {a:1}, {a:2} ); -assert.eq( true, getLastError().updatedExisting , "A" ); -assert.eq( 1, getLastError().n , "B" ); -f.update( {a:1}, {a:2} ); -assert.eq( false, getLastError().updatedExisting , "C" ); -assert.eq( 0, getLastError().n , "D" ); - -f.update( {a:1}, {a:1}, true ); -assert.eq( false, getLastError().updatedExisting , "E" ); -assert.eq( 1, getLastError().n , "F" ); -f.update( {a:1}, {a:1}, true ); -assert.eq( true, getLastError().updatedExisting , "G" ); -assert.eq( 1, getLastError().n , "H" ); -assert.eq( true, db.getPrevError().updatedExisting , "I" ); -assert.eq( 1, db.getPrevError().nPrev , "J" ); - -f.findOne(); -assert.eq( undefined, getLastError().updatedExisting , "K" ); -assert.eq( true, db.getPrevError().updatedExisting , "L" ); -assert.eq( 2, db.getPrevError().nPrev , "M" ); - -db.forceError(); -assert.eq( undefined, getLastError().updatedExisting , "N" ); |