コード例 #1
0
    def test_postprocess_build(self):
        """
        postprocess_build should trigger the importing of the build's artifacts,
        and then schedule any other post-build tasks.
        """
        job = JobFactory.create()
        build = BuildFactory.create(job=job)
        with mock.patch("jenkins.helpers.chain") as chain_mock:
            postprocess_build(build)

        chain_mock.assert_called_once_with(import_build_for_job.s(build.pk))
        chain_mock.return_value.apply_async.assert_called_once()
コード例 #2
0
ファイル: helpers.py プロジェクト: devton/capomastro
def postprocess_build(build):
    """
    Queues importing the specified build from Jenkins including details of the
    artifacts etc.

    When a build completes, execute any tasks that should be executed post
    build.
    """
    post_build_tasks = getattr(settings, "POST_BUILD_TASKS", [])
    additional_tasks = [x.s() for x in post_build_tasks]
    return chain(
        import_build_for_job.s(build.pk), *additional_tasks).apply_async()
コード例 #3
0
ファイル: helpers.py プロジェクト: caiobegotti/capomastro
def postprocess_build(build):
    """
    Queues importing the specified build from Jenkins including details of the
    artifacts etc.

    When a build completes, execute any tasks that should be executed post
    build.
    """
    post_build_tasks = getattr(settings, "POST_BUILD_TASKS", [])
    additional_tasks = [x.s() for x in post_build_tasks]
    return chain(import_build_for_job.s(build.pk),
                 *additional_tasks).apply_async()
コード例 #4
0
ファイル: test_helpers.py プロジェクト: bigkevmcd/capomastro
    def test_postprocess_build(self):
        """
        postprocess_build should trigger the importing of the build's artifacts,
        and then schedule any other post-build tasks.
        """
        job = JobFactory.create()
        build = BuildFactory.create(job=job)
        with mock.patch("jenkins.helpers.chain") as chain_mock:
             postprocess_build(build)

        chain_mock.assert_called_once_with(
            import_build_for_job.s(build.pk))
        chain_mock.return_value.apply_async.assert_called_once()
コード例 #5
0
    def test_postprocess_build_with_additional_postprocess_tasks(self):
        """
        If settings.POST_BUILD_TASKS has a list of additional tasks to be
        executed after a build completes, then we should chain them after we've
        imported the artifacts for the build.
        """
        job = JobFactory.create()
        build = BuildFactory.create(job=job)
        with mock.patch("jenkins.helpers.chain") as chain_mock:
            postprocess_build(build)

        chain_mock.assert_called_once_with(import_build_for_job.s(build.pk),
                                           postbuild_testing_hook.s())
        chain_mock.return_value.apply_async.assert_called_once()
コード例 #6
0
ファイル: test_helpers.py プロジェクト: bigkevmcd/capomastro
    def test_postprocess_build_with_additional_postprocess_tasks(self):
        """
        If settings.POST_BUILD_TASKS has a list of additional tasks to be
        executed after a build completes, then we should chain them after we've
        imported the artifacts for the build.
        """
        job = JobFactory.create()
        build = BuildFactory.create(job=job)
        with mock.patch("jenkins.helpers.chain") as chain_mock:
            postprocess_build(build)

        chain_mock.assert_called_once_with(
            import_build_for_job.s(build.pk),
            postbuild_testing_hook.s())
        chain_mock.return_value.apply_async.assert_called_once()