def _setUp(self): logging.info("Setting up test in '%(filename)s'", dict(filename=self._filename())) self._allocation.runOnEveryHost(self._setUpHost, "Setting up host") try: getattr(self._test, 'setUp', lambda: None)() except: logging.exception( "Failed setting up test in '%(filename)s'", dict(filename=self._filename())) suite.outputExceptionStackTrace() raise
def _setUp(self): logging.info("Setting up test in '%(filename)s'", dict(filename=self._filename())) self._allocation.runOnEveryHost(self._setUpHost, "Setting up host") try: getattr(self._test, 'setUp', lambda: None)() except: logging.exception( "Failed setting up test in '%(filename)s'", dict(filename=self._filename())) suite.outputExceptionStackTrace() raise
def _tearDown(self): logging.info("Tearing down test in '%(filename)s'", dict(filename=self._filename())) try: getattr(self._test, 'tearDown', lambda: None)() except: logging.exception( "Failed tearing down test in '%(filename)s'", dict(filename=self._filename())) suite.outputExceptionStackTrace() raise tearDownHost = getattr(self._test, 'tearDownHost', lambda x: x) self._allocation.runOnEveryHost(tearDownHost, "Tearing down host")
def _tearDown(self): logging.info("Tearing down test in '%(filename)s'", dict(filename=self._filename())) try: getattr(self._test, 'tearDown', lambda: None)() except: logging.exception( "Failed tearing down test in '%(filename)s'", dict(filename=self._filename())) suite.outputExceptionStackTrace() raise tearDownHost = getattr(self._test, 'tearDownHost', lambda x: x) self._allocation.runOnEveryHost(tearDownHost, "Tearing down host")
def _run(self): logging.progress("Running test in '%(filename)s'", dict(filename=self._filename())) try: self._test.run() logging.success( "Test completed successfully, in '%(filename)s', with %(asserts)d successfull asserts", dict(filename=self._filename(), asserts=suite.successfulTSAssertCount())) print ".:1: Test passed" except: logging.exception("Test failed, in '%(filename)s'", dict(filename=self._filename())) suite.outputExceptionStackTrace() raise
def _run(self): logging.progress("Running test in '%(filename)s'", dict(filename=self._filename())) try: self._test.run() suite.anamnesis['testSucceeded'] = True logging.success( "Test completed successfully, in '%(filename)s', with %(asserts)d successfull asserts", dict(filename=self._filename(), asserts=suite.successfulTSAssertCount())) print ".:1: Test passed" except: suite.anamnesis['testFailed'] = True logging.exception("Test failed, in '%(filename)s'", dict(filename=self._filename())) suite.outputExceptionStackTrace() raise
def _tearDown(self): areThereHostsToTearDown = bool(self._hosts) if not areThereHostsToTearDown: return logging.info("Tearing down test in '%(filename)s'", dict(filename=self._filename())) try: getattr(self._test, 'tearDown', lambda: None)() except: logging.exception("Failed tearing down test in '%(filename)s'", dict(filename=self._filename())) suite.outputExceptionStackTrace() raise tearDownHost = getattr(self._test, 'tearDownHost', lambda x: x) for allocation in self._allocations.values(): allocation.runOnEveryHost(tearDownHost, "Tearing down host")
def _testTimedOut(self): logging.error( "Timeout: test is running for more than %(seconds)ds, calling 'onTimeout' and arming additional timer. " "You might need to increase the scenario ABORT_TEST_TIMEOUT", dict(seconds=self._testTimeout)) timeoutthread.TimeoutThread(self._onTimeoutCallbackTimeout, self._killSelf) timeoutthread.TimeoutThread(self._onTimeoutCallbackTimeout + 5, self._killSelfHard) try: getattr(self._test, 'onTimeout', lambda: None)() except: logging.exception( "Failed 'onTimeout' callback for test in '%(filename)s', will commit suicide now", dict(filename=self._filename())) suite.outputExceptionStackTrace() else: logging.info("'onTimeout' completed, will commit suicide now") self._killSelf() time.sleep(2) self._killSelfHard()
def _setUp(self): logging.info("Setting up test in '%(filename)s'", dict(filename=self._filename())) if self.RUN_ON_DETACHED: self._test._clusters = self._setUpDetachedClusters() else: for allocation in self._allocations.values(): allocation.runOnEveryHost(self._setUpHost, "Setting up host") if not hasattr(self._test, '_clusters'): self._test._clusters = self._getClusters() try: getattr(self._test, 'setUp', lambda: None)() except: logging.exception("Failed setting up test in '%(filename)s'", dict(filename=self._filename())) suite.outputExceptionStackTrace() raise
def _testTimedOut(self): logging.error( "Timeout: test is running for more than %(seconds)ds, calling 'onTimeout' and arming " " additional timer. " "You might need to increase the scenario ABORT_TEST_TIMEOUT", dict(seconds=self._testTimeout)) timeoutthread.TimeoutThread(self._onTimeoutCallbackTimeout, self._killSelf) timeoutthread.TimeoutThread(self._onTimeoutCallbackTimeout + 5, self._killSelfHard) try: getattr(self._test, 'onTimeout', lambda: None)() except: logging.exception( "Failed 'onTimeout' callback for test in '%(filename)s', commiting suicide.", dict(filename=self._filename())) suite.outputExceptionStackTrace() else: logging.info("'onTimeout' completed, will commit suicide now") self._cleanUp() self._killSelf() time.sleep(2) self._killSelfHard()