|
I like this solution better, as a workaround, but still feel it's useful for testing larger replica sets and clusters to be able to specify the number of replica set nodes without worrying about the voting limits. This would be useful for test suites which run with large clusters.
Here's the workaround I'm now using:
function replSetNodes(numReplSetNodes) {
|
const replSetVotingLimit = 7;
|
var rstConfig = [];
|
for (var i = 0; i < numReplSetNodes; i++) {
|
rstConfig[i] = {};
|
if (i >= replSetVotingLimit) {
|
rstConfig[i].rsConfig = {priority: 0, votes: 0};
|
}
|
}
|
return rstConfig;
|
}
|
|
var numReplSetNodes = 15;
|
var replSetConfig = {
|
nodes: replSetNodes(numReplSetNodes),
|
oplogSize: 1024
|
};
|
|
var rst = new ReplSetTest(replSetConfig);
|
rst.startSet();
|
rst.initiate();
|
|
|
If you want a test like this you can specify options for each node, instead of a total count. I'm not sure we want to add logic in ReplSetTest which knows the limits of voters/arbiters/config/etc. The test should be specifying this information, which it can do already.
var rt = new ReplSetTest({nodes:[{},{},{},...{rsConfig:{priority:0, votes:0}},...]})
|
|