summaryrefslogtreecommitdiff
path: root/jstests/replsets/read_committed.js
diff options
context:
space:
mode:
authorCharlie Swanson <charlie.swanson@mongodb.com>2015-12-03 12:23:44 -0500
committerCharlie Swanson <charlie.swanson@mongodb.com>2016-01-12 14:21:13 -0500
commitbf8b5340af390b0501c5cc254cb8a377f9dbdcf0 (patch)
tree74a09971e964e4b0035569313344ab3f9280b82d /jstests/replsets/read_committed.js
parentc60496946bdf5e723bfa3cfb8937e1ab10d15bee (diff)
downloadmongo-bf8b5340af390b0501c5cc254cb8a377f9dbdcf0.tar.gz
SERVER-22148 Simplify read committed tests
Many read committed tests share some fairly complex code to determine if the current storage engine supports committed reads. This commit moves that duplicate code into rslib.js.
Diffstat (limited to 'jstests/replsets/read_committed.js')
-rw-r--r--jstests/replsets/read_committed.js26
1 files changed, 14 insertions, 12 deletions
diff --git a/jstests/replsets/read_committed.js b/jstests/replsets/read_committed.js
index d3f8fc22afc..06776edcce1 100644
--- a/jstests/replsets/read_committed.js
+++ b/jstests/replsets/read_committed.js
@@ -1,4 +1,13 @@
-// Test basic read committed functionality.
+/**
+ * Test basic read committed functionality, including:
+ * - Writes with writeConcern 'majority' should be visible once the write completes.
+ * - With the only data-bearing secondary down, committed reads should not include newly inserted
+ * data.
+ * - When data-bearing node comes back up and catches up, writes should be readable.
+ */
+
+load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority.
+
(function() {
"use strict";
@@ -7,20 +16,13 @@ var name = "read_committed";
var replTest = new ReplSetTest({name: name,
nodes: 3,
nodeOptions: {enableMajorityReadConcern: ''}});
-var nodes = replTest.nodeList();
-try {
- replTest.startSet();
-} catch (e) {
- var conn = MongoRunner.runMongod();
- if (!conn.getDB('admin').serverStatus().storageEngine.supportsCommittedReads) {
- jsTest.log("skipping test since storage engine doesn't support committed reads");
- MongoRunner.stopMongod(conn);
- return;
- }
- throw e;
+if (!startSetIfSupportsReadMajority(replTest)) {
+ jsTest.log("skipping test since storage engine doesn't support committed reads");
+ return;
}
+var nodes = replTest.nodeList();
replTest.initiate({"_id": name,
"members": [
{ "_id": 0, "host": nodes[0] },