Esempio n. 1
0
def test_download_artifact_badzip(mocked_sleep, tmpdir):
    responses.add(responses.GET, 'https://queue.taskcluster.net/v1/task/FBdocjnAQOW_GJDOfmgjxw/artifacts/public/test_info/code-coverage-grcov.zip', body='NOT A ZIP FILE', status=200, stream=True)  # noqa

    with pytest.raises(BadZipFile, message='File is not a zip file'):
        taskcluster.download_artifact(
            os.path.join(tmpdir.strpath, 'windows_reftest-6_code-coverage-grcov.zip'),
            'FBdocjnAQOW_GJDOfmgjxw',
            'public/test_info/code-coverage-grcov.zip'
        )

    assert mocked_sleep.call_count == 4
Esempio n. 2
0
def test_download_artifact_forbidden(mocked_sleep, tmpdir):
    responses.add(responses.GET, 'https://queue.taskcluster.net/v1/task/FBdocjnAQOW_GJDOfmgjxw/artifacts/public/test_info/code-coverage-grcov.zip', body='xml error...', status=403)  # noqa

    with pytest.raises(requests.exceptions.HTTPError, message='403 Client Error: Forbidden for url: https://taskcluster-artifacts.net/FBdocjnAQOW_GJDOfmgjxw/0/public/test_info/code-coverage-grcov.zip'):  # noqa
        taskcluster.download_artifact(
            os.path.join(tmpdir.strpath, 'windows_reftest-6_code-coverage-grcov.zip'),
            'FBdocjnAQOW_GJDOfmgjxw',
            'public/test_info/code-coverage-grcov.zip'
        )

    assert mocked_sleep.call_count == 4
    def download(self, test_task):
        chunk_name = taskcluster.get_chunk(test_task['task']['metadata']['name'])
        platform_name = taskcluster.get_platform(test_task['task']['metadata']['name'])
        test_task_id = test_task['status']['taskId']

        for artifact in taskcluster.get_task_artifacts(test_task_id):
            if not any(n in artifact['name'] for n in ['code-coverage-grcov.zip', 'code-coverage-jsvm.zip']):
                continue

            artifact_path = self.generate_path(platform_name, chunk_name, artifact)
            taskcluster.download_artifact(artifact_path, test_task_id, artifact['name'])
            logger.info('%s artifact downloaded' % artifact_path)
Esempio n. 4
0
def test_download_artifact_badzip(mocked_sleep, tmpdir):
    responses.add(
        responses.GET,
        'https://queue.taskcluster.net/v1/task/FBdocjnAQOW_GJDOfmgjxw/artifacts/public/test_info/code-coverage-grcov.zip',
        body='NOT A ZIP FILE',
        status=200,
        stream=True)  # noqa

    with pytest.raises(BadZipFile, message='File is not a zip file'):
        taskcluster.download_artifact(
            os.path.join(tmpdir.strpath,
                         'windows_reftest-6_code-coverage-grcov.zip'),
            'FBdocjnAQOW_GJDOfmgjxw',
            'public/test_info/code-coverage-grcov.zip')

    assert mocked_sleep.call_count == 4
Esempio n. 5
0
def test_download_artifact_badzip(mocked_sleep, mock_taskcluster, tmpdir):
    responses.add(
        responses.GET,
        "https://queue.taskcluster.net/v1/task/FBdocjnAQOW_GJDOfmgjxw/artifacts/public%2Ftest_info%2Fcode-coverage-grcov.zip",  # noqa
        body="NOT A ZIP FILE",
        status=200,
        stream=True,
    )

    with pytest.raises(BadZipFile, match="File is not a zip file"):
        taskcluster.download_artifact(
            os.path.join(tmpdir.strpath, "windows_reftest-6_code-coverage-grcov.zip"),
            "FBdocjnAQOW_GJDOfmgjxw",
            "public/test_info/code-coverage-grcov.zip",
        )

    assert mocked_sleep.call_count == 4
def test_download_artifact_badzip(mock_taskcluster, tmpdir, mock_tenacity):
    responses.add(
        responses.GET,
        "https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/FBdocjnAQOW_GJDOfmgjxw/artifacts/public%2Ftest_info%2Fcode-coverage-grcov.zip",
        body="NOT A ZIP FILE",
        status=200,
        stream=True,
    )

    with pytest.raises(BadZipFile, match="File is not a zip file"):
        taskcluster.download_artifact(
            os.path.join(tmpdir.strpath, "windows_reftest-6_code-coverage-grcov.zip"),
            "FBdocjnAQOW_GJDOfmgjxw",
            "public/test_info/code-coverage-grcov.zip",
        )

    assert len(responses.calls) == 5
Esempio n. 7
0
    def download(self, test_task):
        chunk_name = taskcluster.get_chunk(
            test_task["task"]["metadata"]["name"])
        platform_name = taskcluster.get_platform(
            test_task["task"]["metadata"]["name"])
        test_task_id = test_task["status"]["taskId"]

        for artifact in taskcluster.get_task_artifacts(test_task_id):
            if not any(n in artifact["name"] for n in
                       ["code-coverage-grcov.zip", "code-coverage-jsvm.zip"]):
                continue

            artifact_path = self.generate_path(platform_name, chunk_name,
                                               artifact)
            taskcluster.download_artifact(artifact_path, test_task_id,
                                          artifact["name"])
            logger.info("%s artifact downloaded" % artifact_path)
Esempio n. 8
0
def test_download_artifact_forbidden(mocked_sleep, tmpdir):
    responses.add(
        responses.GET,
        'https://queue.taskcluster.net/v1/task/FBdocjnAQOW_GJDOfmgjxw/artifacts/public/test_info/code-coverage-grcov.zip',
        body='xml error...',
        status=403)  # noqa

    with pytest.raises(
            requests.exceptions.HTTPError,
            message=
            '403 Client Error: Forbidden for url: https://taskcluster-artifacts.net/FBdocjnAQOW_GJDOfmgjxw/0/public/test_info/code-coverage-grcov.zip'
    ):  # noqa
        taskcluster.download_artifact(
            os.path.join(tmpdir.strpath,
                         'windows_reftest-6_code-coverage-grcov.zip'),
            'FBdocjnAQOW_GJDOfmgjxw',
            'public/test_info/code-coverage-grcov.zip')

    assert mocked_sleep.call_count == 4
Esempio n. 9
0
def test_download_artifact_forbidden(mocked_sleep, mock_taskcluster, tmpdir):
    responses.add(
        responses.GET,
        "https://queue.taskcluster.net/v1/task/FBdocjnAQOW_GJDOfmgjxw/artifacts/public%2Ftest_info%2Fcode-coverage-grcov.zip",  # noqa
        body="xml error...",
        status=403,
    )

    with pytest.raises(
        requests.exceptions.HTTPError,
        match="403 Client Error: Forbidden for url: https://queue.taskcluster.net/v1/task/FBdocjnAQOW_GJDOfmgjxw/artifacts/public%2Ftest_info%2Fcode-coverage-grcov.zip",  # noqa
    ):
        taskcluster.download_artifact(
            os.path.join(tmpdir.strpath, "windows_reftest-6_code-coverage-grcov.zip"),
            "FBdocjnAQOW_GJDOfmgjxw",
            "public/test_info/code-coverage-grcov.zip",
        )

    assert mocked_sleep.call_count == 4
Esempio n. 10
0
def test_download_artifact_forbidden(mock_taskcluster, tmpdir, mock_tenacity):
    responses.add(
        responses.GET,
        "https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/FBdocjnAQOW_GJDOfmgjxw/artifacts/public%2Ftest_info%2Fcode-coverage-grcov.zip",
        body="xml error...",
        status=403,
    )

    with pytest.raises(
        requests.exceptions.HTTPError,
        match="403 Client Error: Forbidden for url: https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/FBdocjnAQOW_GJDOfmgjxw/artifacts/public%2Ftest_info%2Fcode-coverage-grcov.zip",  # noqa
    ):
        taskcluster.download_artifact(
            os.path.join(tmpdir.strpath, "windows_reftest-6_code-coverage-grcov.zip"),
            "FBdocjnAQOW_GJDOfmgjxw",
            "public/test_info/code-coverage-grcov.zip",
        )

    assert len(responses.calls) == 5