summaryrefslogtreecommitdiff
path: root/jstests/replsets/drain.js
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2015-10-20 13:32:50 -0400
committerBenety Goh <benety@mongodb.com>2015-10-21 21:43:50 -0400
commitfb06c1447621f410f9cbcd9947f3fa5bfa898b37 (patch)
treec617512fa01cb3f13fa59519bf197c6d53b80b5d /jstests/replsets/drain.js
parentce438c5dcac373a272eb7dc80ce8d37a74394e4d (diff)
downloadmongo-fb06c1447621f410f9cbcd9947f3fa5bfa898b37.tar.gz
SERVER-20979 added ReplicationCoordinator::waitForMemberState() and waitForDrainFinish()
also added subcommands to replSetTest to access these functions from JS tests
Diffstat (limited to 'jstests/replsets/drain.js')
-rw-r--r--jstests/replsets/drain.js21
1 files changed, 19 insertions, 2 deletions
diff --git a/jstests/replsets/drain.js b/jstests/replsets/drain.js
index 1d73411ae3f..d5e189f0345 100644
--- a/jstests/replsets/drain.js
+++ b/jstests/replsets/drain.js
@@ -77,14 +77,31 @@
assert.eq(ErrorCodes.NotMasterOrSecondary, res.code,
"find failed with unexpected error code: " + tojson(res));
secondary.slaveOk = false;
-
+
+ assert.commandFailedWithCode(
+ secondary.adminCommand({
+ replSetTest: 1,
+ waitForDrainFinish: 5000,
+ }),
+ ErrorCodes.ExceededTimeLimit,
+ 'replSetTest waitForDrainFinish should time out when draining is not allowed to complete'
+ );
+
// Allow draining to complete
- jsTestLog('Enabling fail point on new primary to allow draining to complete');
+ jsTestLog('Disabling fail point on new primary to allow draining to complete');
assert.commandWorked(
secondary.getDB("admin").runCommand({configureFailPoint: 'rsSyncApplyStop', mode: 'off'}),
'failed to disable fail point on new primary');
primary = replSet.getPrimary();
+ assert.commandWorked(
+ secondary.adminCommand({
+ replSetTest: 1,
+ waitForDrainFinish: 5000,
+ }),
+ 'replSetTest waitForDrainFinish should work when draining is allowed to complete'
+ );
+
// Ensure new primary is writable
jsTestLog('New primary should be writable after draining is complete');
assert.writeOK(primary.getDB("foo").flag.insert({sentinel:1}));