def test_find_build_info_no_task(self):
     self.info_fetcher.index.findTask = Mock(
         side_effect=fetch_build_info.TaskclusterFailure
     )
     with self.assertRaises(errors.BuildInfoNotFound):
         self.info_fetcher.find_build_info(
             create_push('123456789', 1))
Esempio n. 2
0
 def test_find_build_info_no_task(self):
     self.info_fetcher.index.findTask = Mock(
         side_effect=fetch_build_info.TaskclusterFailure
     )
     with self.assertRaises(errors.BuildInfoNotFound):
         self.info_fetcher.find_build_info(
             create_push('123456789', 1))
Esempio n. 3
0
def test_range_for_inbounds_with_expand(mocker):
    fetch_config = create_config('firefox', 'linux', 64, 'x86_64')
    jpush_class = mocker.patch('mozregression.fetch_build_info.JsonPushes')
    pushes = [create_push('b', 1), create_push('d', 2), create_push('f', 3)]
    jpush = mocker.Mock(pushes_within_changes=mocker.Mock(return_value=pushes),
                        spec=JsonPushes)
    jpush_class.return_value = jpush

    check_expand = mocker.patch(
        'mozregression.build_range.BuildRange.check_expand')

    build_range.range_for_inbounds(fetch_config, 'a', 'e', expand=10)

    check_expand.assert_called_once_with(10,
                                         build_range.tc_range_before,
                                         build_range.tc_range_after,
                                         interrupt=None)
Esempio n. 4
0
def test_range_for_inbounds_with_expand(mocker):
    fetch_config = create_config('firefox', 'linux', 64, 'x86_64')
    jpush_class = mocker.patch('mozregression.fetch_build_info.JsonPushes')
    pushes = [create_push('b', 1), create_push('d', 2), create_push('f', 3)]
    jpush = mocker.Mock(
        pushes_within_changes=mocker.Mock(return_value=pushes),
        spec=JsonPushes
    )
    jpush_class.return_value = jpush

    check_expand = mocker.patch(
        'mozregression.build_range.BuildRange.check_expand')

    build_range.range_for_inbounds(fetch_config, 'a', 'e', expand=10)

    check_expand.assert_called_once_with(
        10, build_range.tc_range_before, build_range.tc_range_after,
        interrupt=None)
Esempio n. 5
0
def test_range_for_inbounds(mocker):
    fetch_config = create_config('firefox', 'linux', 64, 'x86_64')
    jpush_class = mocker.patch('mozregression.fetch_build_info.JsonPushes')
    pushes = [create_push('b', 1), create_push('d', 2), create_push('f', 3)]
    jpush = mocker.Mock(pushes_within_changes=mocker.Mock(return_value=pushes),
                        spec=JsonPushes)
    jpush_class.return_value = jpush

    b_range = build_range.range_for_inbounds(fetch_config, 'a', 'e')

    jpush_class.assert_called_once_with(branch='mozilla-inbound')
    jpush.pushes_within_changes.assert_called_once_with('a', 'e')
    assert isinstance(b_range, build_range.BuildRange)
    assert len(b_range) == 3

    b_range.build_info_fetcher.find_build_info = lambda v: v
    assert b_range[0] == pushes[0]
    assert b_range[1] == pushes[1]
    assert b_range[2] == pushes[2]

    b_range.future_build_infos[0].date_or_changeset() == 'b'
Esempio n. 6
0
def test_range_for_inbounds(mocker):
    fetch_config = create_config('firefox', 'linux', 64)
    jpush_class = mocker.patch('mozregression.fetch_build_info.JsonPushes')
    pushes = [create_push('b', 1), create_push('d', 2), create_push('f', 3)]
    jpush = mocker.Mock(
        pushes_within_changes=mocker.Mock(return_value=pushes),
        spec=JsonPushes
    )
    jpush_class.return_value = jpush

    b_range = build_range.range_for_inbounds(fetch_config, 'a', 'e')

    jpush_class.assert_called_once_with(branch='mozilla-inbound')
    jpush.pushes_within_changes.assert_called_once_with('a', 'e')
    assert isinstance(b_range, build_range.BuildRange)
    assert len(b_range) == 3

    b_range.build_info_fetcher.find_build_info = lambda v: v
    assert b_range[0] == pushes[0]
    assert b_range[1] == pushes[1]
    assert b_range[2] == pushes[2]

    b_range.future_build_infos[0].date_or_changeset() == 'b'
Esempio n. 7
0
    def test_find_build_info(self):
        # patch task cluster related stuff

        def find_task(route):
            return {'taskId': 'task1'}

        def status(task_id):
            return {
                "status": {
                    "runs": [{
                        "state": "completed",
                        "runId": 0,
                        "resolved": '2015-06-01T22:13:02.115Z'
                    }]
                }
            }

        def list_artifacts(taskid, run_id):
            return {
                "artifacts": [
                    # return two valid artifact names
                    {
                        'name': 'firefox-42.0a1.en-US.linux-x86_64.tar.bz2'
                    },
                    {
                        'name': 'firefox-42.0a1.en-US.linux-x86_64.txt'
                    },
                ]
            }

        def build_url(bname, taskid, run_id, name):
            return 'http://' + name

        self.info_fetcher.index.findTask = find_task
        self.info_fetcher.queue.status = status
        self.info_fetcher.queue.listArtifacts = list_artifacts
        self.info_fetcher.queue.buildUrl = build_url
        self.info_fetcher._fetch_txt_info = \
            Mock(return_value={'changeset': '123456789'})

        result = self.info_fetcher.find_build_info(create_push('123456789', 1))
        self.assertEqual(result.build_url,
                         'http://firefox-42.0a1.en-US.linux-x86_64.tar.bz2')
        self.assertEqual(result.changeset, '123456789')
        self.assertEqual(result.build_type, "inbound")
    def test_get_valid_build_no_artifacts(self):
        def find_task(route):
            return {'taskId': 'task1'}

        def status(task_id):
            return {"status": {"runs": [{
                "state": "completed",
                "runId": 0,
                "resolved": '2015-06-01T22:13:02.115Z'
            }]}}

        def list_artifacts(taskid, run_id):
            return {"artifacts": []}

        self.info_fetcher.index.findTask = find_task
        self.info_fetcher.queue.status = status
        self.info_fetcher.queue.listArtifacts = list_artifacts

        with self.assertRaises(errors.BuildInfoNotFound):
            self.info_fetcher.find_build_info(
                create_push('123456789', 1))
Esempio n. 9
0
    def test_get_valid_build_no_artifacts(self):
        def find_task(route):
            return {'taskId': 'task1'}

        def status(task_id):
            return {"status": {"runs": [{
                "state": "completed",
                "runId": 0,
                "resolved": '2015-06-01T22:13:02.115Z'
            }]}}

        def list_artifacts(taskid, run_id):
            return {"artifacts": []}

        self.info_fetcher.index.findTask = find_task
        self.info_fetcher.queue.status = status
        self.info_fetcher.queue.listArtifacts = list_artifacts

        with self.assertRaises(errors.BuildInfoNotFound):
            self.info_fetcher.find_build_info(
                create_push('123456789', 1))
    def test_find_build_info(self):
        # patch task cluster related stuff

        def find_task(route):
            return {'taskId': 'task1'}

        def status(task_id):
            return {"status": {"runs": [{
                "state": "completed",
                "runId": 0,
                "resolved": '2015-06-01T22:13:02.115Z'
            }]}}

        def list_artifacts(taskid, run_id):
            return {"artifacts": [
                # return two valid artifact names
                {'name': 'firefox-42.0a1.en-US.linux-x86_64.tar.bz2'},
                {'name': 'firefox-42.0a1.en-US.linux-x86_64.txt'},
            ]}

        def build_url(bname, taskid, run_id, name):
            return 'http://' + name

        self.info_fetcher.index.findTask = find_task
        self.info_fetcher.queue.status = status
        self.info_fetcher.queue.listArtifacts = list_artifacts
        self.info_fetcher.queue.buildUrl = build_url
        self.info_fetcher._fetch_txt_info = \
            Mock(return_value={'changeset': '123456789'})

        result = self.info_fetcher.find_build_info(
            create_push('123456789', 1))
        self.assertEqual(result.build_url,
                         'http://firefox-42.0a1.en-US.linux-x86_64.tar.bz2')
        self.assertEqual(result.changeset, '123456789')
        self.assertEqual(result.build_type, "inbound")