summaryrefslogtreecommitdiff
path: root/jstests/repl/drop_dups.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/repl/drop_dups.js')
-rw-r--r--jstests/repl/drop_dups.js24
1 files changed, 14 insertions, 10 deletions
diff --git a/jstests/repl/drop_dups.js b/jstests/repl/drop_dups.js
index bd3d2820108..1b151cfb71f 100644
--- a/jstests/repl/drop_dups.js
+++ b/jstests/repl/drop_dups.js
@@ -4,7 +4,9 @@ var rt = new ReplTest( "drop_dups" );
m = rt.start( true );
s = rt.start( false );
-var writeOption = { writeConcern: { w: 2, wtimeout: 3000 }};
+function block(){
+ am.runCommand( { getlasterror : 1 , w : 2 , wtimeout : 3000 } )
+}
am = m.getDB( "foo" );
as = s.getDB( "foo" );
@@ -14,18 +16,20 @@ function run( createInBackground ) {
collName = "foo" + ( createInBackground ? "B" : "F" );
am[collName].drop();
- am.blah.insert({ x: 1 }, writeOption);
+ am.blah.insert( { x : 1 } )
assert.soon( function(){
+ block();
return as.blah.findOne();
}
);
-
- var bulk = am[collName].initializeUnorderedBulkOp();
- for (var i = 0; i < 10; i++) {
- bulk.insert({ _id: i, x: Math.floor( i / 2 ) });
+
+
+ for ( i=0; i<10; i++ ) {
+ am[collName].insert( { _id : i , x : Math.floor( i / 2 ) } )
}
- assert.writeOK(bulk.execute({ w: 2, wtimeout: 3000 }));
-
+
+ block();
+
am.runCommand( { "godinsert" : collName , obj : { _id : 100 , x : 20 } } );
am.runCommand( { "godinsert" : collName , obj : { _id : 101 , x : 20 } } );
@@ -39,8 +43,8 @@ function run( createInBackground ) {
}
am[collName].ensureIndex( { x : 1 } , { unique : true , dropDups : true , background : createInBackground } );
- am.blah.insert({ x: 1 }, writeOption);
-
+ am.blah.insert( { x : 1 } )
+ block();
assert.eq( 2 , am[collName].getIndexKeys().length , "A1 : " + createInBackground )
if (!createInBackground) {
assert.eq( 2 , as[collName].getIndexKeys().length , "A2 : " + createInBackground )