summaryrefslogtreecommitdiff
path: root/jstests/replsets/last_op_visible.js
diff options
context:
space:
mode:
authorclang-format-7.0.1 <adam.martin@10gen.com>2019-07-26 18:20:35 -0400
committerADAM David Alan Martin <adam.martin@10gen.com>2019-07-27 11:02:23 -0400
commit134a4083953270e8a11430395357fb70a29047ad (patch)
treedd428e1230e31d92b20b393dfdc17ffe7fa79cb6 /jstests/replsets/last_op_visible.js
parent1e46b5049003f427047e723ea5fab15b5a9253ca (diff)
downloadmongo-134a4083953270e8a11430395357fb70a29047ad.tar.gz
SERVER-41772 Apply clang-format 7.0.1 to the codebase
Diffstat (limited to 'jstests/replsets/last_op_visible.js')
-rw-r--r--jstests/replsets/last_op_visible.js83
1 files changed, 41 insertions, 42 deletions
diff --git a/jstests/replsets/last_op_visible.js b/jstests/replsets/last_op_visible.js
index 4b8b70a24b4..94a0b32cbf0 100644
--- a/jstests/replsets/last_op_visible.js
+++ b/jstests/replsets/last_op_visible.js
@@ -8,51 +8,50 @@
load("jstests/replsets/rslib.js");
(function() {
- "use strict";
+"use strict";
- var name = 'lastOpVisible';
- var replTest = new ReplSetTest(
- {name: name, nodes: 3, nodeOptions: {enableMajorityReadConcern: ''}, waitForKeys: true});
+var name = 'lastOpVisible';
+var replTest = new ReplSetTest(
+ {name: name, nodes: 3, nodeOptions: {enableMajorityReadConcern: ''}, waitForKeys: true});
- if (!startSetIfSupportsReadMajority(replTest)) {
- jsTestLog("Skipping test since storage engine doesn't support majority read concern.");
- replTest.stopSet();
- return;
- }
- replTest.initiate();
-
- var primary = replTest.getPrimary();
+if (!startSetIfSupportsReadMajority(replTest)) {
+ jsTestLog("Skipping test since storage engine doesn't support majority read concern.");
+ replTest.stopSet();
+ return;
+}
+replTest.initiate();
- // Do an insert without writeConcern.
- var res = primary.getDB(name).runCommandWithMetadata({insert: name, documents: [{x: 1}]},
- {"$replData": 1});
- assert.commandWorked(res.commandReply);
- var last_op_visible = res.commandReply["$replData"].lastOpVisible;
+var primary = replTest.getPrimary();
- // A find should return the same lastVisibleOp.
- res = primary.getDB(name).runCommandWithMetadata({find: name, readConcern: {level: "local"}},
+// Do an insert without writeConcern.
+var res = primary.getDB(name).runCommandWithMetadata({insert: name, documents: [{x: 1}]},
{"$replData": 1});
- assert.commandWorked(res.commandReply);
- assert.eq(last_op_visible, res.commandReply["$replData"].lastOpVisible);
-
- // A majority readConcern with afterOpTime: lastOpVisible should also return the same
- // lastVisibleOp.
- res = primary.getDB(name).runCommandWithMetadata(
- {find: name, readConcern: {level: "majority", afterOpTime: last_op_visible}},
- {"$replData": 1});
- assert.commandWorked(res.commandReply);
- assert.eq(last_op_visible, res.commandReply["$replData"].lastOpVisible);
-
- // Do an insert without writeConcern.
- res = primary.getDB(name).runCommandWithMetadata(
- {insert: name, documents: [{x: 1}], writeConcern: {w: "majority"}}, {"$replData": 1});
- assert.commandWorked(res.commandReply);
- last_op_visible = res.commandReply["$replData"].lastOpVisible;
-
- // A majority readConcern should return the same lastVisibleOp.
- res = primary.getDB(name).runCommandWithMetadata({find: name, readConcern: {level: "majority"}},
- {"$replData": 1});
- assert.commandWorked(res.commandReply);
- assert.eq(last_op_visible, res.commandReply["$replData"].lastOpVisible);
- replTest.stopSet();
+assert.commandWorked(res.commandReply);
+var last_op_visible = res.commandReply["$replData"].lastOpVisible;
+
+// A find should return the same lastVisibleOp.
+res = primary.getDB(name).runCommandWithMetadata({find: name, readConcern: {level: "local"}},
+ {"$replData": 1});
+assert.commandWorked(res.commandReply);
+assert.eq(last_op_visible, res.commandReply["$replData"].lastOpVisible);
+
+// A majority readConcern with afterOpTime: lastOpVisible should also return the same
+// lastVisibleOp.
+res = primary.getDB(name).runCommandWithMetadata(
+ {find: name, readConcern: {level: "majority", afterOpTime: last_op_visible}}, {"$replData": 1});
+assert.commandWorked(res.commandReply);
+assert.eq(last_op_visible, res.commandReply["$replData"].lastOpVisible);
+
+// Do an insert without writeConcern.
+res = primary.getDB(name).runCommandWithMetadata(
+ {insert: name, documents: [{x: 1}], writeConcern: {w: "majority"}}, {"$replData": 1});
+assert.commandWorked(res.commandReply);
+last_op_visible = res.commandReply["$replData"].lastOpVisible;
+
+// A majority readConcern should return the same lastVisibleOp.
+res = primary.getDB(name).runCommandWithMetadata({find: name, readConcern: {level: "majority"}},
+ {"$replData": 1});
+assert.commandWorked(res.commandReply);
+assert.eq(last_op_visible, res.commandReply["$replData"].lastOpVisible);
+replTest.stopSet();
}());