SERVER-13188 Migrate aggregation jstest suite to use write commands api

This commit is contained in:
Randolph Tan 2014-03-11 14:38:27 -04:00
parent a53a7eec05
commit 5bd9fa125c
8 changed files with 15 additions and 19 deletions

View File

@ -469,7 +469,7 @@ def runTest(test, result):
path = argv[1]
elif ext == ".js":
argv = [shell_executable, "--port", mongod_port, '--authenticationMechanism', authMechanism]
if use_write_commands:
if use_write_commands or "aggregation" in path:
argv += ["--writeMode", "commands"]
else:
argv += ["--writeMode", shell_write_mode]

View File

@ -6,8 +6,6 @@ t.drop();
t.insert( { _id : 0 , x : 0 , undef: undefined } );
db.getLastError();
// Make sure having an undefined doesn't break pipelines not using the field
res = t.aggregate( { $project : { x : 1 } } ).toArray();
assert.eq(res[0].x, 0);

View File

@ -15,7 +15,6 @@ N = 100;
for( i = 0; i < N; ++i ) {
d.data.insert( { _id:i } )
}
d.getLastError();
// Split the data into 3 chunks.
s.adminCommand( { split:"test.data", middle:{ _id:33 } } );

View File

@ -12,7 +12,6 @@ d = s.getDB( "test" );
for( i = 0; i < 100; ++i ) {
d.data.insert( { _id:i, i:i%10 } )
}
d.getLastError();
// Split the data into 3 chunks.
s.adminCommand( { split:"test.data", middle:{ _id:33 } } );

View File

@ -66,10 +66,12 @@ function test(db, sharded, indexType) {
// insert points
var numPts = 10*1000;
var bulk = db[coll].initializeUnorderedBulkOp();
for (var i=0; i < numPts; i++) {
db[coll].insert({rand:Math.random(), loc: pointMaker.mkPt()});
bulk.insert({ rand: Math.random(), loc: pointMaker.mkPt() });
}
db.getLastError();
assert.writeOK(bulk.execute());
assert.eq(db[coll].count(), numPts);
db[coll].ensureIndex({loc: indexType});

View File

@ -13,8 +13,7 @@ if (doSharded) {
testDB.adminCommand({ shardCollection: 'test.user', key: { x: 1 }});
}
testDB.user.insert({ x: 10 });
testDB.runCommand({ getLastError: 1, w: NODES });
testDB.user.insert({ x: 10 }, { writeConcern: { w: NODES }});
testDB.setSlaveOk(true);
var secNode = st.rs0.getSecondary();

View File

@ -7,10 +7,10 @@ replTest.awaitReplication();
var mast = nodes[0].getDB('test');
var slav = nodes[1].getDB('test');
mast.agg.insert({});
mast.agg.insert({});
mast.agg.insert({});
mast.getLastError(2);
var options = { writeConcern: { w: 2 }};
mast.agg.insert({}, options);
mast.agg.insert({}, options);
mast.agg.insert({}, options);
var res = slav.agg.aggregate({$group: {_id: null, count: {$sum: 1}}});
assert.eq(res.toArray(), [{_id:null, count: 3}]);

View File

@ -74,14 +74,13 @@ var strings = [
];
var nItems = 200000;
var bulk = db.ts1.initializeUnorderedBulkOp();
for(i = 1; i <= nItems; ++i) {
db.ts1.save(
bulk.insert(
{counter: ++count, number: strings[i % 20], random: Math.random(),
filler: "0123456789012345678901234567890123456789"});
}
// wait for all writebacks to be applied
assert.eq(db.getLastError(), null);
assert.writeOK(bulk.execute());
// Turn on exception tracing in mongod to figure out exactly where the SCEs are coming from
// TEMPORARY - REMOVE ONCE SERVER-9622 IS RESOLVED
@ -145,8 +144,8 @@ for(i = 0 ; i < strings.length; ++i) {
// a match takes place in the shards; just returning the results from mongos
var a4 = aggregateNoOrder(db.ts1, [
{ $match: {$or:[{counter:55}, {counter:1111},
{counter: 2222}, {counter: 33333},
{counter: 99999}, {counter: 55555}]}
{counter: 2222}, {counter: 3333},
{counter: 9999}, {counter: 5555}]}
}
]);