summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mongo/shell/replsettest.js14
-rw-r--r--src/mongo/shell/shardingtest.js12
2 files changed, 19 insertions, 7 deletions
diff --git a/src/mongo/shell/replsettest.js b/src/mongo/shell/replsettest.js
index 07c7ee05d40..24f532b26f2 100644
--- a/src/mongo/shell/replsettest.js
+++ b/src/mongo/shell/replsettest.js
@@ -1625,14 +1625,16 @@ var ReplSetTest = function(opts) {
// solution.
const masterId = "n" + rst.getNodeId(master);
const masterOptions = rst.nodeOptions[masterId] || {};
- if (masterOptions.clusterAuthMode === "x509") {
+ const options =
+ (masterOptions === {} || !self.startOptions) ? masterOptions : self.startOptions;
+ if (options.clusterAuthMode === "x509") {
print("AwaitLastStableRecoveryTimestamp: authenticating on separate shell " +
"with x509 for " + id);
const subShellArgs = [
'mongo',
'--ssl',
- '--sslCAFile=' + masterOptions.sslCAFile,
- '--sslPEMKeyFile=' + masterOptions.sslPEMKeyFile,
+ '--sslCAFile=' + options.sslCAFile,
+ '--sslPEMKeyFile=' + options.sslPEMKeyFile,
'--sslAllowInvalidHostnames',
'--authenticationDatabase=$external',
'--authenticationMechanism=MONGODB-X509',
@@ -1644,11 +1646,11 @@ var ReplSetTest = function(opts) {
const retVal = _runMongoProgram(...subShellArgs);
assert.eq(retVal, 0, 'mongo shell did not succeed with exit code 0');
} else {
- if (masterOptions.clusterAuthMode) {
+ if (options.clusterAuthMode) {
print("AwaitLastStableRecoveryTimestamp: authenticating with " +
- masterOptions.clusterAuthMode + " for " + id);
+ options.clusterAuthMode + " for " + id);
}
- asCluster(master, appendOplogNoteFn, masterOptions.keyFile);
+ asCluster(master, appendOplogNoteFn, options.keyFile);
}
}
diff --git a/src/mongo/shell/shardingtest.js b/src/mongo/shell/shardingtest.js
index e222bacc090..451ea33b479 100644
--- a/src/mongo/shell/shardingtest.js
+++ b/src/mongo/shell/shardingtest.js
@@ -1466,10 +1466,20 @@ var ShardingTest = function(params) {
for (var i = 0; i < numShards; i++) {
print("ShardingTest initiating replica set for shard: " + this._rs[i].setName);
+ // The mongo shell cannot authenticate as the internal __system user in tests that use
+ // x509 for cluster authentication. Choosing the default value for
+ // wcMajorityJournalDefault in ReplSetTest cannot be done automatically without the
+ // shell performing such authentication, so allow tests to pass the value in.
+ let rstConfig = this._rs[i].test.getReplSetConfig();
+ if (otherParams.hasOwnProperty("writeConcernMajorityJournalDefault")) {
+ rstConfig.writeConcernMajorityJournalDefault =
+ otherParams.writeConcernMajorityJournalDefault;
+ }
+
// ReplSetTest.initiate() requires all nodes to be to be authorized to run
// replSetGetStatus.
// TODO(SERVER-14017): Remove this in favor of using initiate() everywhere.
- this._rs[i].test.initiateWithAnyNodeAsPrimary();
+ this._rs[i].test.initiateWithAnyNodeAsPrimary(rstConfig);
this["rs" + i] = this._rs[i].test;
this._rsObjects[i] = this._rs[i].test;