summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/after_cluster_time.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/noPassthrough/after_cluster_time.js')
-rw-r--r--jstests/noPassthrough/after_cluster_time.js110
1 files changed, 55 insertions, 55 deletions
diff --git a/jstests/noPassthrough/after_cluster_time.js b/jstests/noPassthrough/after_cluster_time.js
index 1137e8495f2..78485d10a31 100644
--- a/jstests/noPassthrough/after_cluster_time.js
+++ b/jstests/noPassthrough/after_cluster_time.js
@@ -1,71 +1,71 @@
// This test verifies readConcern:afterClusterTime behavior on a standalone mongod.
// @tags: [requires_replication, requires_majority_read_concern]
(function() {
- "use strict";
- var standalone =
- MongoRunner.runMongod({enableMajorityReadConcern: "", storageEngine: "wiredTiger"});
+"use strict";
+var standalone =
+ MongoRunner.runMongod({enableMajorityReadConcern: "", storageEngine: "wiredTiger"});
- var testDB = standalone.getDB("test");
+var testDB = standalone.getDB("test");
- assert.commandWorked(testDB.runCommand({insert: "after_cluster_time", documents: [{x: 1}]}));
+assert.commandWorked(testDB.runCommand({insert: "after_cluster_time", documents: [{x: 1}]}));
- // Majority reads without afterClusterTime succeed.
- assert.commandWorked(
- testDB.runCommand({find: "after_cluster_time", readConcern: {level: "majority"}}),
- "expected majority read without afterClusterTime to succeed on standalone mongod");
+// Majority reads without afterClusterTime succeed.
+assert.commandWorked(
+ testDB.runCommand({find: "after_cluster_time", readConcern: {level: "majority"}}),
+ "expected majority read without afterClusterTime to succeed on standalone mongod");
- // afterClusterTime reads without a level fail.
- assert.commandFailedWithCode(
- testDB.runCommand(
- {find: "after_cluster_time", readConcern: {afterClusterTime: Timestamp(0, 0)}}),
- ErrorCodes.InvalidOptions,
- "expected non-majority afterClusterTime read to fail on standalone mongod");
+// afterClusterTime reads without a level fail.
+assert.commandFailedWithCode(
+ testDB.runCommand(
+ {find: "after_cluster_time", readConcern: {afterClusterTime: Timestamp(0, 0)}}),
+ ErrorCodes.InvalidOptions,
+ "expected non-majority afterClusterTime read to fail on standalone mongod");
- // afterClusterTime reads with null timestamps are rejected.
- assert.commandFailedWithCode(
- testDB.runCommand({
- find: "after_cluster_time",
- readConcern: {level: "majority", afterClusterTime: Timestamp(0, 0)}
- }),
- ErrorCodes.InvalidOptions,
- "expected afterClusterTime read with null timestamp to fail on standalone mongod");
-
- // Standalones don't support any operations with clusterTime.
- assert.commandFailedWithCode(testDB.runCommand({
+// afterClusterTime reads with null timestamps are rejected.
+assert.commandFailedWithCode(
+ testDB.runCommand({
find: "after_cluster_time",
- readConcern: {level: "majority", afterClusterTime: Timestamp(0, 1)}
+ readConcern: {level: "majority", afterClusterTime: Timestamp(0, 0)}
}),
- ErrorCodes.IllegalOperation,
- "expected afterClusterTime read to fail on standalone mongod");
- MongoRunner.stopMongod(standalone);
+ ErrorCodes.InvalidOptions,
+ "expected afterClusterTime read with null timestamp to fail on standalone mongod");
+
+// Standalones don't support any operations with clusterTime.
+assert.commandFailedWithCode(testDB.runCommand({
+ find: "after_cluster_time",
+ readConcern: {level: "majority", afterClusterTime: Timestamp(0, 1)}
+}),
+ ErrorCodes.IllegalOperation,
+ "expected afterClusterTime read to fail on standalone mongod");
+MongoRunner.stopMongod(standalone);
- var rst = new ReplSetTest({nodes: 1});
- rst.startSet();
- rst.initiate();
- var adminDBRS = rst.getPrimary().getDB("admin");
+var rst = new ReplSetTest({nodes: 1});
+rst.startSet();
+rst.initiate();
+var adminDBRS = rst.getPrimary().getDB("admin");
- var res = adminDBRS.runCommand({ping: 1});
- assert.commandWorked(res);
- assert(res.hasOwnProperty("$clusterTime"), tojson(res));
- assert(res.$clusterTime.hasOwnProperty("clusterTime"), tojson(res));
- var clusterTime = res.$clusterTime.clusterTime;
- // afterClusterTime is not allowed in ping command.
- assert.commandFailedWithCode(
- adminDBRS.runCommand({ping: 1, readConcern: {afterClusterTime: clusterTime}}),
- ErrorCodes.InvalidOptions,
- "expected afterClusterTime fail in ping");
+var res = adminDBRS.runCommand({ping: 1});
+assert.commandWorked(res);
+assert(res.hasOwnProperty("$clusterTime"), tojson(res));
+assert(res.$clusterTime.hasOwnProperty("clusterTime"), tojson(res));
+var clusterTime = res.$clusterTime.clusterTime;
+// afterClusterTime is not allowed in ping command.
+assert.commandFailedWithCode(
+ adminDBRS.runCommand({ping: 1, readConcern: {afterClusterTime: clusterTime}}),
+ ErrorCodes.InvalidOptions,
+ "expected afterClusterTime fail in ping");
- // afterClusterTime is not allowed in serverStatus command.
- assert.commandFailedWithCode(
- adminDBRS.runCommand({serverStatus: 1, readConcern: {afterClusterTime: clusterTime}}),
- ErrorCodes.InvalidOptions,
- "expected afterClusterTime fail in serverStatus");
+// afterClusterTime is not allowed in serverStatus command.
+assert.commandFailedWithCode(
+ adminDBRS.runCommand({serverStatus: 1, readConcern: {afterClusterTime: clusterTime}}),
+ ErrorCodes.InvalidOptions,
+ "expected afterClusterTime fail in serverStatus");
- // afterClusterTime is not allowed in currentOp command.
- assert.commandFailedWithCode(
- adminDBRS.runCommand({currentOp: 1, readConcern: {afterClusterTime: clusterTime}}),
- ErrorCodes.InvalidOptions,
- "expected afterClusterTime fail in serverStatus");
+// afterClusterTime is not allowed in currentOp command.
+assert.commandFailedWithCode(
+ adminDBRS.runCommand({currentOp: 1, readConcern: {afterClusterTime: clusterTime}}),
+ ErrorCodes.InvalidOptions,
+ "expected afterClusterTime fail in serverStatus");
- rst.stopSet();
+rst.stopSet();
}());