def before_suite(self, test_report): """Before suite.""" if not self._rs_fixtures: self._add_fixture(self._fixture) utils.remove_if_exists(self._stepdown_permitted_file) utils.remove_if_exists(self._stepping_down_file) self._stepdown_thread = _StepdownThread( self.logger, self._mongos_fixtures, self._rs_fixtures, self._stepdown_interval_secs, self._terminate, self._kill, self._stepdown_permitted_file, self._stepping_down_file, self._wait_for_mongos_retarget) self.logger.info("Starting the stepdown thread.") self._stepdown_thread.start()
def before_suite(self, test_report): """Before suite.""" if not self._rs_fixtures: self._add_fixture(self._fixture) utils.remove_if_exists(self._stepdown_permitted_file) utils.remove_if_exists(self._stepping_down_file) self._stepdown_thread = _StepdownThread( self.logger, self._mongos_fixtures, self._rs_fixtures, self._stepdown_interval_secs, self._stepdown_duration_secs, self._terminate, self._kill, self._stepdown_permitted_file, self._stepping_down_file, self._wait_for_mongos_retarget) self.logger.info("Starting the stepdown thread.") self._stepdown_thread.start()
def mark_test_finished(self): """Signal to the stepdown thread that the current test has finished. This function should be called during after_test(). Calling it causes the wait_for_stepdown_permitted() function to block until the next test gives permission for running stepdowns. """ # It is possible something went wrong during the test's execution and prevented the # "permitted" and "idle_request" files from being created. We therefore don't consider it an # error if they don't exist after the test has finished. utils.remove_if_exists(self.__stepdown_files.permitted) utils.remove_if_exists(self.__stepdown_files.idle_request) utils.remove_if_exists(self.__stepdown_files.idle_ack)
def clean_stepdown_files(self): """Remove the stepdown files.""" utils.remove_if_exists(self._stepdown_permitted_file) utils.remove_if_exists(self._stepping_down_file)
def _stepdown_completed(self): """Delete self._stepping_down_file, if specified.""" utils.remove_if_exists(self._stepping_down_file)