예제 #1
0
def test_get_metrics_pushlog(mtm, ptm, plm, monkeypatch ):

    setup_data = setup_pushlog_walk_tests(mtm, ptm, plm, monkeypatch, True)

    fail_revision = setup_data['fail_revision']
    skip_revision = setup_data['skip_revision']

    match_count = 0
    metric_values = get_metric_values()

    revision_index = setup_data['target_revision_index']
    revision = setup_data['sample_revisions'][revision_index]

    metrics_pushlog = testdata.get_metrics_pushlog(
        ptm.project, setup_data['branch'], revision,
        pushlog_project=plm.project, pushes_before=5, pushes_after=5,
        test_name='Talos tp5r'
        )

    for push in metrics_pushlog:

        if push['dz_revision']:

            match_count += 1

            last_index = len(push['revisions']) - 1

            assert push['revisions'][last_index]['revision'] == push['dz_revision']

            for data in push['metrics_data']:
                for page_data in data['pages']:
                    metric_data_keys = data['pages'][page_data].keys()
                    assert metric_values.issubset(metric_data_keys)

    assert match_count == 2
예제 #2
0
def test_get_metrics_pushlog(mtm, ptm, plm, monkeypatch):

    setup_data = setup_pushlog_walk_tests(mtm, ptm, plm, monkeypatch, True)

    fail_revision = setup_data['fail_revision']
    skip_revision = setup_data['skip_revision']

    match_count = 0
    metric_values = get_metric_values()

    revision_index = setup_data['target_revision_index']
    revision = setup_data['sample_revisions'][revision_index]

    metrics_pushlog = testdata.get_metrics_pushlog(ptm.project,
                                                   setup_data['branch'],
                                                   revision,
                                                   pushlog_project=plm.project,
                                                   pushes_before=5,
                                                   pushes_after=5,
                                                   test_name='Talos tp5r')

    for push in metrics_pushlog:

        if push['dz_revision']:

            match_count += 1

            last_index = len(push['revisions']) - 1

            assert push['revisions'][last_index]['revision'] == push[
                'dz_revision']

            for data in push['metrics_data']:
                for page_data in data['pages']:
                    metric_data_keys = data['pages'][page_data].keys()
                    assert metric_values.issubset(metric_data_keys)

    assert match_count == 2
예제 #3
0
파일: views.py 프로젝트: davehunt/datazilla
def get_metrics_pushlog(request, project, branch, revision):
    """
    Apply filters and return trend line data for the time period requested.
    """

    #Default to most current version of Firefox
    product_name = request.GET.get("product", "Firefox")
    os_name = request.GET.get("os_name", None)
    os_version = request.GET.get("os_version", None)

    branch_version = request.GET.get("branch_version", None)
    if not branch_version:
        branch_version = testdata.get_default_version(project, branch,
                                                      product_name)

    processor = request.GET.get("processor", None)
    build_type = request.GET.get("build_type", None)
    test_name = request.GET.get("test_name", None)
    page_name = request.GET.get("page_name", None)

    #applies to both before/after, so total of 2*maximum_pushes
    #are allowed
    maximum_pushes = 1000

    #cast pushes_before/pushes_after to an int to scrub user
    #supplied data
    pushes_before = 5
    try:
        pushes_before = int(request.GET.get("pushes_before", pushes_before))
    except ValueError:
        pass

    pushes_after = 5
    try:
        pushes_after = int(request.GET.get("pushes_after", pushes_after))
    except ValueError:
        pass

    #Set maximum limit for pushes before/after
    if pushes_before > maximum_pushes:
        pushes_before = maximum_pushes
    if pushes_after > maximum_pushes:
        pushes_after = maximum_pushes

    pushlog_project = request.GET.get("pushlog_project", None)

    if not test_name:
        return HttpResponse(REQUIRE_TEST_NAME, status=400)

    if not page_name:
        return HttpResponse(REQUIRE_PAGE_NAME, status=400)

    return HttpResponse(
        json.dumps(
            testdata.get_metrics_pushlog(project,
                                         branch,
                                         revision,
                                         product_name=product_name,
                                         os_name=os_name,
                                         os_version=os_version,
                                         branch_version=branch_version,
                                         processor=processor,
                                         build_type=build_type,
                                         test_name=test_name,
                                         page_name=page_name,
                                         pushes_before=pushes_before,
                                         pushes_after=pushes_after,
                                         pushlog_project=pushlog_project)),
        content_type=API_CONTENT_TYPE,
    )
예제 #4
0
파일: views.py 프로젝트: davehunt/datazilla
def get_metrics_pushlog(request, project, branch, revision):
    """
    Apply filters and return trend line data for the time period requested.
    """

    #Default to most current version of Firefox
    product_name = request.GET.get("product", "Firefox")
    os_name = request.GET.get("os_name", None)
    os_version = request.GET.get("os_version", None)

    branch_version = request.GET.get("branch_version", None)
    if not branch_version:
        branch_version = testdata.get_default_version(
            project, branch, product_name
            )

    processor = request.GET.get("processor", None)
    build_type = request.GET.get("build_type", None)
    test_name = request.GET.get("test_name", None)
    page_name = request.GET.get("page_name", None)

    #applies to both before/after, so total of 2*maximum_pushes
    #are allowed
    maximum_pushes = 1000

    #cast pushes_before/pushes_after to an int to scrub user
    #supplied data
    pushes_before =5
    try:
        pushes_before = int(request.GET.get("pushes_before", pushes_before))
    except ValueError:
        pass

    pushes_after = 5
    try:
        pushes_after = int(request.GET.get("pushes_after", pushes_after))
    except ValueError:
        pass

    #Set maximum limit for pushes before/after
    if pushes_before > maximum_pushes:
        pushes_before = maximum_pushes
    if pushes_after > maximum_pushes:
        pushes_after = maximum_pushes

    pushlog_project = request.GET.get("pushlog_project", None)

    if not test_name:
        return HttpResponse(REQUIRE_TEST_NAME, status=400)

    if not page_name:
        return HttpResponse(REQUIRE_PAGE_NAME, status=400)

    return HttpResponse(
        json.dumps(testdata.get_metrics_pushlog(
            project,
            branch,
            revision,
            product_name=product_name,
            os_name=os_name,
            os_version=os_version,
            branch_version=branch_version,
            processor=processor,
            build_type=build_type,
            test_name=test_name,
            page_name=page_name,
            pushes_before=pushes_before,
            pushes_after=pushes_after,
            pushlog_project=pushlog_project
            )),
        content_type=API_CONTENT_TYPE,
        )