summaryrefslogtreecommitdiff
path: root/jstests/replsets/disallow_adding_initialized_node1.js
diff options
context:
space:
mode:
authorSpencer Jackson <spencer.jackson@mongodb.com>2016-12-13 17:53:24 -0500
committerSpencer Jackson <spencer.jackson@mongodb.com>2016-12-16 12:15:17 -0500
commite55c4b224f1260e4d163be7a71db2737be298559 (patch)
treef0f814f50a8fce0564cc3880d4feb47ccb7c3707 /jstests/replsets/disallow_adding_initialized_node1.js
parentd92892f7ad0a83252c788c08646d05ac46cfeabc (diff)
downloadmongo-e55c4b224f1260e4d163be7a71db2737be298559.tar.gz
SERVER-26525: Factor out identical checkLog functions
Diffstat (limited to 'jstests/replsets/disallow_adding_initialized_node1.js')
-rw-r--r--jstests/replsets/disallow_adding_initialized_node1.js15
1 files changed, 3 insertions, 12 deletions
diff --git a/jstests/replsets/disallow_adding_initialized_node1.js b/jstests/replsets/disallow_adding_initialized_node1.js
index e641e89bc28..910e71c7d8c 100644
--- a/jstests/replsets/disallow_adding_initialized_node1.js
+++ b/jstests/replsets/disallow_adding_initialized_node1.js
@@ -3,8 +3,10 @@
// Initialize two replica sets A and B with the same name: A_0; B_0
// Add B_0 to the replica set A. This operation should fail on replica set A should fail on
// detecting an inconsistent replica set ID in the heartbeat response metadata from B_0.
+
(function() {
'use strict';
+ load("jstests/libs/check_log.js");
var name = 'disallow_adding_initialized_node1';
var replSetA = new ReplSetTest({
@@ -55,20 +57,9 @@
assert.eq(primaryB, newPrimaryB);
// Mismatch replica set IDs in heartbeat responses should be logged.
- var checkLog = function(node, msg) {
- assert.soon(function() {
- var logMessages = assert.commandWorked(node.adminCommand({getLog: 'global'})).log;
- for (var i = 0; i < logMessages.length; i++) {
- if (logMessages[i].indexOf(msg) != -1) {
- return true;
- }
- }
- return false;
- }, 'Did not see a log entry containing the following message: ' + msg, 60000, 1000);
- };
var msgB = "replica set IDs do not match, ours: " + configB.settings.replicaSetId +
"; remote node's: " + configA.settings.replicaSetId;
- checkLog(primaryB, msgB);
+ checkLog.contains(primaryB, msgB);
var statusA = assert.commandWorked(primaryA.adminCommand({replSetGetStatus: 1}));
var statusB = assert.commandWorked(primaryB.adminCommand({replSetGetStatus: 1}));