summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
Diffstat (limited to 'jstests')
-rw-r--r--jstests/auth/arbiter.js7
-rw-r--r--jstests/multiVersion/causal_consistency_downgrade_cluster.js108
-rw-r--r--jstests/multiVersion/causal_consistency_downgrade_rs.js69
-rw-r--r--jstests/multiVersion/causal_consistency_upgrade_cluster.js156
-rw-r--r--jstests/multiVersion/causal_consistency_upgrade_rs.js76
-rw-r--r--jstests/noPassthrough/causal_consistency_feature_compatibility.js97
-rw-r--r--jstests/replsets/rollback_auth.js8
-rw-r--r--jstests/sharding/aggregation_currentop.js9
-rw-r--r--jstests/sharding/auth.js9
-rw-r--r--jstests/sharding/authCommands.js9
-rw-r--r--jstests/sharding/auth_slaveok_routing.js9
-rw-r--r--jstests/sharding/mongos_rs_auth_shard_failure_tolerance.js9
12 files changed, 60 insertions, 506 deletions
diff --git a/jstests/auth/arbiter.js b/jstests/auth/arbiter.js
index f272cc7bc65..3422b284a6f 100644
--- a/jstests/auth/arbiter.js
+++ b/jstests/auth/arbiter.js
@@ -2,6 +2,13 @@
// any other nodes in the replset.
// @tags: [requires_replication]
+// Arbiters don't replicate the admin.system.keys collection, so they can never validate or sign
+// clusterTime. Gossiping a clusterTime to an arbiter as a user other than __system will fail, so we
+// skip gossiping for this test.
+//
+// TODO SERVER-32639: remove this flag.
+TestData.skipGossipingClusterTime = true;
+
var name = "arbiter_localhost_test";
var key = "jstests/libs/key1";
var replTest = new ReplSetTest({name: name, nodes: 3, keyFile: key});
diff --git a/jstests/multiVersion/causal_consistency_downgrade_cluster.js b/jstests/multiVersion/causal_consistency_downgrade_cluster.js
deleted file mode 100644
index 42ab62706ea..00000000000
--- a/jstests/multiVersion/causal_consistency_downgrade_cluster.js
+++ /dev/null
@@ -1,108 +0,0 @@
-/**
- * Test the downgrade of a sharded cluster from latest to last-stable version succeeds, verifying
- * behavior related to causal consistency at each stage.
- */
-(function() {
- "use strict";
-
- load("jstests/multiVersion/libs/multi_rs.js");
- load("jstests/multiVersion/libs/multi_cluster.js");
- load("jstests/multiVersion/libs/causal_consistency_helpers.js");
-
- if (!supportsMajorityReadConcern()) {
- jsTestLog("Skipping test since storage engine doesn't support majority read concern.");
- return;
- }
-
- // Start a cluster at the latest version, with majority read concern enabled.
- var st = new ShardingTest({
- shards: 2,
- mongos: 1,
- other: {
- mongosOptions: {binVersion: "latest"},
- configOptions: {binVersion: "latest"},
- // Set catchUpTimeoutMillis for compatibility with v3.4.
- configReplSetTestOptions: {settings: {catchUpTimeoutMillis: 2000}},
- rsOptions: {
- binVersion: "latest",
- settings: {catchUpTimeoutMillis: 2000},
- enableMajorityReadConcern: ""
- },
- rs: true
- }
- });
- st.configRS.awaitReplication();
-
- st.s.getDB("test").runCommand({insert: "foo", documents: [{_id: 1, x: 1}]});
-
- // Both logical and operation times are returned, and cluster times are signed by mongos. Mongos
- // doesn't wait for keys at startup, so retry.
- // TODO: SERVER-31986 this check can be done only for authenticated connections that do not have
- // advance_cluster_time privilege.
- assert.soonNoExcept(function() {
- assertContainsLogicalAndOperationTime(st.s.getDB("test").runCommand({isMaster: 1}),
- {initialized: true, signed: false});
- return true;
- });
-
- // Mongos and shards can accept afterClusterTime reads.
- assertAfterClusterTimeReadSucceeds(st.s.getDB("test"), "foo");
- assertAfterClusterTimeReadSucceeds(st.rs0.getPrimary().getDB("test"), "foo");
- assertAfterClusterTimeReadSucceeds(st.rs1.getPrimary().getDB("test"), "foo");
-
- // Change featureCompatibilityVersion to 3.4.
- assert.commandWorked(st.s.adminCommand({setFeatureCompatibilityVersion: "3.4"}));
-
- // Mongos still signs cluster times, because they are held in memory.
- // TODO: SERVER-31986 this check can be done only for authenticated connections that do not have
- // advance_cluster_time privilege.
- assertContainsLogicalAndOperationTime(st.s.getDB("test").runCommand({isMaster: 1}),
- {initialized: true, signed: false});
-
- // afterClusterTime reads are no longer accepted.
- assertAfterClusterTimeReadFails(st.s.getDB("test"), "foo");
- assertAfterClusterTimeReadFails(st.rs0.getPrimary().getDB("test"), "foo");
- assertAfterClusterTimeReadFails(st.rs1.getPrimary().getDB("test"), "foo");
-
- // Shards and the config servers should no longer send logical or operation times.
- assertDoesNotContainLogicalOrOperationTime(
- st.rs0.getPrimary().getDB("test").runCommand({isMaster: 1}));
- assertDoesNotContainLogicalOrOperationTime(
- st.rs1.getPrimary().getDB("test").runCommand({isMaster: 1}));
- assertDoesNotContainLogicalOrOperationTime(
- st.configRS.getPrimary().getDB("test").runCommand({isMaster: 1}));
-
- // Downgrade mongos first.
- jsTest.log("Downgrading mongos servers.");
- st.upgradeCluster("last-stable", {upgradeConfigs: false, upgradeShards: false});
- st.restartMongoses();
-
- // Mongos should no longer return operation or cluster times.
- assertDoesNotContainLogicalOrOperationTime(st.s.getDB("test").runCommand({isMaster: 1}));
-
- // Downgrade shards next.
- jsTest.log("Downgrading shard servers.");
- st.upgradeCluster("last-stable", {upgradeConfigs: false, upgradeMongos: false});
- st.restartMongoses();
-
- // Finally, downgrade config servers.
- jsTest.log("Downgrading config servers.");
- st.upgradeCluster("last-stable", {upgradeMongos: false, upgradeShards: false});
- st.restartMongoses();
-
- // No servers return logical or operation time.
- assertDoesNotContainLogicalOrOperationTime(st.s.getDB("test").runCommand({isMaster: 1}));
- assertDoesNotContainLogicalOrOperationTime(
- st.rs0.getPrimary().getDB("test").runCommand({isMaster: 1}));
- assertDoesNotContainLogicalOrOperationTime(
- st.rs1.getPrimary().getDB("test").runCommand({isMaster: 1}));
- assertDoesNotContainLogicalOrOperationTime(
- st.configRS.getPrimary().getDB("test").runCommand({isMaster: 1}));
-
- // afterClusterTime reads are still not accepted.
- assertAfterClusterTimeReadFails(st.s.getDB("test"), "foo");
- assertAfterClusterTimeReadFails(st.rs0.getPrimary().getDB("test"), "foo");
- assertAfterClusterTimeReadFails(st.rs1.getPrimary().getDB("test"), "foo");
-
- st.stop();
-})();
diff --git a/jstests/multiVersion/causal_consistency_downgrade_rs.js b/jstests/multiVersion/causal_consistency_downgrade_rs.js
deleted file mode 100644
index 29aa2d5d226..00000000000
--- a/jstests/multiVersion/causal_consistency_downgrade_rs.js
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * Test the downgrade of a standalone replica set from latest to last-stable version succeeds,
- * verifying behavior related to causal consistency at each stage.
- */
-(function() {
- "use strict";
-
- load("jstests/multiVersion/libs/multi_rs.js");
- load("jstests/multiVersion/libs/causal_consistency_helpers.js");
-
- var newVersion = "latest";
- var oldVersion = "last-stable";
-
- var name = "causal_consistency_rs_downgrade";
- var rst = new ReplSetTest(
- {name: name, nodes: 3, waitForKeys: true, nodeOptions: {binVersion: newVersion}});
- rst.startSet();
- var replSetConfig = rst.getReplSetConfig();
- // Hard-code catchup timeout to be compatible with 3.4
- replSetConfig.settings = {catchUpTimeoutMillis: 2000};
- rst.initiate(replSetConfig);
-
- var primary = rst.getPrimary();
- primary.getDB("test").runCommand({insert: "foo", documents: [{_id: 1, x: 1}]});
- rst.awaitReplication();
-
- // Nodes can accept afterClusterTime reads.
- assert.soonNoExcept(() => {
- assertContainsLogicalAndOperationTime(primary.getDB("test").runCommand({isMaster: 1}),
- {initialized: true, signed: false});
- return true;
- });
-
- rst.getSecondaries().forEach(function(secondary) {
- assert.soonNoExcept(() => {
- assertContainsLogicalAndOperationTime(secondary.getDB("test").runCommand({isMaster: 1}),
- {initialized: true, signed: false});
- return true;
- });
- });
-
- jsTest.log("Setting FCV to 3.4 ...");
- assert.commandWorked(primary.adminCommand({setFeatureCompatibilityVersion: "3.4"}));
- rst.awaitReplication();
-
- assertDoesNotContainLogicalOrOperationTime(
- rst.getPrimary().getDB("test").runCommand({isMaster: 1}));
-
- rst.getSecondaries().forEach(function(secondary) {
- assertDoesNotContainLogicalOrOperationTime(
- secondary.getDB("test").runCommand({isMaster: 1}));
- });
-
- jsTest.log("Downgrading secondaries ...");
- rst.upgradeSecondaries(primary, {binVersion: oldVersion});
- jsTest.log("Downgrading secondaries complete.");
-
- rst.getSecondaries().forEach(function(secondary) {
- assertDoesNotContainLogicalOrOperationTime(
- secondary.getDB("test").runCommand({isMaster: 1}));
- });
-
- jsTest.log("Downgrading primary ...");
- rst.upgradePrimary(primary, {binVersion: oldVersion});
- jsTest.log("Downgrading primary complete.");
-
- assertDoesNotContainLogicalOrOperationTime(
- rst.getPrimary().getDB("test").runCommand({isMaster: 1}));
-})();
diff --git a/jstests/multiVersion/causal_consistency_upgrade_cluster.js b/jstests/multiVersion/causal_consistency_upgrade_cluster.js
deleted file mode 100644
index 4c62bbea2f0..00000000000
--- a/jstests/multiVersion/causal_consistency_upgrade_cluster.js
+++ /dev/null
@@ -1,156 +0,0 @@
-/**
- * Tests upgrading a cluster with two shards and two mongos servers from last stable to current
- * version, verifying the behavior of $clusterTime metadata and afterClusterTime commands throughout
- * the process.
- */
-(function() {
- "use strict";
-
- load("jstests/multiVersion/libs/multi_rs.js");
- load("jstests/multiVersion/libs/multi_cluster.js");
- load("jstests/multiVersion/libs/causal_consistency_helpers.js");
-
- if (!supportsMajorityReadConcern()) {
- jsTestLog("Skipping test since storage engine doesn't support majority read concern.");
- return;
- }
-
- // Start a cluster at the last stable version, with majority read concern enabled.
- var st = new ShardingTest({
- shards: 2,
- mongos: 2,
- other: {
- mongosOptions: {binVersion: "last-stable"},
- configOptions: {binVersion: "last-stable"},
- rsOptions: {binVersion: "last-stable", enableMajorityReadConcern: ""},
- rs: true
- }
- });
- st.configRS.awaitReplication();
-
- st.s.getDB("test").runCommand({insert: "foo", documents: [{_id: 1, x: 1}]});
-
- // No servers return logical or operation time.
- assertDoesNotContainLogicalOrOperationTime(st.s0.getDB("test").runCommand({isMaster: 1}));
- assertDoesNotContainLogicalOrOperationTime(st.s1.getDB("test").runCommand({isMaster: 1}));
- assertDoesNotContainLogicalOrOperationTime(
- st.rs0.getPrimary().getDB("test").runCommand({isMaster: 1}));
- assertDoesNotContainLogicalOrOperationTime(
- st.rs1.getPrimary().getDB("test").runCommand({isMaster: 1}));
- assertDoesNotContainLogicalOrOperationTime(
- st.configRS.getPrimary().getDB("test").runCommand({isMaster: 1}));
-
- // Upgrade the config servers.
- jsTest.log("Upgrading config servers.");
- st.upgradeCluster("latest", {upgradeMongos: false, upgradeShards: false});
- st.restartMongoses();
-
- // Mongod and mongos cannot accept afterClusterTime reads.
- assertAfterClusterTimeReadFails(st.s0.getDB("test"), "foo");
- assertAfterClusterTimeReadFails(st.s1.getDB("test"), "foo");
- assertAfterClusterTimeReadFails(st.rs0.getPrimary().getDB("test"), "foo");
- assertAfterClusterTimeReadFails(st.rs1.getPrimary().getDB("test"), "foo");
-
- // Config servers still don't return logical or operation times.
- assertDoesNotContainLogicalOrOperationTime(
- st.configRS.getPrimary().getDB("test").runCommand({isMaster: 1}));
-
- assertDoesNotContainLogicalOrOperationTime(st.s0.getDB("test").runCommand({isMaster: 1}));
- assertDoesNotContainLogicalOrOperationTime(st.s1.getDB("test").runCommand({isMaster: 1}));
- assertDoesNotContainLogicalOrOperationTime(
- st.rs0.getPrimary().getDB("test").runCommand({isMaster: 1}));
- assertDoesNotContainLogicalOrOperationTime(
- st.rs1.getPrimary().getDB("test").runCommand({isMaster: 1}));
-
- // Then upgrade the shard servers.
- jsTest.log("Upgrading shard servers.");
- st.upgradeCluster("latest", {upgradeConfigs: false, upgradeMongos: false});
- st.restartMongoses();
-
- // Mongod and mongos still cannot accept afterClusterTime reads.
- assertAfterClusterTimeReadFails(st.s0.getDB("test"), "foo");
- assertAfterClusterTimeReadFails(st.s1.getDB("test"), "foo");
- assertAfterClusterTimeReadFails(st.rs0.getPrimary().getDB("test"), "foo");
- assertAfterClusterTimeReadFails(st.rs1.getPrimary().getDB("test"), "foo");
-
- // Shards still don't return logical or operation times.
- assertDoesNotContainLogicalOrOperationTime(
- st.rs0.getPrimary().getDB("test").runCommand({isMaster: 1}));
- assertDoesNotContainLogicalOrOperationTime(
- st.rs1.getPrimary().getDB("test").runCommand({isMaster: 1}));
-
- // Neither do config servers.
- assertDoesNotContainLogicalOrOperationTime(
- st.configRS.getPrimary().getDB("test").runCommand({isMaster: 1}));
-
- assertDoesNotContainLogicalOrOperationTime(st.s0.getDB("test").runCommand({isMaster: 1}));
- assertDoesNotContainLogicalOrOperationTime(st.s1.getDB("test").runCommand({isMaster: 1}));
-
- // Finally, upgrade mongos servers.
- jsTest.log("Upgrading mongos servers.");
- st.upgradeCluster("latest", {upgradeConfigs: false, upgradeShards: false});
- st.restartMongoses();
-
- // afterClusterTime reads are still not accepted.
- assertAfterClusterTimeReadFails(st.s.getDB("test"), "foo");
- assertAfterClusterTimeReadFails(st.rs0.getPrimary().getDB("test"), "foo");
- assertAfterClusterTimeReadFails(st.rs1.getPrimary().getDB("test"), "foo");
-
- // Neither mongos returns cluster time or operation time, because there are no keys in the
- // config server, since feature compatibility version is still 3.4.
- assertDoesNotContainLogicalOrOperationTime(st.s0.getDB("test").runCommand({isMaster: 1}));
- assertDoesNotContainLogicalOrOperationTime(st.s1.getDB("test").runCommand({isMaster: 1}));
-
- // All shards and the config servers still don't return logical or operation time.
- assertDoesNotContainLogicalOrOperationTime(
- st.rs0.getPrimary().getDB("test").runCommand({isMaster: 1}));
- assertDoesNotContainLogicalOrOperationTime(
- st.rs1.getPrimary().getDB("test").runCommand({isMaster: 1}));
- assertDoesNotContainLogicalOrOperationTime(
- st.configRS.getPrimary().getDB("test").runCommand({isMaster: 1}));
-
- // Set feature compatibility version to 3.6 on one mongos.
- assert.commandWorked(st.s0.getDB("admin").runCommand({setFeatureCompatibilityVersion: "3.6"}));
-
- // Now shards and config servers return dummy signed cluster times and operation times.
- assertContainsLogicalAndOperationTime(
- st.rs0.getPrimary().getDB("test").runCommand({isMaster: 1}),
- {initialized: true, signed: false});
- assertContainsLogicalAndOperationTime(
- st.rs1.getPrimary().getDB("test").runCommand({isMaster: 1}),
- {initialized: true, signed: false});
- assertContainsLogicalAndOperationTime(
- st.configRS.getPrimary().getDB("test").runCommand({isMaster: 1}),
- {initialized: true, signed: false});
-
- // Once the config primary creates keys, both mongos servers discover them and start returning
- // signed cluster times.
- // TODO: SERVER-31986 this check can be done only for authenticated connections that do not have
- // advance_cluster_time privilege.
- assert.soonNoExcept(function() {
- assertContainsLogicalAndOperationTime(st.s0.getDB("test").runCommand({isMaster: 1}),
- {initialized: true, signed: false});
- assertContainsLogicalAndOperationTime(st.s1.getDB("test").runCommand({isMaster: 1}),
- {initialized: true, signed: false});
- return true;
- });
-
- // Now shards and mongos can accept afterClusterTime reads.
- assertAfterClusterTimeReadSucceeds(st.s0.getDB("test"), "foo");
- assertAfterClusterTimeReadSucceeds(st.s1.getDB("test"), "foo");
- assertAfterClusterTimeReadSucceeds(st.rs0.getPrimary().getDB("test"), "foo");
- assertAfterClusterTimeReadSucceeds(st.rs1.getPrimary().getDB("test"), "foo");
-
- // Causally consistent requests are correctly processed.
- let res = assert.commandWorked(
- st.s.getDB("test").runCommand({insert: "foo", documents: [{_id: 2, x: 2}]}));
- res = assert.commandWorked(
- st.s.getDB("test").runCommand({delete: "foo", deletes: [{q: {_id: 1}, limit: 1}]}));
-
- let operationTime = res.operationTime;
- res = assert.commandWorked(st.s.getDB("test").runCommand(
- {find: "foo", readConcern: {level: "majority", afterClusterTime: operationTime}}));
- assert.eq(res.cursor.firstBatch, [{_id: 2, x: 2}]);
-
- st.stop();
-})();
diff --git a/jstests/multiVersion/causal_consistency_upgrade_rs.js b/jstests/multiVersion/causal_consistency_upgrade_rs.js
deleted file mode 100644
index e3537e24bad..00000000000
--- a/jstests/multiVersion/causal_consistency_upgrade_rs.js
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * Test the upgrade of a standalone replica set from the last-stable to the version succeeds,
- * verifying behavior related to causal consistency at each stage.
- */
-(function() {
- "use strict";
-
- load("jstests/multiVersion/libs/multi_rs.js");
- load("jstests/multiVersion/libs/causal_consistency_helpers.js");
-
- var newVersion = "latest";
- var oldVersion = "last-stable";
-
- var name = "causal_consistency_rs_upgrade";
- var rst = new ReplSetTest(
- {name: name, nodes: 3, nodeOptions: {binVersion: oldVersion}, waitForKeys: false});
- rst.startSet();
- var replSetConfig = rst.getReplSetConfig();
- rst.initiate(replSetConfig);
-
- var primary = rst.getPrimary();
- primary.getDB("test").runCommand({insert: "foo", documents: [{_id: 1, x: 1}]});
- rst.awaitReplication();
-
- assertDoesNotContainLogicalOrOperationTime(primary.getDB("test").runCommand({isMaster: 1}));
-
- rst.getSecondaries().forEach(function(secondary) {
- assertDoesNotContainLogicalOrOperationTime(
- secondary.getDB("test").runCommand({isMaster: 1}));
- });
-
- jsTest.log("Upgrading secondaries ...");
- rst.upgradeSecondaries(primary, {binVersion: newVersion});
- jsTest.log("Upgrading secondaries complete.");
-
- rst.getSecondaries().forEach(function(secondary) {
- assertDoesNotContainLogicalOrOperationTime(
- secondary.getDB("test").runCommand({isMaster: 1}));
- });
-
- jsTest.log("Upgrading primary ...");
- rst.upgradePrimary(primary, {binVersion: newVersion});
- jsTest.log("Upgrading primary complete.");
-
- assertDoesNotContainLogicalOrOperationTime(
- rst.getPrimary().getDB("test").runCommand({isMaster: 1}));
-
- rst.getSecondaries().forEach(function(secondary) {
- assertDoesNotContainLogicalOrOperationTime(
- secondary.getDB("test").runCommand({isMaster: 1}));
- });
-
- jsTest.log("Setting FCV to 3.6 ...");
-
- assert.commandWorked(rst.getPrimary().adminCommand({setFeatureCompatibilityVersion: "3.6"}));
- rst.awaitReplication();
-
- rst.getPrimary().getDB("test").runCommand({insert: "foo", documents: [{_id: 2, x: 1}]});
- rst.awaitReplication();
-
- assert.soonNoExcept(() => {
- assertContainsLogicalAndOperationTime(
- rst.getPrimary().getDB("test").runCommand({isMaster: 1}),
- {initialized: true, signed: false});
- return true;
- });
-
- rst.getSecondaries().forEach(function(secondary) {
- assert.soonNoExcept(() => {
- assertContainsLogicalAndOperationTime(secondary.getDB("test").runCommand({isMaster: 1}),
- {initialized: true, signed: false});
- return true;
- });
- });
-
-})();
diff --git a/jstests/noPassthrough/causal_consistency_feature_compatibility.js b/jstests/noPassthrough/causal_consistency_feature_compatibility.js
deleted file mode 100644
index 6ec8632975f..00000000000
--- a/jstests/noPassthrough/causal_consistency_feature_compatibility.js
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * Tests the behavior of a sharded cluster when featureCompatibilityVersion is set to 3.4, with
- * respect to causal consistency. In noPassthrough to avoid issues with auth.
- */
-(function() {
- "use strict";
-
- load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority.
-
- function logicalTimeCanBeProcessed(db) {
- const increment = 5000;
-
- let initialTime = db.runCommand({isMaster: 1}).$clusterTime;
- if (!initialTime) {
- return false;
- }
-
- let laterTime = Object.merge(
- initialTime,
- {clusterTime: Timestamp(initialTime.clusterTime.getTime() + increment, 0)});
- let returnedTime = rst.getPrimary()
- .getDB("test")
- .runCommand({isMaster: 1, $clusterTime: laterTime})
- .$clusterTime;
-
- // Use a range to allow for unrelated activity advancing cluster time.
- return (returnedTime.clusterTime.getTime() - initialTime.clusterTime.getTime()) >=
- increment;
- }
-
- const rst = new ReplSetTest({
- nodes: 1,
- nodeOptions: {
- enableMajorityReadConcern: "",
- shardsvr: "",
- }
- });
-
- if (!startSetIfSupportsReadMajority(rst)) {
- jsTestLog("Skipping test since storage engine doesn't support majority read concern.");
- return;
- }
- rst.initiate();
-
- // Start the sharding test and add the majority read concern enabled replica set.
- const st = new ShardingTest({manualAddShard: true, mongosWaitsForKeys: true});
- assert.commandWorked(st.s.adminCommand({addShard: rst.getURL()}));
-
- const testDB = st.s.getDB("test");
-
- // Initialize sharding.
- assert.commandWorked(testDB.adminCommand({enableSharding: "test"}));
- assert.commandWorked(
- testDB.adminCommand({shardCollection: testDB.foo.getFullName(), key: {_id: 1}}));
-
- // Insert some data to find.
- assert.commandWorked(testDB.runCommand(
- {insert: "foo", documents: [{_id: 1, x: 1}], writeConcern: {w: "majority"}}));
-
- // Verify afterClusterTime can be processed by mongos and mongod.
- assert.commandWorked(testDB.runCommand(
- {find: "foo", readConcern: {level: "majority", afterClusterTime: Timestamp(1, 1)}}));
-
- assert.commandWorked(rst.getPrimary().getDB("test").runCommand(
- {find: "foo", readConcern: {level: "majority", afterClusterTime: Timestamp(1, 1)}}));
-
- // Verify cluster time can be processed by shards and the config servers.
- assert(logicalTimeCanBeProcessed(rst.getPrimary().getDB("test")));
- assert(logicalTimeCanBeProcessed(st.configRS.getPrimary().getDB("test")));
-
- // Set featureCompatibilityVersion to 3.4
- assert.commandWorked(st.s.adminCommand({setFeatureCompatibilityVersion: "3.4"}));
-
- // Verify cluster time cannot be processed by shards and the config servers now.
- assert(!logicalTimeCanBeProcessed(rst.getPrimary().getDB("test")));
- assert(!logicalTimeCanBeProcessed(st.configRS.getPrimary().getDB("test")));
-
- // afterClusterTime should be rejected by mongos and mongod.
- assert.commandFailedWithCode(
- testDB.runCommand(
- {find: "foo", readConcern: {level: "majority", afterClusterTime: Timestamp(1, 1)}}),
- ErrorCodes.InvalidOptions);
-
- assert.commandFailedWithCode(
- rst.getPrimary().getDB("test").runCommand(
- {find: "foo", readConcern: {level: "majority", afterClusterTime: Timestamp(1, 1)}}),
- ErrorCodes.InvalidOptions);
-
- // setFeatureCompatibilityVersion can only be run on the admin database on mongos.
- assert.commandWorked(st.s.adminCommand({setFeatureCompatibilityVersion: "3.6"}));
-
- // Verify cluster time can be processed by shards and the config servers again.
- assert(logicalTimeCanBeProcessed(rst.getPrimary().getDB("test")));
- assert(logicalTimeCanBeProcessed(st.configRS.getPrimary().getDB("test")));
-
- st.stop();
-})();
diff --git a/jstests/replsets/rollback_auth.js b/jstests/replsets/rollback_auth.js
index 073ecb486ff..eeb7a131911 100644
--- a/jstests/replsets/rollback_auth.js
+++ b/jstests/replsets/rollback_auth.js
@@ -12,6 +12,14 @@
(function() {
"use strict";
+
+ // Arbiters don't replicate the admin.system.keys collection, so they can never validate or sign
+ // clusterTime. Gossiping a clusterTime to an arbiter as a user other than __system will fail,
+ // so we skip gossiping for this test.
+ //
+ // TODO SERVER-32639: remove this flag.
+ TestData.skipGossipingClusterTime = true;
+
// helper function for verifying contents at the end of the test
var checkFinalResults = function(db) {
assert.commandWorked(db.runCommand({dbStats: 1}));
diff --git a/jstests/sharding/aggregation_currentop.js b/jstests/sharding/aggregation_currentop.js
index 2e5ece81ba1..2cae3bf11c2 100644
--- a/jstests/sharding/aggregation_currentop.js
+++ b/jstests/sharding/aggregation_currentop.js
@@ -17,6 +17,15 @@
(function() {
"use strict";
+ // Replica set nodes started with --shardsvr do not enable key generation until they are added
+ // to a sharded cluster and reject commands with gossiped clusterTime from users without the
+ // advanceClusterTime privilege. This causes ShardingTest setup to fail because the shell
+ // briefly authenticates as __system and recieves clusterTime metadata then will fail trying to
+ // gossip that time later in setup.
+ //
+ // TODO SERVER-32672: remove this flag.
+ TestData.skipGossipingClusterTime = true;
+
const key = "jstests/libs/key1";
// Create a new sharded cluster for testing. We set the internalQueryExecYieldIterations
diff --git a/jstests/sharding/auth.js b/jstests/sharding/auth.js
index 8a87be3e68f..155bd44b2dc 100644
--- a/jstests/sharding/auth.js
+++ b/jstests/sharding/auth.js
@@ -11,6 +11,15 @@
'use strict';
load("jstests/replsets/rslib.js");
+ // Replica set nodes started with --shardsvr do not enable key generation until they are added
+ // to a sharded cluster and reject commands with gossiped clusterTime from users without the
+ // advanceClusterTime privilege. This causes ShardingTest setup to fail because the shell
+ // briefly authenticates as __system and recieves clusterTime metadata then will fail trying to
+ // gossip that time later in setup.
+ //
+ // TODO SERVER-32672: remove this flag.
+ TestData.skipGossipingClusterTime = true;
+
var adminUser = {db: "admin", username: "foo", password: "bar"};
var testUser = {db: "test", username: "bar", password: "baz"};
diff --git a/jstests/sharding/authCommands.js b/jstests/sharding/authCommands.js
index 497a5748466..8ad74f23db3 100644
--- a/jstests/sharding/authCommands.js
+++ b/jstests/sharding/authCommands.js
@@ -6,6 +6,15 @@
load("jstests/replsets/rslib.js");
+ // Replica set nodes started with --shardsvr do not enable key generation until they are added
+ // to a sharded cluster and reject commands with gossiped clusterTime from users without the
+ // advanceClusterTime privilege. This causes ShardingTest setup to fail because the shell
+ // briefly authenticates as __system and recieves clusterTime metadata then will fail trying to
+ // gossip that time later in setup.
+ //
+ // TODO SERVER-32672: remove this flag.
+ TestData.skipGossipingClusterTime = true;
+
var st = new ShardingTest({
shards: 2,
rs: {oplogSize: 10, useHostname: false},
diff --git a/jstests/sharding/auth_slaveok_routing.js b/jstests/sharding/auth_slaveok_routing.js
index e55c253ee9b..51cfd97f62f 100644
--- a/jstests/sharding/auth_slaveok_routing.js
+++ b/jstests/sharding/auth_slaveok_routing.js
@@ -13,6 +13,15 @@
'use strict';
load("jstests/replsets/rslib.js");
+ // Replica set nodes started with --shardsvr do not enable key generation until they are added
+ // to a sharded cluster and reject commands with gossiped clusterTime from users without the
+ // advanceClusterTime privilege. This causes ShardingTest setup to fail because the shell
+ // briefly authenticates as __system and recieves clusterTime metadata then will fail trying to
+ // gossip that time later in setup.
+ //
+ // TODO SERVER-32672: remove this flag.
+ TestData.skipGossipingClusterTime = true;
+
/**
* Checks if a query to the given collection will be routed to the secondary. Returns true if
* query was routed to a secondary node.
diff --git a/jstests/sharding/mongos_rs_auth_shard_failure_tolerance.js b/jstests/sharding/mongos_rs_auth_shard_failure_tolerance.js
index a5ae6c62aa6..774c1d7dd01 100644
--- a/jstests/sharding/mongos_rs_auth_shard_failure_tolerance.js
+++ b/jstests/sharding/mongos_rs_auth_shard_failure_tolerance.js
@@ -15,6 +15,15 @@
// shard does not have a primary.
TestData.skipCheckingUUIDsConsistentAcrossCluster = true;
+// Replica set nodes started with --shardsvr do not enable key generation until they are added to a
+// sharded cluster and reject commands with gossiped clusterTime from users without the
+// advanceClusterTime privilege. This causes ShardingTest setup to fail because the shell briefly
+// authenticates as __system and recieves clusterTime metadata then will fail trying to gossip that
+// time later in setup.
+//
+// TODO SERVER-32672: remove this flag.
+TestData.skipGossipingClusterTime = true;
+
var options = {rs: true, rsOptions: {nodes: 2}, keyFile: "jstests/libs/key1"};
var st = new ShardingTest({shards: 3, mongos: 1, other: options});