From 51414083aef24c27414a46f43ebb67df6fc183e7 Mon Sep 17 00:00:00 2001 From: Ian Boros Date: Mon, 9 Oct 2017 16:59:24 -0400 Subject: SERVER-31472 resmoke returns error code when StepDownThread terminates prematurely --- buildscripts/resmokelib/testing/hooks/stepdown.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'buildscripts') diff --git a/buildscripts/resmokelib/testing/hooks/stepdown.py b/buildscripts/resmokelib/testing/hooks/stepdown.py index f955eb6544d..46f91ab4cd0 100644 --- a/buildscripts/resmokelib/testing/hooks/stepdown.py +++ b/buildscripts/resmokelib/testing/hooks/stepdown.py @@ -3,6 +3,7 @@ Testing hook that periodically makes the primary of a replica set step down. """ from __future__ import absolute_import +import sys import time import threading @@ -64,21 +65,25 @@ class ContinuousStepdown(interface.CustomBehavior): self._stepdown_thread.stop() def before_test(self, test, test_report): - self._check_thread() + self._check_thread(test, test_report) self.logger.info("Resuming the stepdown thread.") self._stepdown_thread.resume() def after_test(self, test, test_report): - self._check_thread() + self._check_thread(test, test_report) self.logger.info("Pausing the stepdown thread.") self._stepdown_thread.pause() self.logger.info("Paused the stepdown thread.") - def _check_thread(self): + def _check_thread(self, test, test_report): if not self._stepdown_thread.is_alive(): msg = "The stepdown thread is not running." self.logger.error(msg) - raise errors.StopExecution(msg) + try: + raise errors.StopExecution(msg) + except errors.StopExecution: + test_report.addError(test, sys.exc_info()) + raise def _add_fixture(self, fixture): if isinstance(fixture, replicaset.ReplicaSetFixture): -- cgit v1.2.1