예제 #1
0
def test_filter_kinds(kind, expected):
    with patch.object(taskcluster.Queue,
                      "listTaskGroup",
                      new=mocked_listTaskGroup):
        graph = TaskGraph("eShtp2faQgy4iZZOIhXvhw")
    filtered = [t for t in graph.filter_tasks_by_kind(kind=kind)]
    assert len(filtered) == expected
예제 #2
0
def test_tasks_with_failures():
    with patch.object(taskcluster.Queue,
                      "listTaskGroup",
                      new=mocked_listTaskGroup):
        graph = TaskGraph("eShtp2faQgy4iZZOIhXvhw")
    filtered = [t for t in graph.tasks_with_failures()]
    assert len(filtered) == 1
예제 #3
0
def test_graph_total_compute_wall_time():
    with patch.object(taskcluster.Queue,
                      "listTaskGroup",
                      new=mocked_listTaskGroup):
        graph = TaskGraph("eShtp2faQgy4iZZOIhXvhw")
        assert graph.total_compute_wall_time() == datetime.timedelta(
            seconds=1048, microseconds=976000)
예제 #4
0
def test_cache_file():
    tmpdir = tempfile.mkdtemp()
    os.environ['TC_CACHE_DIR'] = tmpdir
    with patch.object(taskcluster.Queue, 'listTaskGroup', new=mocked_listTaskGroup) as mocked_method:
        graph = TaskGraph('eShtp2faQgy4iZZOIhXvhw')
        # and again to hit the cached copy.
        graph = TaskGraph('eShtp2faQgy4iZZOIhXvhw')
        assert repr(graph) == "<TaskGraph eShtp2faQgy4iZZOIhXvhw>"
예제 #5
0
def test_task_names_with_failures():
    with patch.object(taskcluster.Queue,
                      "listTaskGroup",
                      new=mocked_listTaskGroup):
        graph = TaskGraph("eShtp2faQgy4iZZOIhXvhw")
    filtered = [t for t in graph.task_names_with_failures()]
    assert filtered == ["nightly-l10n-linux-nightly-2/opt"]
    assert len(filtered) == 1
예제 #6
0
def test_graph_to_dataframe():
    with patch.object(taskcluster.Queue,
                      "listTaskGroup",
                      new=mocked_listTaskGroup):
        graph = TaskGraph("eShtp2faQgy4iZZOIhXvhw")
        df = graph.to_dataframe()
        assert df.taskid.to_list() == [
            "A-8AqzvvRsqH9b0VHBXYjA", "A-aPcZanRJaxM-IToHyyHw",
            "A0BaQjdkS8Wdy2Ev_1pLgA", "A0VWjOkmRNqkKrRUj83BEA"
        ]
예제 #7
0
def test_graph_states():
    with patch.object(taskcluster.Queue,
                      "listTaskGroup",
                      new=mocked_listTaskGroup):
        graph = TaskGraph("eShtp2faQgy4iZZOIhXvhw")
        assert graph.current_states() == {
            "completed": 3,
            "failed": 1,
            "unscheduled": 1
        }
예제 #8
0
def test_cache_file():
    tmpdir = tempfile.mkdtemp()
    os.environ["TC_CACHE_DIR"] = tmpdir
    with patch.object(taskcluster.Queue,
                      "listTaskGroup",
                      new=mocked_listTaskGroup):
        graph = TaskGraph("eShtp2faQgy4iZZOIhXvhw")
        # and again to hit the cached copy.
        graph = TaskGraph("eShtp2faQgy4iZZOIhXvhw")
        assert repr(graph) == "<TaskGraph eShtp2faQgy4iZZOIhXvhw>"
    del os.environ["TC_CACHE_DIR"]
예제 #9
0
def test_taskgraph_limit_tasks(limit):
    with patch.object(taskcluster.Queue,
                      "listTaskGroup",
                      new=mocked_listTaskGroup):
        graph = TaskGraph("eShtp2faQgy4iZZOIhXvhw", limit=limit)
        found_taskids = [task.taskid for task in graph.tasks()]
        if limit:
            expected_task_ids = TASK_IDS[:limit]
        else:
            expected_task_ids = TASK_IDS

        assert found_taskids == expected_task_ids
예제 #10
0
def test_taskgraph_tasks(limit):
    with patch.object(taskcluster.Queue, 'listTaskGroup', new=mocked_listTaskGroup) as mocked_method:
        graph = TaskGraph('eShtp2faQgy4iZZOIhXvhw')

        found_taskids = list()
        for count, task in enumerate(graph.tasks(limit=limit), start=1):
            found_taskids.append(task.taskid)
        if limit:
            expected_task_ids = TASK_IDS[:limit]
        else:
            expected_task_ids = TASK_IDS

        assert found_taskids == expected_task_ids
        assert count == len(expected_task_ids)
예제 #11
0
def test_graph_completed():
    with patch.object(taskcluster.Queue,
                      "listTaskGroup",
                      new=mocked_listTaskGroup):
        graph = TaskGraph("eShtp2faQgy4iZZOIhXvhw")
        assert graph.latest_finished_time == dateutil.parser.parse(
            "2017-10-26T03:57:42.727Z")
예제 #12
0
def test_graph_started():
    with patch.object(taskcluster.Queue,
                      "listTaskGroup",
                      new=mocked_listTaskGroup):
        graph = TaskGraph("eShtp2faQgy4iZZOIhXvhw")
        assert graph.earliest_start_time == dateutil.parser.parse(
            "2017-10-26T01:03:59.291Z")
예제 #13
0
def test_graph_completed():
    with patch.object(taskcluster.Queue,
                      'listTaskGroup',
                      new=mocked_listTaskGroup) as mocked_method:
        graph = TaskGraph('eShtp2faQgy4iZZOIhXvhw')
        assert graph.latest_finished_time == dateutil.parser.parse(
            '2017-10-26T03:57:42.727Z')
예제 #14
0
def test_graph_started():
    with patch.object(taskcluster.Queue,
                      'listTaskGroup',
                      new=mocked_listTaskGroup) as mocked_method:
        graph = TaskGraph('eShtp2faQgy4iZZOIhXvhw')
        assert graph.earliest_start_time == dateutil.parser.parse(
            '2017-10-26T01:03:59.291Z')
예제 #15
0
def test_kinds():
    with patch.object(taskcluster.Queue,
                      "listTaskGroup",
                      new=mocked_listTaskGroup):
        graph = TaskGraph("eShtp2faQgy4iZZOIhXvhw")
    expected = [
        "nightly-l10n", "repackage-signing", "test", "beetmover-checksums"
    ]
    assert sorted(graph.kinds) == sorted(expected)
예제 #16
0
def test_task_timings():
    with patch.object(taskcluster.Queue,
                      "listTaskGroup",
                      new=mocked_listTaskGroup):
        graph = TaskGraph("eShtp2faQgy4iZZOIhXvhw")
    expected = [
        {
            "duration": 852,
            "kind": "test",
            "platform": "windows10-64-nightly"
        },
        {
            "duration": 196,
            "kind": "repackage-signing",
            "platform": "windows2012-32"
        },
        {
            "duration": 71,
            "kind": "repackage-signing",
            "platform": "osx-cross"
        },
    ]
    timings = [t for t in graph.task_timings()]
    assert timings == expected
예제 #17
0
def test_taskgraph_completed_bool(caching):
    with patch.object(taskcluster.Queue,
                      'listTaskGroup',
                      new=mocked_listTaskGroup) as mocked_method:
        graph = TaskGraph('eShtp2faQgy4iZZOIhXvhw', caching=caching)
        assert graph.completed is False
예제 #18
0
def test_graph_total_compute_time():
    with patch.object(taskcluster.Queue, 'listTaskGroup', new=mocked_listTaskGroup) as mocked_method:
        graph = TaskGraph('eShtp2faQgy4iZZOIhXvhw')
        assert graph.total_compute_time() == datetime.timedelta(seconds=1120, microseconds=101000)
예제 #19
0
def test_graph_states():
    with patch.object(taskcluster.Queue, 'listTaskGroup', new=mocked_listTaskGroup) as mocked_method:
        graph = TaskGraph('eShtp2faQgy4iZZOIhXvhw')
        assert graph.current_states() == {'completed': 3, 'failed': 1, 'unscheduled': 1}
예제 #20
0
def test_taskgraph_completed_bool():
    with patch.object(taskcluster.Queue,
                      "listTaskGroup",
                      new=mocked_listTaskGroup):
        graph = TaskGraph("eShtp2faQgy4iZZOIhXvhw")
        assert graph.completed is False
예제 #21
0
def test_taskgraph_repr():
    with patch.object(taskcluster.Queue,
                      "listTaskGroup",
                      new=mocked_listTaskGroup):
        graph = TaskGraph("eShtp2faQgy4iZZOIhXvhw")
        assert repr(graph) == "<TaskGraph eShtp2faQgy4iZZOIhXvhw>"
예제 #22
0
def test_taskgraph_repr():
    with patch.object(taskcluster.Queue, 'listTaskGroup', new=mocked_listTaskGroup) as mocked_method:
        graph = TaskGraph('eShtp2faQgy4iZZOIhXvhw')
        assert repr(graph) == "<TaskGraph eShtp2faQgy4iZZOIhXvhw>"