Esempio n. 1
0
def _GetSubTestsForAlerts(alert_list):
    """Gets subtest dict for list of alerts."""
    subtests = {}
    for alert in alert_list:
        bot_name = alert['master'] + '/' + alert['bot']
        testsuite = alert['testsuite']
        if bot_name not in subtests:
            subtests[bot_name] = {}
        if testsuite not in subtests[bot_name]:
            subtests[bot_name][testsuite] = list_tests.GetSubTests(
                testsuite, [bot_name])
    return subtests
Esempio n. 2
0
def _GetFirstTest(test_suite, bot_path):
    """Gets the first test.

  Args:
    test_suite: Test suite name.
    bot_path: Master and bot name separated by a slash.

  Returns:
    The first test that has rows, otherwise returns None.
  """
    sub_test_tree = list_tests.GetSubTests(test_suite, [bot_path])
    test_parts = []
    while sub_test_tree:
        first_test = sorted(sub_test_tree.keys())[0]
        test_parts.append(first_test)
        if sub_test_tree[first_test]['has_rows']:
            return '/'.join(test_parts)
        sub_test_tree = sub_test_tree[first_test]['sub_tests']
    return None
Esempio n. 3
0
def _GetSubTestDict(test_paths):
  """Gets a dict of test suite path to sub test dict.

  Args:
    test_paths: List of test paths.

  Returns:
    Dictionary of test suite path to sub-test tree (see
    list_tests.GetSubTests).
  """
  subtests = {}
  for test_path in test_paths:
    path_parts = test_path.split('/')
    bot_path = '/'.join(path_parts[0:2])
    test_suite_path = '/'.join(path_parts[0:3])
    test_suite = path_parts[2]
    if test_suite_path not in subtests:
      subtests[test_suite_path] = {}
    subtests[test_suite_path] = list_tests.GetSubTests(test_suite, [bot_path])
  return subtests