summaryrefslogtreecommitdiff
path: root/jstests/replsets/randomcommands1.js
blob: c451e7431a85ed957b9357482348ec1d3fdb4de7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

replTest = new ReplSetTest( {name: 'randomcommands1', nodes: 3} );

nodes = replTest.startSet();
replTest.initiate();

master = replTest.getMaster();
slaves = replTest.liveNodes.slaves;
printjson(replTest.liveNodes);

db = master.getDB("foo")
t = db.foo

ts = slaves.map( function(z){ z.setSlaveOk(); return z.getDB( "foo" ).foo; } )

t.save({a: 1000});
t.ensureIndex( { a : 1 } )

db.getLastError( 3 , 30000 )

ts.forEach( function(z){ assert.eq( 2 , z.getIndexKeys().length , "A " + z.getMongo() ); } )

t.reIndex()

db.getLastError( 3 , 30000 )
ts.forEach( function(z){ assert.eq( 2 , z.getIndexKeys().length , "A " + z.getMongo() ); } )

replTest.stopSet( 15 )