From 6be973434ba90a6442c2e5ffecb04b75d08ab5b2 Mon Sep 17 00:00:00 2001 From: Louis Williams Date: Mon, 3 Feb 2020 15:38:46 +0000 Subject: SERVER-45536 index_secondary_commit_after_scan_error.js should wait for the secondary before shutting it down --- .../noPassthrough/index_secondary_commit_after_scan_error.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/jstests/noPassthrough/index_secondary_commit_after_scan_error.js b/jstests/noPassthrough/index_secondary_commit_after_scan_error.js index 55570c3b819..1130044a1b0 100644 --- a/jstests/noPassthrough/index_secondary_commit_after_scan_error.js +++ b/jstests/noPassthrough/index_secondary_commit_after_scan_error.js @@ -74,9 +74,18 @@ IndexBuildTest.waitForIndexBuildToStop(testDB); const exitCode = createIdx(); assert.eq(0, exitCode, 'expected shell to exit successfully'); +// Wait until the secondary process exits. We don't use ReplSetTest.stop() because if the secondary +// hasn't processed the commitIndexBuild oplog entry yet, the node will get signaled to shutdown +// cleanly and return an exit code of 0. +let res; +assert.soon(function() { + res = checkProgram(secondary.pid); + return !res.alive; +}); + // Secondary should crash on receiving the unexpected commitIndexBuild oplog entry. const fassertProcessExitCode = _isWindows() ? MongoRunner.EXIT_ABRUPT : MongoRunner.EXIT_ABORT; -rst.stop(secondary, undefined, {allowedExitCode: fassertProcessExitCode}); +assert.eq(fassertProcessExitCode, res.exitCode); assert(rawMongoProgramOutput().match('Fatal assertion 51101 OperationFailed: Index build:'), 'Index build should have aborted secondary due to unexpected commitIndexBuild oplog entry.'); -- cgit v1.2.1