Пример #1
0
def test_missing_symbols_csv(client, settings):
    settings.ENABLE_STORE_MISSING_SYMBOLS = True

    url = reverse("download:missing_symbols_csv")
    response = client.get(url)
    assert response.status_code == 200
    assert response["Content-type"] == "text/csv"
    today = timezone.now()
    yesterday = today - datetime.timedelta(days=1)
    expect_filename = yesterday.strftime("missing-symbols-%Y-%m-%d.csv")
    assert expect_filename in response["Content-Disposition"]

    lines = response.content.splitlines()
    assert lines == [b"debug_file,debug_id,code_file,code_id"]

    # Log at least one line
    views.log_symbol_get_404(
        "xul.pdb",
        "44E4EC8C2F41492B9369D6B9A059577C2",
        "xul.sym",
        code_file="xul.dll",
        code_id="deadbeef",
    )
    views.log_symbol_get_404(
        "rooksdol_x64.dll",
        "58B6E33D262000",
        "rooksdol_x64.dl_",
        code_file="",
        code_id="",
    )

    # It's empty because it reports for yesterday, but we made the
    # only log today.
    response = client.get(url)
    assert response.status_code == 200
    content = response.content.decode("utf-8")
    reader = csv.reader(StringIO(content))
    lines_of_lines = list(reader)
    assert len(lines_of_lines) == 2
    line = lines_of_lines[1]
    assert line[0] == "xul.pdb"
    assert line[1] == "44E4EC8C2F41492B9369D6B9A059577C2"
    assert line[2] == "xul.dll"
    assert line[3] == "deadbeef"
Пример #2
0
def test_missing_symbols_csv(client, settings):
    settings.ENABLE_STORE_MISSING_SYMBOLS = True

    url = reverse('download:missing_symbols_csv')
    response = client.get(url)
    assert response.status_code == 200
    assert response['Content-type'] == 'text/csv'
    today = timezone.now()
    yesterday = today - datetime.timedelta(days=1)
    expect_filename = yesterday.strftime('missing-symbols-%Y-%m-%d.csv')
    assert expect_filename in response['Content-Disposition']

    lines = response.content.splitlines()
    assert lines == [b'debug_file,debug_id,code_file,code_id']

    # Log at least one line
    views.log_symbol_get_404(
        'xul.pdb',
        '44E4EC8C2F41492B9369D6B9A059577C2',
        'xul.sym',
        code_file='xul.dll',
        code_id='deadbeef',
    )
    views.log_symbol_get_404(
        'rooksdol_x64.dll',
        '58B6E33D262000',
        'rooksdol_x64.dl_',
        code_file='',
        code_id='',
    )

    # It's empty because it reports for yesterday, but we made the
    # only log today.
    response = client.get(url)
    assert response.status_code == 200
    content = response.content.decode('utf-8')
    reader = csv.reader(StringIO(content))
    lines_of_lines = list(reader)
    assert len(lines_of_lines) == 2
    line = lines_of_lines[1]
    assert line[0] == 'xul.pdb'
    assert line[1] == '44E4EC8C2F41492B9369D6B9A059577C2'
    assert line[2] == 'xul.dll'
    assert line[3] == 'deadbeef'
Пример #3
0
def test_log_symbol_get_404_metrics(metricsmock):
    views.log_symbol_get_404(
        "xul.pdb",
        "44E4EC8C2F41492B9369D6B9A059577C2",
        "xul.sym",
        code_file="",
        code_id="",
    )
    records = metricsmock.get_records()
    assert len(records) == 1

    # Call it again with the exact same parameters
    views.log_symbol_get_404(
        "xul.pdb",
        "44E4EC8C2F41492B9369D6B9A059577C2",
        "xul.sym",
        code_file="",
        code_id="",
    )
    records = metricsmock.get_records()
    assert len(records) == 1  # unchanged

    # change one parameter slightly
    views.log_symbol_get_404(
        "xul.pdb",
        "44E4EC8C2F41492B9369D6B9A059577C2",
        "xul.sym",
        code_file="",
        code_id="deadbeef",
    )
    records = metricsmock.get_records()
    assert len(records) == 2  # changed