0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-28 16:24:56 +01:00

SERVER-13710: Cleanup Replication Tests

This commit is contained in:
Scott Hernandez 2014-04-25 11:07:44 -04:00
parent 84ea70be95
commit 00ffa83225
9 changed files with 43 additions and 250 deletions

View File

@ -0,0 +1,12 @@
// don't allow regex as _id: SERVER-9502
var testColl = db.regex_not_id;
testColl.drop()
assert.writeOK(testColl.insert({ _id: "ABCDEF1" }, {writeConcern:{w:1}}));
// Should be an error.
assert.writeError(testColl.insert({ _id: /^A/ }, {writeConcern:{w:1}}));
// _id doesn't have to be first; still disallowed
assert.writeError(testColl.insert({ xxx: "ABCDEF", _id: /ABCDEF/ }, {writeConcern:{w:1}}));

26
jstests/core/top.js Normal file
View File

@ -0,0 +1,26 @@
/**
* 1. check top numbers are correct
*/
var name = "toptest";
var testDB = db.getSiblingDB(name);
var testColl = testDB[name + "coll"]
testColl.drop()
var topResult = testDB.adminCommand("top");
printjson(topResult.totals[testColl.getFullName()]);
var inserts = 0;
for(i=0;i<20;i++) {
testColl.insert({_id:i});
inserts++;
}
var topResult = testDB.adminCommand("top");
print("inserted " + inserts)
printjson(topResult.totals[testColl.getFullName()]);
//verify only 20 inserts took place
assert(inserts, topResult.totals[testColl.getFullName()].insert.count);
testColl.drop()

View File

@ -1,164 +0,0 @@
var myShardingTest = new ShardingTest("sharding_passthrough", 2, 0, 1);
myShardingTest.adminCommand({ enablesharding : "test" });
var db = myShardingTest.getDB("test");
var files = listFiles("jstests");
var runnerStart = new Date();
files.forEach(function(x) {
if (/[\/\\]_/.test(x.name) || ! /\.js$/.test(x.name)) {
print(" >>>>>>>>>>>>>>> skipping " + x.name);
return;
}
// Notes:
// apply_ops1, apply_ops2: nothing works, dunno why yet. SERVER-1439.
// copydb, copydb2: copyDatabase seems not to work at all in
// the ShardingTest setup. SERVER-1440.
// cursor8: cursorInfo different/meaningless(?) in mongos.
// closeAllDatabases may not work through mongos
// SERVER-1441.
// deal with cursorInfo in mongos SERVER-1442.
// dbcase: Database names are case-insensitive under ShardingTest?
// SERVER-1443.
// These are all SERVER-1444
// count5: limit() and maybe skip() may be unreliable.
// geo3: limit() not working, I think.
// or4: skip() not working?
// shellkillop: dunno yet. SERVER-1445
// update_setOnInsert: db.setPrifilingLevel is not working. SERVER-8653
// These should simply not be run under sharding:
// dbadmin: Uncertain Cut-n-pasting its contents into mongo worked.
// error1: getpreverror not supported under sharding.
// fsync, fsync2: isn't supported through mongos.
// remove5: getpreverror, I think. don't run.
// update4: getpreverror don't run.
// Around July 20, command passthrough went away, and these
// commands weren't implemented:
// clean cloneCollectionAsCapped copydbgetnonce dataSize
// datasize dbstats deleteIndexes dropIndexes forceerror
// getnonce logout medianKey profile reIndex repairDatabase
// reseterror splitVector validate
/* missing commands :
* forceerror and switchtoclienterrors
* cloneCollectionAsCapped
* splitvector
* profile (apitest_db, cursor6, evalb)
* copydbgetnonce
* dbhash
* medianKey
* clean (apitest_dbcollection)
* logout and getnonce
*/
var failsInShardingPattern = new RegExp('[\\/\\\\](' +
'error3|' +
'capped.*|' +
'apitest_db|' +
'cursor6|' +
'copydb-auth|' +
'profile\\d*|' +
'dbhash|' +
'dbhash2|' +
'median|' +
'apitest_dbcollection|' +
'evalb|' +
'evald|' +
'eval_nolock|' +
'auth1|' +
'auth2|' +
'dropdb_race|' +
'unix_socket\\d*' +
')\.js$');
// These are bugs (some might be fixed now):
var mightBeFixedPattern = new RegExp('[\\/\\\\](' +
'apply_ops[12]|' +
'count5|' +
'cursor8|' +
'or4|' +
'shellkillop|' +
'update4|' +
'update_setOnInsert|' +
'profile\\d*|' +
'max_time_ms' + // Will be fixed when SERVER-2212 is resolved.
')\.js$');
// These aren't supposed to get run under sharding:
var notForShardingPattern = new RegExp('[\\/\\\\](' +
'create_indexes|' +
'dbadmin|' +
'error1|' +
'fsync|' +
'fsync2|' +
'geo.*|' +
'indexh|' +
'remove5|' +
'update4|' +
'loglong|' +
'logpath|' +
'notablescan|' +
'compact.*|' +
'check_shard_index|' +
'bench_test.*|' +
'mr_replaceIntoDB|' +
'mr_auth|' +
'queryoptimizera|' +
'indexStatsCommand|' +
'storageDetailsCommand|' +
'reversecursor|' +
'block_check_supported|' +
'batch_write_protocol|' +
'stages.*|' +
'touch1|' +
'stats' + // tests db.stats().dataFileVersion, which doesn't appear in sharded db.stats()
')\.js$');
if (failsInShardingPattern.test(x.name)) {
print(" !!!!!!!!!!!!!!! skipping test that has failed under sharding " +
"but might not anymore " + x.name);
return;
}
if (mightBeFixedPattern.test(x.name)) {
print(" !!!!!!!!!!!!!!! skipping test that has failed under sharding " +
"but might not anymore " + x.name);
return;
}
if (notForShardingPattern.test(x.name)) {
print(" >>>>>>>>>>>>>>> skipping test that would correctly fail under sharding " + x.name);
return;
}
print(" *******************************************");
print(" Test : " + x.name + " ...");
print(" " +
Date.timeFunc(function() {
load(x.name);
}, 1) + "ms");
gc(); // TODO SERVER-8683: remove gc() calls once resolved
// Reset "db" variable, just in case someone broke the rules and used it themselves
db = myShardingTest.getDB("test");
});
myShardingTest.stop();
var runnerEnd = new Date();
print("total runner time: " + ((runnerEnd.getTime() - runnerStart.getTime()) / 1000) + "secs");

View File

@ -1,66 +0,0 @@
// Test repl with auth enabled
var baseName = "jstests_repl11test";
var keyFilePath = "jstests/libs/key1";
setAdmin = function( n ) {
n.getDB( "admin" ).createUser({user: "super", pwd: "super", roles: jsTest.adminUserRoles});
}
auth = function( n ) {
return n.getDB( baseName ).auth( "test", "test" );
}
doTest = function(signal, extraOpts) {
rt = new ReplTest( baseName );
m = rt.start( true, {}, false, true );
m.getDB( baseName ).createUser({user: "test", pwd: "test", roles: jsTest.basicUserRoles});
setAdmin( m );
rt.stop( true );
s = rt.start( false, {}, false, true );
rt.stop( false );
m = rt.start( true, { auth:null, keyFile: keyFilePath }, true );
auth( m );
var slaveOpt = { auth: null, keyFile: keyFilePath };
slaveOpt = Object.extend(slaveOpt, extraOpts);
s = rt.start( false, slaveOpt, true );
assert.soon( function() { return auth( s ); } );
ma = m.getDB( baseName ).a;
ma.save( {} );
sa = s.getDB( baseName ).a;
assert.soon( function() { return 1 == sa.count(); } );
s.getDB( "admin" ).auth( "super", "super" );
assert.commandWorked( s.getDB( "admin" )._adminCommand( {serverStatus:1,repl:1} ) );
assert.commandWorked( s.getDB( "admin" )._adminCommand( {serverStatus:1,repl:2} ) );
rt.stop( false, signal );
ma.save( {} );
s = rt.start(false, slaveOpt, true);
assert.soon( function() { return auth( s ); } );
sa = s.getDB( baseName ).a;
assert.soon( function() { return 2 == sa.count(); } );
ma.save( {a:1} );
assert.soon( function() { return 1 == sa.count( {a:1} ); } );
ma.update( {a:1}, {b:2} );
assert.soon( function() { return 1 == sa.count( {b:2} ); } );
ma.remove( {b:2} );
assert.soon( function() { return 0 == sa.count( {b:2} ); } );
rt.stop();
}
doTest( 15 ); // SIGTERM
doTest(9, { journal: null }); // SIGKILL

View File

@ -1,15 +0,0 @@
// don't allow regex as _id: SERVER-9502
var replTest = new ReplSetTest( {name: "server9502", nodes: 2} );
var nodes = replTest.startSet();
replTest.initiate();
var master = replTest.getMaster();
var mdb = master.getDB("test");
mdb.setWriteConcern({ w: 2, wtimeout: 60000 });
assert.writeOK(mdb.foo.insert({ _id: "ABCDEF" }));
assert.writeError(mdb.foo.insert({ _id: /^A/ }));
// _id doesn't have to be first; still disallowed
assert.writeError(mdb.foo.insert({ xxx: "ABCDEF", _id: /ABCDEF/ }));

View File

@ -52,7 +52,7 @@ files.forEach(function(x) {
// clean cloneCollectionAsCapped copydbgetnonce dataSize
// datasize dbstats deleteIndexes dropIndexes forceerror
// getnonce logout medianKey profile reIndex repairDatabase
// reseterror splitVector validate
// reseterror splitVector validate top
/* missing commands :
* forceerror and switchtoclienterrors
@ -125,25 +125,25 @@ files.forEach(function(x) {
'reversecursor|' +
'block_check_supported|' +
'stages.*|' +
'top|' +
'touch1|' +
'dbcase|' + // undo after fixing SERVER-11735
'stats' + // tests db.stats().dataFileVersion, which doesn't appear in sharded db.stats()
')\.js$');
if (failsInShardingPattern.test(x.name)) {
print(" !!!!!!!!!!!!!!! skipping test that has failed under sharding " +
"but might not anymore " + x.name);
print(" >>>>>>>>>>>>>>> skipping test that would correctly fail under sharding: " + x.name);
return;
}
if (mightBeFixedPattern.test(x.name)) {
print(" !!!!!!!!!!!!!!! skipping test that has failed under sharding " +
print(" !!!!!!!!!!!!!!! skipping test that has failed under sharding: " +
"but might not anymore " + x.name);
return;
}
if (notForShardingPattern.test(x.name)) {
print(" >>>>>>>>>>>>>>> skipping test that would correctly fail under sharding " + x.name);
print(" !!!!!!!!!!!!!!! skipping test that should not run under sharding: " + x.name);
return;
}