def test_get_json_blob_bad_id(ptm, client, monkeypatch):
    """Attempt to fetch the JSON for an ID that doesn't exist."""
    create_date_based_data(ptm, monkeypatch)
    url = "/{0}/refdata/objectstore/json_blob/22/".format(ptm.project)
    response = client.get(url, status=404)

    exp = "Id not found: 22"

    assert response.text == exp
Ejemplo n.º 2
0
def test_get_json_blob_bad_id(ptm, client, monkeypatch):
    """Attempt to fetch the JSON for an ID that doesn't exist."""
    create_date_based_data(ptm, monkeypatch)
    url = "/{0}/refdata/objectstore/json_blob/22/".format(ptm.project)
    response = client.get(url, status=404)

    exp = "Id not found: 22"

    assert response.text == exp
Ejemplo n.º 3
0
def test_get_runs_by_branch_show_test_runs_false(ptm, client, monkeypatch):
    """
    Test that with show_runs not present that you get the counts only
    """
    dates = [
        utils.get_day_range(5)["start"],
        utils.get_day_range(4)["start"],
        utils.get_day_range(3)["start"],
        ]
    create_date_based_data(ptm, monkeypatch, dates)
    url = "/{0}/refdata/perftest/runs_by_branch/?days_ago=6".format(ptm.project)
    response = client.get(url)

    exp = ["count"]
    assert response.json["Mozilla-Aurora"].keys() == exp
Ejemplo n.º 4
0
def test_get_runs_by_branch_show_test_runs_true(ptm, plm, client, monkeypatch):
    """
    Test that with show_runs=True that you get the runs and counts
    """
    def mock_plm():
        return plm
    monkeypatch.setattr(factory, 'get_plm', mock_plm)

    dates = [
        utils.get_day_range(5)["start"],
        utils.get_day_range(4)["start"],
        utils.get_day_range(3)["start"],
        ]
    create_date_based_data(ptm, monkeypatch, dates)
    url = "/{0}/refdata/perftest/runs_by_branch/?show_test_runs=True&days_ago=6".format(ptm.project)
    response = client.get(url)

    exp = set(["count", "limit", "total_count", "test_runs"])
    assert set(response.json["Mozilla-Aurora"].keys()) == exp
Ejemplo n.º 5
0
def test_get_error_list(ptm, client, monkeypatch):
    """Get a list of errors from the objectstore in a date range."""

    dates = [
        utils.get_day_range(5)["start"],
        utils.get_day_range(4)["start"],
        utils.get_day_range(3)["start"],
    ]
    create_date_based_data(ptm, monkeypatch, dates)
    url = "/{0}/refdata/objectstore/error_list/?days_ago=4".format(ptm.project)
    response = client.get(url)

    exp = [{
        u"date_loaded": dates[2],
        u"id": 2,
        u"test_run_id": None,
        u"worker_id": None,
        u"processed_flag": u"ready",
        u"error_msg": u"Malformed JSON"
    }]
    assert response.json == exp
def test_get_error_list(ptm, client, monkeypatch):
    """Get a list of errors from the objectstore in a date range."""

    dates = [
        utils.get_day_range(5)["start"],
        utils.get_day_range(4)["start"],
        utils.get_day_range(3)["start"],
        ]
    create_date_based_data(ptm, monkeypatch, dates)
    url = "/{0}/refdata/objectstore/error_list/?days_ago=4".format(ptm.project)
    response = client.get(url)

    exp = [{
            u"date_loaded": dates[2],
            u"id": 2,
            u"test_run_id": None,
            u"worker_id": None,
            u"processed_flag": u"ready",
            u"error_msg": u"Malformed JSON"
            }]
    assert response.json == exp
Ejemplo n.º 7
0
def test_get_error_count(ptm, client, monkeypatch):
    """Get a count of errors from the objectstore in a date range."""

    dates = [
        utils.get_day_range(5)["start"],
        utils.get_day_range(4)["start"],
        utils.get_day_range(3)["start"],
    ]
    create_date_based_data(ptm, monkeypatch, dates)
    url = "/{0}/refdata/objectstore/error_count/?days_ago=6".format(
        ptm.project)
    response = client.get(url)

    exp = [{
        "count": 1,
        "message": "Malformed JSON"
    }, {
        "count": 1,
        "message": "Other"
    }]

    assert response.json == exp
def test_get_error_count(ptm, client, monkeypatch):
    """Get a count of errors from the objectstore in a date range."""

    dates = [
        utils.get_day_range(5)["start"],
        utils.get_day_range(4)["start"],
        utils.get_day_range(3)["start"],
        ]
    create_date_based_data(ptm, monkeypatch, dates)
    url = "/{0}/refdata/objectstore/error_count/?days_ago=6".format(ptm.project)
    response = client.get(url)

    exp = [
        {
            "count": 1,
            "message": "Malformed JSON"
            },
        {
            "count": 1,
            "message": "Other"
            }]

    assert response.json == exp
Ejemplo n.º 9
0
def test_get_json_blob(ptm, client, monkeypatch):
    """Fetch JSON for an ID that has good JSON."""
    dates = [
        utils.get_day_range(5)["start"],
        utils.get_day_range(4)["start"],
        utils.get_day_range(3)["start"],
    ]
    create_date_based_data(ptm, monkeypatch, dates)
    url = "/{0}/refdata/objectstore/json_blob/3/".format(ptm.project)
    response = client.get(url)

    exp_tm = {
        u"platform": u"x86_64",
        u"osversion": u"Ubuntu 11.10",
        u"os": u"linux",
        u"name": u"qm-pxp01"
    }

    exp_tb = {
        u"version": u"14.0a2",
        u"revision": u"785345035a3b",
        u"name": u"one",
        u"branch": u"Mozilla-Aurora",
    }
    exp_tr = {
        u"date": dates[1],
        u"suite": u"Talos tp5r",
        u"options": {
            u"responsiveness": u"false",
            u"tpmozafterpaint": u"false",
            u"tpdelay": u"",
            u"tpchrome": u"true",
            u"tppagecycles": u"1",
            u"tpcycles": u"3",
            u"tprender": u"false",
            u"shutdown": u"true",
            u"rss": u"true"
        }
    }
    exp_ra = {
        u"three.com": [789.0, 705.0, 739.0],
        u"one.com": [789.0, 705.0, 739.0],
        u"two.com": [789.0, 705.0, 739.0]
    }
    exp_res = {
        u"three.com": [789.0, 705.0, 739.0],
        u"one.com": [789.0, 705.0, 739.0],
        u"two.com": [789.0, 705.0, 739.0]
    }

    rj = response.json

    assert rj['json_blob']['test_machine'] == exp_tm

    # these ids can vary
    del (rj['json_blob']['test_build']['id'])

    assert rj['json_blob']['test_build'] == exp_tb
    assert rj['json_blob']['testrun'] == exp_tr
    assert rj['json_blob']['results_aux'] == exp_ra
    assert rj['json_blob']['results'] == exp_res
Ejemplo n.º 10
0
def test_get_json_blob(ptm, client, monkeypatch):
    """Fetch JSON for an ID that has good JSON."""
    dates = [
        utils.get_day_range(5)["start"],
        utils.get_day_range(4)["start"],
        utils.get_day_range(3)["start"],
        ]
    create_date_based_data(ptm, monkeypatch, dates)
    url = "/{0}/refdata/objectstore/json_blob/3/".format(ptm.project)
    response = client.get(url)

    exp_tm = {
        u"platform": u"x86_64",
        u"osversion": u"Ubuntu 11.10",
        u"os": u"linux",
        u"name": u"qm-pxp01"
        }

    exp_tb = {
        u"version": u"14.0a2",
        u"revision": u"785345035a3b",
        u"name": u"one",
        u"branch": u"Mozilla-Aurora",
        }
    exp_tr = {
        u"date": dates[1],
        u"suite": u"Talos tp5r",
        u"options": {
            u"responsiveness": u"false",
            u"tpmozafterpaint": u"false",
            u"tpdelay": u"",
            u"tpchrome": u"true",
            u"tppagecycles": u"1",
            u"tpcycles": u"3",
            u"tprender": u"false",
            u"shutdown": u"true",
            u"rss": u"true"
        }}
    exp_ra = {
        u"three.com": [
            789.0,
            705.0,
            739.0
        ],
        u"one.com": [
            789.0,
            705.0,
            739.0
        ],
        u"two.com": [
            789.0,
            705.0,
            739.0
        ]}
    exp_res = {
        u"three.com": [
            789.0,
            705.0,
            739.0
        ],
        u"one.com": [
            789.0,
            705.0,
            739.0
        ],
        u"two.com": [
            789.0,
            705.0,
            739.0
        ]}

    rj = response.json

    assert rj['json_blob']['test_machine'] == exp_tm

    # these ids can vary
    del(rj['json_blob']['test_build']['id'])

    assert rj['json_blob']['test_build'] == exp_tb
    assert rj['json_blob']['testrun'] == exp_tr
    assert rj['json_blob']['results_aux'] == exp_ra
    assert rj['json_blob']['results'] == exp_res