Example #1
0
def get_push_health_test_failures(push, repository_ids):
    # query for jobs for the last two weeks excluding today
    # find tests that have failed in the last 14 days
    # this is very cache-able for reuse on other pushes.
    option_map = OptionCollection.objects.get_option_collection_map()
    push_date = push.time.date()
    intermittent_history, cache_key = get_history(
        4,
        push_date,
        intermittent_history_days,
        option_map,
        repository_ids)
    fixed_by_commit_history, cache_key = get_history(
        2,
        push_date,
        fixed_by_commit_history_days,
        option_map,
        repository_ids)
    push_failures = get_push_failures(push, option_map)
    filtered_push_failures = [
        failure for failure in push_failures if filter_failure(failure)
    ]

    set_classifications(
        filtered_push_failures,
        intermittent_history,
        fixed_by_commit_history,
    )
    set_matching_passed_jobs(filtered_push_failures, push)
    return get_grouped(filtered_push_failures)
Example #2
0
def get_test_failures(push, repository_ids):
    # query for jobs for the last two weeks excluding today
    # find tests that have failed in the last 14 days
    # this is very cache-able for reuse on other pushes.
    option_map = OptionCollection.objects.get_option_collection_map()
    push_date = push.time.date()
    intermittent_history, cache_key = get_history(
        4,
        push_date,
        intermittent_history_days,
        option_map,
        repository_ids)
    fixed_by_commit_history, cache_key = get_history(
        2,
        push_date,
        fixed_by_commit_history_days,
        option_map,
        repository_ids)
    push_failures, unsupported_jobs = get_current_test_failures(push, option_map)
    filtered_push_failures = [
        failure for failure in push_failures if filter_failure(failure)
    ]

    set_classifications(
        filtered_push_failures,
        intermittent_history,
        fixed_by_commit_history,
    )
    set_matching_passed_jobs(filtered_push_failures, push)

    failures = get_grouped(filtered_push_failures)
    failures['unsupported'] = unsupported_jobs

    return failures
Example #3
0
def get_test_failures(
    push,
    jobs,
    parent_push=None,
):
    logger.debug('Getting test failures for push: {}'.format(push.id))
    # query for jobs for the last two weeks excluding today
    # find tests that have failed in the last 14 days
    # this is very cache-able for reuse on other pushes.

    repository_ids = REPO_GROUPS['trunk']
    # option_map is used to map platforms for the job.option_collection_hash
    option_map = OptionCollection.objects.get_option_collection_map()
    push_date = push.time.date()
    intermittent_history = get_history(
        4, push_date, intermittent_history_days, option_map, repository_ids
    )
    fixed_by_commit_history = get_history(
        2, push_date, fixed_by_commit_history_days, option_map, repository_ids
    )

    # ``push_failures`` are tests that have FailureLine records created by out Log Parser.
    #     These are tests we are able to show to examine to see if we can determine they are
    #     intermittent.  If they are not, we tell the user they need investigation.
    # These are failures ONLY for the current push, not relative to history.
    push_failures = get_current_test_failures(push, option_map, jobs)
    filtered_push_failures = [failure for failure in push_failures if filter_failure(failure)]

    # Based on the intermittent and FixedByCommit history, set the appropriate classification
    # where we think each test falls.
    set_classifications(
        filtered_push_failures,
        intermittent_history,
        fixed_by_commit_history,
    )
    failures = get_grouped(filtered_push_failures)

    if parent_push:
        # Since there is a parent_push, we want to mark all failures with whether or not they also
        # exist in the parent.
        parent_push_jobs = get_test_failure_jobs(parent_push)
        parent_test_failures = get_test_failures(parent_push, parent_push_jobs)
        for classification, failure_group in failures.items():
            parent_failure_group = parent_test_failures[classification]
            failure_keys = {fail['key'] for fail in failure_group}
            parent_failure_keys = {fail['key'] for fail in parent_failure_group}
            both = list(failure_keys.intersection(parent_failure_keys))

            for failure in failure_group:
                failure['failedInParent'] = failure['key'] in both

    return failures
Example #4
0
def get_test_failures(push, repository_ids):
    logger.info('Getting test failures for push: {}'.format(push.id))
    # query for jobs for the last two weeks excluding today
    # find tests that have failed in the last 14 days
    # this is very cache-able for reuse on other pushes.

    # option_map is used to map platforms for the job.option_collection_hash
    option_map = OptionCollection.objects.get_option_collection_map()
    push_date = push.time.date()
    intermittent_history, cache_key = get_history(
        4,
        push_date,
        intermittent_history_days,
        option_map,
        repository_ids)
    fixed_by_commit_history, cache_key = get_history(
        2,
        push_date,
        fixed_by_commit_history_days,
        option_map,
        repository_ids)

    # ``push_failures`` are tests that have FailureLine records created by out Log Parser.
    #     These are tests we are able to show to examine to see if we can determine they are
    #     intermittent.  If they are not, we tell the user they need investigation.
    # ``unsupported_jobs`` are jobs that either don't have an ``*_errorsummary.log`` file,
    #     or have one that does not have enough information for us to interpret.  So we place
    #     these jobs into the "Unsupported" category.  The jobs either need to change either at
    #     the test-level or harness level so we can interpret them.  In some cases, the Treeherder
    #     code here can be updated to interpret information we don't currently handle.
    # These are failures ONLY for the current push, not relative to history.
    push_failures, unsupported_jobs = get_current_test_failures(push, option_map)
    filtered_push_failures = [
        failure for failure in push_failures if filter_failure(failure)
    ]

    # Based on the intermittent and FixedByCommit history, set the appropriate classification
    # where we think each test falls.
    set_classifications(
        filtered_push_failures,
        intermittent_history,
        fixed_by_commit_history,
    )
    # If we have failed tests that have also passed, we gather them both.  This helps us determine
    # if a job is intermittent based on the current push results.
    set_matching_passed_jobs(filtered_push_failures, push)

    failures = get_grouped(filtered_push_failures)
    failures['unsupported'] = unsupported_jobs

    return failures
Example #5
0
def get_test_failures(
    push,
    jobs,
    result_status=set(),
):
    logger.debug('Getting test failures for push: {}'.format(push.id))
    # query for jobs for the last two weeks excluding today
    # find tests that have failed in the last 14 days
    # this is very cache-able for reuse on other pushes.
    result = 'pass'

    if not len(jobs):
        return ('none', get_grouped([]))

    repository_ids = REPO_GROUPS['trunk']
    # option_map is used to map platforms for the job.option_collection_hash
    option_map = OptionCollection.objects.get_option_collection_map()
    push_date = push.time.date()
    intermittent_history = get_history(
        4, push_date, intermittent_history_days, option_map, repository_ids
    )
    fixed_by_commit_history = get_history(
        2, push_date, fixed_by_commit_history_days, option_map, repository_ids
    )
    investigatedTests = InvestigatedTests.objects.filter(push=push)

    # ``push_failures`` are tests that have FailureLine records created by our Log Parser.
    #     These are tests we are able to show to examine to see if we can determine they are
    #     intermittent.  If they are not, we tell the user they need investigation.
    # These are failures ONLY for the current push, not relative to history.
    push_failures = get_current_test_failures(push, option_map, jobs, investigatedTests)
    filtered_push_failures = [failure for failure in push_failures if filter_failure(failure)]

    # Based on the intermittent and FixedByCommit history, set the appropriate classification
    # where we think each test falls.
    set_classifications(
        filtered_push_failures,
        intermittent_history,
        fixed_by_commit_history,
    )

    failures = get_grouped(filtered_push_failures)

    if len(failures['needInvestigation']):
        result = 'fail'
    elif 'unknown' in result_status:
        result = 'unknown'

    return (result, failures)