mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
SERVER-17723 Change explain_read_pref.js to use an existing database
This commit is contained in:
parent
41392d9921
commit
04a120d6dc
@ -6,8 +6,6 @@
|
|||||||
|
|
||||||
load("jstests/replsets/rslib.js");
|
load("jstests/replsets/rslib.js");
|
||||||
|
|
||||||
var NODE_COUNT = 2;
|
|
||||||
|
|
||||||
var testAllModes = function(conn, isMongos) {
|
var testAllModes = function(conn, isMongos) {
|
||||||
|
|
||||||
// The primary is tagged with { tag: 'one' } and the secondary with
|
// The primary is tagged with { tag: 'one' } and the secondary with
|
||||||
@ -40,7 +38,7 @@ var testAllModes = function(conn, isMongos) {
|
|||||||
].forEach(function(args) {
|
].forEach(function(args) {
|
||||||
var mode = args[0], tagSets = args[1], secExpected = args[2];
|
var mode = args[0], tagSets = args[1], secExpected = args[2];
|
||||||
|
|
||||||
var testDB = conn.getDB('test');
|
var testDB = conn.getDB('TestDB');
|
||||||
conn.setSlaveOk(false); // purely rely on readPref
|
conn.setSlaveOk(false); // purely rely on readPref
|
||||||
jsTest.log('Testing mode: ' + mode + ', tag sets: ' + tojson(tagSets));
|
jsTest.log('Testing mode: ' + mode + ', tag sets: ' + tojson(tagSets));
|
||||||
|
|
||||||
@ -69,7 +67,7 @@ var testAllModes = function(conn, isMongos) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var st = new ShardingTest({ shards: { rs0: { nodes: NODE_COUNT }}});
|
var st = new ShardingTest({ shards: { rs0: { nodes: 2 }}});
|
||||||
st.stopBalancer();
|
st.stopBalancer();
|
||||||
|
|
||||||
ReplSetTest.awaitRSClientHosts(st.s, st.rs0.nodes);
|
ReplSetTest.awaitRSClientHosts(st.s, st.rs0.nodes);
|
||||||
@ -103,10 +101,10 @@ catch(e) {
|
|||||||
|
|
||||||
st.rs0.awaitSecondaryNodes();
|
st.rs0.awaitSecondaryNodes();
|
||||||
|
|
||||||
// Force mongos to reconnect after our reconfig
|
// Force mongos to reconnect after our reconfig and also create the test database
|
||||||
assert.soon(function() {
|
assert.soon(function() {
|
||||||
try {
|
try {
|
||||||
st.s.getDB('foo').runCommand({ create: 'foo' });
|
st.s.getDB('TestDB').runCommand({ create: 'TestColl' });
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (x) {
|
catch (x) {
|
||||||
|
Loading…
Reference in New Issue
Block a user