diff options
author | Spencer T Brody <spencer@mongodb.com> | 2018-03-23 16:29:15 -0400 |
---|---|---|
committer | Spencer T Brody <spencer@mongodb.com> | 2018-03-26 16:49:32 -0400 |
commit | f1b3e32355e84b1c2ad39cffab2e6e619a474e9d (patch) | |
tree | 82948e514bed5bf6e76f3ec83c16986c565599eb /jstests/sharding/shards_and_config_return_last_committed_optime.js | |
parent | 0d0fb80fd65f355cd83e6994d4e3eafe13a96fd4 (diff) | |
download | mongo-f1b3e32355e84b1c2ad39cffab2e6e619a474e9d.tar.gz |
SERVER-34112 Increase resiliency of shards_and_config_return_last_committed_optime.js test
Diffstat (limited to 'jstests/sharding/shards_and_config_return_last_committed_optime.js')
-rw-r--r-- | jstests/sharding/shards_and_config_return_last_committed_optime.js | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/jstests/sharding/shards_and_config_return_last_committed_optime.js b/jstests/sharding/shards_and_config_return_last_committed_optime.js index 250965bec45..88d63c3affc 100644 --- a/jstests/sharding/shards_and_config_return_last_committed_optime.js +++ b/jstests/sharding/shards_and_config_return_last_committed_optime.js @@ -12,6 +12,8 @@ (function() { "use strict"; + load("jstests/libs/write_concern_util.js"); // For stopReplProducer + function assertCmdDoesNotReturnLastCommittedOpTime(testDB, cmdObj, connType, expectSuccess) { const res = testDB.runCommand(cmdObj); assert.eq(expectSuccess ? 1 : 0, res.ok); @@ -109,8 +111,8 @@ let primary = st.rs0.getPrimary(); let secondary = st.rs0.getSecondary(); - assert.commandWorked( - secondary.adminCommand({configureFailPoint: "rsSyncApplyStop", mode: "alwaysOn"})); + st.rs0.awaitLastOpCommitted(); + stopServerReplication(secondary); assert.writeOK(primary.getDB("test").foo.insert({x: 1}, {writeConcern: {w: 1}})); // Sharded collection. @@ -124,8 +126,7 @@ assertReturnsLastCommittedOpTime( secondary.getDB("test"), "unsharded", "sharding-aware shard secondary"); - assert.commandWorked( - secondary.adminCommand({configureFailPoint: "rsSyncApplyStop", mode: "off"})); + restartServerReplication(secondary); // // A config server in a sharded replica set returns lastCommittedOpTime. @@ -136,16 +137,14 @@ primary = st.configRS.getPrimary(); secondary = st.configRS.getSecondary(); - assert.commandWorked( - secondary.adminCommand({configureFailPoint: "rsSyncApplyStop", mode: "alwaysOn"})); + st.configRS.awaitLastOpCommitted(); + stopServerReplication(secondary); assert.writeOK(primary.getDB("config").foo.insert({x: 1}, {writeConcern: {w: 1}})); assertReturnsLastCommittedOpTime(primary.getDB("test"), "foo", "config server primary"); assertReturnsLastCommittedOpTime(secondary.getDB("test"), "foo", "config server secondary"); - assert.commandWorked( - secondary.adminCommand({configureFailPoint: "rsSyncApplyStop", mode: "off"})); - + restartServerReplication(secondary); st.stop(); // |