Example #1
0
 def post_process(self):
     super(PassFailStatus, self).post_process()
     for crit in self.criterias:
         if crit.selector == DataPoint.CUMULATIVE:
             if crit.is_triggered and crit.fail:
                 raise AutomatedShutdown("%s" % crit)
         else:
             if crit.is_triggered and not crit.stop and crit.fail:
                 raise AutomatedShutdown("%s" % crit)
Example #2
0
    def post_process(self):
        self.log.warning(
            'Part of result data might be missed here due to BM API specifics')

        if not self.detach and self.router and not self.test_ended:
            self.router.stop_test()

        if self.results_url:
            if self.browser_open in ('end', 'both'):
                open_browser(self.results_url)

        if self.router and self.router.master:
            full = self.router.master.get_full()
            if 'note' in full and full['note']:
                self.log.warning(
                    "Cloud test has probably failed with message: %s",
                    full['note'])

            for session in full.get('sessions', ()):
                for error in session.get("errors", ()):
                    raise TaurusException(to_json(error))

            if "hasThresholds" in full and full["hasThresholds"]:
                thresholds = self.router.master.get_thresholds()
                for item in thresholds.get('data', []):
                    if item.get('success', None) is False:
                        reason = None
                        for assertion in item.get('assertions', []):
                            if assertion.get('success', None) is False:
                                criterion = assertion.get('field', '')
                                label = assertion.get('label', '')
                                reason = "Cloud failure criterion %r (on label %r) was met" % (
                                    criterion, label)
                                break
                        if reason is None:
                            reason = "Cloud tests failed because failure criteria were met"
                        self.log.warning(reason)
                        raise AutomatedShutdown(reason)

            # if we have captured HARs, let's download them
            for service in self.engine.config.get(Service.SERV, []):
                mod = service.get(
                    'module',
                    TaurusConfigError("No 'module' specified for service"))
                assert isinstance(mod, str), mod
                module = self.engine.instantiate_module(mod)
                if isinstance(module, ServiceStubCaptureHAR):
                    self._download_logs()
                    break

            if "functionalSummary" in full:
                summary = full["functionalSummary"]
                if summary is None or summary.get("isFailed", False):
                    raise AutomatedShutdown("Cloud tests failed")
Example #3
0
 def post_process(self):
     super(PassFailStatus, self).post_process()
     for crit in self.criteria:
         if isinstance(crit, DataCriterion):
             if crit.selector == DataPoint.CUMULATIVE:
                 crit.aggregated_second(self.last_datapoint)
                 if crit.is_triggered and crit.fail:
                     raise AutomatedShutdown("%s" % crit)
             else:
                 if crit.is_triggered and not crit.stop and crit.fail:
                     raise AutomatedShutdown("%s" % crit)
    def post_process(self):
        if self.last_datapoint is not None:
            for crit in self.criteria:
                if isinstance(crit, DataCriterion):
                    if crit.selector == DataPoint.CUMULATIVE:
                        crit.aggregated_second(self.last_datapoint)

        for crit in self.criteria:
            if isinstance(crit, DataCriterion):
                if crit.selector == DataPoint.CUMULATIVE:
                    if crit.is_triggered and crit.fail:
                        self.log.warning("%s", crit)
                        raise AutomatedShutdown("%s" % crit)
                else:
                    if crit.is_triggered and not crit.stop and crit.fail:
                        self.log.warning("%s", crit)
                        raise AutomatedShutdown("%s" % crit)
Example #5
0
 def check(self):
     """
     Interrupt the execution if desired condition occured
     :raise AutomatedShutdown:
     """
     if self.stop and self.is_triggered:
         if self.fail:
             logging.info("Pass/Fail criterion triggered shutdown: %s", self)
             raise AutomatedShutdown("%s" % self)
         else:
             return True
     return False
Example #6
0
 def post_process(self):
     super(PassFailStatus, self).post_process()
     for crit in self.criterias:
         if crit.is_triggered and not crit.stop and crit.fail:
             raise AutomatedShutdown("%s" % crit)