Ejemplo n.º 1
0
def test_identify_retriggerables_selects_even_single_data_point(
        single_performance_datum, test_perf_alert):
    identify_retriggerables = IdentifyAlertRetriggerables(
        max_data_points=5, time_interval=ONE_DAY_INTERVAL)
    data_points_to_retrigger = identify_retriggerables(test_perf_alert)

    assert len(data_points_to_retrigger) == 1
    assert {4} == set(map(get_key("job_id"), data_points_to_retrigger))
Ejemplo n.º 2
0
def test_identify_retriggerables_selects_all_data_points(
        gapped_performance_data, test_perf_alert):
    identify_retriggerables = IdentifyAlertRetriggerables(
        max_data_points=5, time_interval=ONE_DAY_INTERVAL)
    data_points_to_retrigger = identify_retriggerables(test_perf_alert)

    assert len(data_points_to_retrigger) == 5
    assert {1, 2, 4, 7,
            9} == set(map(get_key("job_id"), data_points_to_retrigger))

    # timestamps are around November 13, 2019
    push_timestamps = list(
        map(get_key("push_timestamp"), data_points_to_retrigger))
    min_push_timestmap = min(push_timestamps)
    max_push_timestamp = max(push_timestamps)

    assert datetime.datetime(year=2013, month=11, day=12) <= min_push_timestmap
    assert max_push_timestamp <= datetime.datetime(year=2013, month=11, day=14)
Ejemplo n.º 3
0
def test_identify_retriggerables_doesnt_select_out_of_range_data_points(
        retriggerable_and_nonretriggerable_performance_data, test_perf_alert):
    identify_retriggerables = IdentifyAlertRetriggerables(
        max_data_points=5, time_interval=ONE_DAY_INTERVAL)
    data_points_to_retrigger = identify_retriggerables(test_perf_alert)

    job_ids_to_retrigger = set(map(get_key("job_id"),
                                   data_points_to_retrigger))

    assert len(data_points_to_retrigger) == 1
    assert NON_RETRIGGERABLE_JOB_ID not in job_ids_to_retrigger
    assert {4} == job_ids_to_retrigger