@@ -101,6 +101,40 @@ module.exports = testCase({
101101 } ) ;
102102 } ) ;
103103 } ,
104+
105+ shouldCorrectlyWaitForReplicationToServersOnInserts : function ( test ) {
106+ // debug("=========================================== shouldWorkCorrectlyWithInserts")
107+ // Replica configuration
108+ var replSet = new ReplSetServers ( [
109+ new Server ( RS . host , RS . ports [ 1 ] , { auto_reconnect : true } ) ,
110+ new Server ( RS . host , RS . ports [ 0 ] , { auto_reconnect : true } ) ,
111+ new Server ( RS . host , RS . ports [ 2 ] , { auto_reconnect : true } )
112+ ] ,
113+ { rs_name :RS . name }
114+ ) ;
115+
116+ // Insert some data
117+ var db = new Db ( 'integration_test_' , replSet ) ;
118+ db . open ( function ( err , p_db ) {
119+ // Check if we got an error
120+ if ( err != null ) debug ( "shouldCorrectlyWaitForReplicationToServersOnInserts :: " + inspect ( err ) ) ;
121+
122+ // Drop collection on replicaset
123+ p_db . dropCollection ( 'testsets' , function ( err , r ) {
124+ if ( err != null ) debug ( "shouldCorrectlyWaitForReplicationToServersOnInserts :: " + inspect ( err ) ) ;
125+ // Recreate collection on replicaset
126+ p_db . createCollection ( 'testsets' , function ( err , collection ) {
127+ if ( err != null ) debug ( "shouldCorrectlyWaitForReplicationToServersOnInserts :: " + inspect ( err ) ) ;
128+ // Insert a dummy document
129+ collection . insert ( { a :20 } , { safe : { w :7 , wtimeout : 10000 } } , function ( err , r ) {
130+ test . equal ( 'timeout' , err . err ) ;
131+ test . equal ( true , err . wtimeout ) ;
132+ test . done ( ) ;
133+ } ) ;
134+ } ) ;
135+ } ) ;
136+ } ) ;
137+ } ,
104138
105139 shouldCorrectlyExecuteSafeFindAndModify : function ( test ) {
106140 // Replica configuration
0 commit comments