Пример #1
0
def _ChooseTest(anomalies):
    """Chooses a test to use for a bisect job.

  The particular TestMetadata chosen determines the command and metric name that
  is chosen. The test to choose could depend on which of the anomalies has the
  largest regression size.

  Ideally, the choice of bisect bot to use should be based on bisect bot queue
  length, and the choice of metric should be based on regression size and noise
  level.

  However, we don't choose bisect bot and metric independently, since some
  regressions only happen for some tests on some platforms; we should generally
  only bisect with a given bisect bot on a given metric if we know that the
  regression showed up on that platform for that metric.

  Args:
    anomalies: A non-empty list of Anomaly entities.

  Returns:
    An Anomaly entity, or None if no valid entity could be chosen.

  Raises:
    NotBisectableError: The only matching tests are on domains that have been
        excluded for automatic bisects on alert triage.
  """
    if not anomalies:
        return None
    anomalies.sort(cmp=_CompareAnomalyBisectability)
    found_excluded_domain = False
    for anomaly_entity in anomalies:
        if can_bisect.IsValidTestForBisect(
                utils.TestPath(anomaly_entity.GetTestMetadataKey())):
            if can_bisect.DomainIsExcludedFromTriageBisects(
                    anomaly_entity.master_name):
                found_excluded_domain = True
                continue
            return anomaly_entity
    if found_excluded_domain:
        raise NotBisectableError(
            'Did not kick off bisect because only available domains are '
            'excluded from automatic bisects on triage.')
    return None
Пример #2
0
 def testDomainNameIsExcludedForTriageBisects_Match_ReturnsTrue(self):
     namespaced_stored_object.Set(can_bisect.FILE_BUG_BISECT_DENYLIST_KEY,
                                  {'foo': []})
     self.assertTrue(can_bisect.DomainIsExcludedFromTriageBisects('foo'))
Пример #3
0
 def testDomainNameIsExcludedForTriageBisects_NoDomains_ReturnsFalse(self):
     self.assertFalse(can_bisect.DomainIsExcludedFromTriageBisects('foo'))