Exemplo n.º 1
0
    def handle_project(self, project, **options):
        """Report pushlogs not referenced with tests in the project."""

        self.stdout.write("Processing project {0}\n".format(project))

        days_ago = options.get("days_ago")
        if not days_ago:
            raise CommandError(
                "You must supply days_ago."
            )
        numdays = options.get("numdays")
        branches = options.get("branches")

        range = utils.get_day_range(days_ago, numdays)
        if branches:
            branches = branches.split(",")
        else:
            branches = pushlog_refdata.get_all_branches()


        stats = pushlog_refdata.get_not_referenced(
            project,
            range["start"],
            range["stop"],
            branches,
            )
        print json.dumps(stats, indent=4)
        return
Exemplo n.º 2
0
def get_not_referenced(request, project):
    """
    Return the testruns for a project in pushlogs not in datazilla.

    branches: optional.  The comma-separated list of branches to show data
        for.  If not provided, return data for all branches.
    days_ago: required.  Number of days ago for the "start" of the range.
    numdays: optional.  Number of days since days_ago.  Will default to
        "all since days ago"

    """
    if not request.GET.get("days_ago"):
        return HttpResponse(REQUIRE_DAYS_AGO, status=400)
    range = get_range(request)
    branches = request.GET.get("branches", None)
    if branches:
        branches = branches.split(",")

    stats = pushlog_refdata.get_not_referenced(
        project,
        range["start"],
        range["stop"],
        branches,
        )
    return HttpResponse(json.dumps(stats), content_type=API_CONTENT_TYPE)
Exemplo n.º 3
0
    def handle_project(self, project, **options):
        """Report pushlogs not referenced with tests in the project."""

        self.stdout.write("Processing project {0}\n".format(project))

        days_ago = options.get("days_ago")
        if not days_ago:
            raise CommandError("You must supply days_ago.")
        numdays = options.get("numdays")
        branches = options.get("branches")

        range = utils.get_day_range(days_ago, numdays)
        if branches:
            branches = branches.split(",")
        else:
            branches = pushlog_refdata.get_all_branches()

        stats = pushlog_refdata.get_not_referenced(
            project,
            range["start"],
            range["stop"],
            branches,
        )
        print json.dumps(stats, indent=4)
        return
Exemplo n.º 4
0
def get_not_referenced(request, project):
    """
    Return the testruns for a project in pushlogs not in datazilla.

    branches: optional.  The comma-separated list of branches to show data
        for.  If not provided, return data for all branches.
    days_ago: required.  Number of days ago for the "start" of the range.
    numdays: optional.  Number of days since days_ago.  Will default to
        "all since days ago"

    """
    if not request.GET.get("days_ago"):
        return HttpResponse(REQUIRE_DAYS_AGO, status=400)
    range = get_range(request)
    branches = request.GET.get("branches", None)
    if branches:
        branches = branches.split(",")

    stats = pushlog_refdata.get_not_referenced(
        project,
        range["start"],
        range["stop"],
        branches,
    )
    return HttpResponse(json.dumps(stats), content_type=API_CONTENT_TYPE)
Exemplo n.º 5
0
def test_get_not_referenced(plm, plrdm, ptm, monkeypatch):
    """
    Test for runs that have matching revisions in the pushlogs.

    First one has a match, the other two don't
    """

    def mock_plrdm():
        return plrdm
    monkeypatch.setattr(factory, 'get_plrdm', mock_plrdm)

    def mock_plm():
        return plm
    monkeypatch.setattr(factory, 'get_plm', mock_plm)

    data1 = get_pushlog_dict_set()
    plm._insert_branch_pushlogs(
        get_branch_id(plm),
        data1,
        )

    blob = json.dumps(perftest_data())
    ptm.store_test_data(blob)
    ptm.process_objects(1)

    result = pushlog_refdata.get_not_referenced(
        ptm.project,
        startdate=1341451080,
        enddate=1341494822,
        )

    exp_matching = [{
        "push_id": 23046,
        "revisions": [
            "785345035a3b"
            ]}]

    exp_non_matching = [
        {
            "push_id": 23049,
            "revisions": [
                "fbd96a0bcc00",
                "fe305819d2f2"
            ]},
        {
            "push_id": 23052,
            "revisions": [
                "ea890a6eed56",
                "bd74a2949929",
                "5d6c06259bb1",
                "7209f9f14a7d"
            ]},
        ]

    assert result["with_matching_test_run"]["Firefox"]["pushlogs"] == exp_matching
    assert result["without_matching_test_run"]["Firefox"]["pushlogs"] == exp_non_matching
Exemplo n.º 6
0
def test_get_not_referenced(plm, plrdm, ptm, monkeypatch):
    """
    Test for runs that have matching revisions in the pushlogs.

    First one has a match, the other two don't
    """
    def mock_plrdm():
        return plrdm

    monkeypatch.setattr(factory, 'get_plrdm', mock_plrdm)

    def mock_plm():
        return plm

    monkeypatch.setattr(factory, 'get_plm', mock_plm)

    data1 = get_pushlog_dict_set()
    plm._insert_branch_pushlogs(
        get_branch_id(plm),
        data1,
    )

    blob = json.dumps(perftest_data())
    ptm.store_test_data(blob)
    ptm.process_objects(1)

    result = pushlog_refdata.get_not_referenced(
        ptm.project,
        startdate=1341451080,
        enddate=1341494822,
    )

    exp_matching = [{"push_id": 23046, "revisions": ["785345035a3b"]}]

    exp_non_matching = [
        {
            "push_id": 23049,
            "revisions": ["fbd96a0bcc00", "fe305819d2f2"]
        },
        {
            "push_id":
            23052,
            "revisions":
            ["ea890a6eed56", "bd74a2949929", "5d6c06259bb1", "7209f9f14a7d"]
        },
    ]

    assert result["with_matching_test_run"]["Firefox"][
        "pushlogs"] == exp_matching
    assert result["without_matching_test_run"]["Firefox"][
        "pushlogs"] == exp_non_matching