Exemplo n.º 1
0
def test_reassigning_regression(
    test_repository,
    test_perf_signature,
    test_perf_alert_summary,
    test_perf_framework,
    test_perf_alert_summary_2,
):
    signature1 = test_perf_signature
    signature2 = PerformanceSignature.objects.create(
        repository=test_repository,
        signature_hash=(40 * 'u'),
        framework=test_perf_signature.framework,
        platform=test_perf_signature.platform,
        option_collection=test_perf_signature.option_collection,
        suite='mysuite_2',
        test='mytest_2',
        has_subtests=False,
        last_updated=datetime.datetime.now(),
    )
    s = test_perf_alert_summary

    untriaged_improvement_alert = create_perf_alert(
        summary=s,
        series_signature=signature2,
        is_regression=False,
        status=PerformanceAlert.UNTRIAGED,
    )

    assert s.status == PerformanceAlertSummary.UNTRIAGED

    # reassigning a regression to the initial summary
    # which contains only an improvement
    create_perf_alert(
        summary=s,
        series_signature=signature1,
        related_summary=test_perf_alert_summary_2,
        is_regression=True,
        status=PerformanceAlert.REASSIGNED,
    )

    assert s.status == PerformanceAlertSummary.UNTRIAGED

    # acknowledging only the untriaged improvement alert, mimicking the UI behaviour
    # the regression alert will keep it's status of REASSIGNED
    untriaged_improvement_alert.status = PerformanceAlert.ACKNOWLEDGED
    untriaged_improvement_alert.save()

    s = PerformanceAlertSummary.objects.get(id=1)
    assert s.status == PerformanceAlertSummary.INVESTIGATING
Exemplo n.º 2
0
def test_timestamps_on_alert_and_summaries_inside_code(test_perf_alert_summary,
                                                       test_perf_signature,
                                                       test_perf_signature_2):
    new_alert = create_perf_alert(summary=test_perf_alert_summary,
                                  series_signature=test_perf_signature)

    assert new_alert.created <= new_alert.last_updated
    assert new_alert.first_triaged is None

    # update increases last_updated,
    # but created and first_triaged remain the same
    previous_create = new_alert.created
    previous_update = new_alert.last_updated
    new_alert.starred = True
    new_alert.save()

    assert previous_create == new_alert.created
    assert previous_update < new_alert.last_updated
    assert new_alert.first_triaged is None  # non-human interaction doesn't update this field

    # parent summary doesn't update first_triaged
    # on alert.save()
    parent_summary = new_alert.summary
    parent_summary.refresh_from_db()

    assert parent_summary.first_triaged is None
    # but it does update on
    # alert.timestamp_first_triage()
    new_alert.timestamp_first_triage().save()
    parent_summary.refresh_from_db()

    assert parent_summary.first_triaged is not None
def related_alert(test_perf_alert_summary, test_perf_alert_summary_2,
                  test_perf_signature_2):
    return create_perf_alert(
        summary=test_perf_alert_summary_2,
        series_signature=test_perf_signature_2,
        related_summary=test_perf_alert_summary,
        status=PerformanceAlert.REASSIGNED,
    )
Exemplo n.º 4
0
 def _create_alerts(summary, relevant=True, amount=3):
     alerts = []
     for _ in range(amount):
         alert = create_perf_alert(
             summary=summary,
             series_signature=create_perf_signature(relevant))
         alerts.append(alert)
     return alerts
Exemplo n.º 5
0
def test_summary_status(
    test_repository,
    test_perf_signature,
    test_perf_alert_summary,
    test_perf_framework,
    test_perf_alert_summary_2,
):
    signature1 = test_perf_signature
    signature2 = PerformanceSignature.objects.create(
        repository=test_repository,
        signature_hash=(40 * 'u'),
        framework=test_perf_signature.framework,
        platform=test_perf_signature.platform,
        option_collection=test_perf_signature.option_collection,
        suite='mysuite_2',
        test='mytest_2',
        has_subtests=False,
        last_updated=datetime.datetime.now(),
    )
    s = test_perf_alert_summary

    create_perf_alert(
        summary=s,
        series_signature=signature1,
        is_regression=False,
        # this is the test case
        # ignore downstream and reassigned to update the summary status
        related_summary=test_perf_alert_summary_2,
        status=PerformanceAlert.REASSIGNED,
    )

    create_perf_alert(
        summary=s,
        series_signature=signature2,
        is_regression=False,
        status=PerformanceAlert.ACKNOWLEDGED,
    )

    s = PerformanceAlertSummary.objects.get(id=1)
    assert s.status == PerformanceAlertSummary.IMPROVEMENT
Exemplo n.º 6
0
def test_improvement_summary_status_after_reassigning_regression(
    test_repository,
    test_perf_signature,
    test_perf_alert_summary,
    test_perf_framework,
    test_perf_alert_summary_2,
):
    signature1 = test_perf_signature
    signature2 = PerformanceSignature.objects.create(
        repository=test_repository,
        signature_hash=(40 * 'u'),
        framework=test_perf_signature.framework,
        platform=test_perf_signature.platform,
        option_collection=test_perf_signature.option_collection,
        suite='mysuite_2',
        test='mytest_2',
        has_subtests=False,
        last_updated=datetime.datetime.now(),
    )
    s = test_perf_alert_summary

    create_perf_alert(
        summary=s,
        series_signature=signature1,
        is_regression=False,
        status=PerformanceAlert.ACKNOWLEDGED,
    )

    assert s.status == PerformanceAlertSummary.IMPROVEMENT

    create_perf_alert(
        summary=s,
        series_signature=signature2,
        is_regression=True,
        related_summary=test_perf_alert_summary_2,
        status=PerformanceAlert.REASSIGNED,
    )

    s = PerformanceAlertSummary.objects.get(id=1)
    assert s.status == PerformanceAlertSummary.UNTRIAGED
Exemplo n.º 7
0
def linux_perf_alert(linux_signature,
                     test_perf_alert_summary) -> PerformanceAlert:
    return create_perf_alert(summary=test_perf_alert_summary,
                             series_signature=linux_signature)
def test_perf_alert_onhold(test_perf_signature,
                           test_perf_alert_summary_onhold) -> PerformanceAlert:
    return create_perf_alert(summary=test_perf_alert_summary_onhold,
                             series_signature=test_perf_signature)
Exemplo n.º 9
0
def platform_specific_perf_alert(platform_specific_signature,
                                 test_perf_alert_summary) -> PerformanceAlert:
    return create_perf_alert(summary=test_perf_alert_summary,
                             series_signature=platform_specific_signature)