当前位置: 首页>>代码示例>>Python>>正文


Python PostBuildPluginsRunner.run方法代码示例

本文整理汇总了Python中atomic_reactor.plugin.PostBuildPluginsRunner.run方法的典型用法代码示例。如果您正苦于以下问题:Python PostBuildPluginsRunner.run方法的具体用法?Python PostBuildPluginsRunner.run怎么用?Python PostBuildPluginsRunner.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在atomic_reactor.plugin.PostBuildPluginsRunner的用法示例。


在下文中一共展示了PostBuildPluginsRunner.run方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_pulp_dedup_layers

# 需要导入模块: from atomic_reactor.plugin import PostBuildPluginsRunner [as 别名]
# 或者: from atomic_reactor.plugin.PostBuildPluginsRunner import run [as 别名]
def test_pulp_dedup_layers(unsupported, unlink_exc, tmpdir, existing_layers, should_raise,
                           monkeypatch, subprocess_exceptions, reactor_config_map):
    tasker, workflow = prepare(
        check_repo_retval=0,
        existing_layers=existing_layers,
        subprocess_exceptions=subprocess_exceptions, unsupported=unsupported)
    monkeypatch.setenv('SOURCE_SECRET_PATH', str(tmpdir))
    with open(os.path.join(str(tmpdir), "pulp.cer"), "wt") as cer:
        cer.write("pulp certificate\n")
    with open(os.path.join(str(tmpdir), "pulp.key"), "wt") as key:
        key.write("pulp key\n")

    if unlink_exc is not None:
        (flexmock(os).should_receive('unlink')
         .and_raise(unlink_exc))

    runner = PostBuildPluginsRunner(tasker, workflow, [{
        'name': PulpPushPlugin.key,
        'args': {
            'pulp_registry_name': 'test'
        }}])

    if reactor_config_map:
        workflow.plugin_workspace[ReactorConfigPlugin.key] = {}
        workflow.plugin_workspace[ReactorConfigPlugin.key][WORKSPACE_CONF_KEY] =\
            ReactorConfig({'version': 1, 'pulp': {'name': 'test', 'auth': {}}})

    runner.run()
    assert PulpPushPlugin.key is not None
    top_layer, crane_images = workflow.postbuild_results[PulpPushPlugin.key]
    images = [i.to_str() for i in crane_images]
    assert "registry.example.com/image-name1:latest" in images
    assert "registry.example.com/prefix/image-name2:latest" in images
    assert "registry.example.com/image-name3:asd" in images
    assert top_layer == 'foo'
开发者ID:projectatomic,项目名称:atomic-reactor,代码行数:37,代码来源:test_pulp.py

示例2: test_pulp_source_secret

# 需要导入模块: from atomic_reactor.plugin import PostBuildPluginsRunner [as 别名]
# 或者: from atomic_reactor.plugin.PostBuildPluginsRunner import run [as 别名]
def test_pulp_source_secret(tmpdir, check_repo_retval, should_raise, monkeypatch):
    tasker, workflow = prepare(check_repo_retval=check_repo_retval)
    monkeypatch.setenv('SOURCE_SECRET_PATH', str(tmpdir))
    with open(os.path.join(str(tmpdir), "pulp.cer"), "wt") as cer:
        cer.write("pulp certificate\n")
    with open(os.path.join(str(tmpdir), "pulp.key"), "wt") as key:
        key.write("pulp key\n")

    runner = PostBuildPluginsRunner(tasker, workflow, [{
        'name': PulpPushPlugin.key,
        'args': {
            'pulp_registry_name': 'test'
        }}])

    if should_raise:
        with pytest.raises(Exception):
            runner.run()

        return

    runner.run()
    assert PulpPushPlugin.key is not None
    _, crane_images = workflow.postbuild_results[PulpPushPlugin.key]
    images = [i.to_str() for i in crane_images]
    assert "registry.example.com/image-name1:latest" in images
    assert "registry.example.com/prefix/image-name2:latest" in images
    assert "registry.example.com/image-name3:asd" in images
开发者ID:vrutkovs,项目名称:atomic-reactor,代码行数:29,代码来源:test_pulp.py

示例3: test_cp_built_image_to_nfs

# 需要导入模块: from atomic_reactor.plugin import PostBuildPluginsRunner [as 别名]
# 或者: from atomic_reactor.plugin.PostBuildPluginsRunner import run [as 别名]
def test_cp_built_image_to_nfs(tmpdir, docker_tasker, dest_dir):
    mountpoint = tmpdir.join("mountpoint")

    def fake_check_call(cmd):
        assert cmd == [
            "mount",
            "-t", "nfs",
            "-o", "nolock",
            NFS_SERVER_PATH,
            mountpoint,
        ]
    flexmock(subprocess, check_call=fake_check_call)
    workflow = DockerBuildWorkflow({"provider": "git", "uri": "asd"}, "test-image")
    workflow.builder = X()
    workflow.exported_image_sequence.append({"path": os.path.join(str(tmpdir),
                                                             EXPORTED_SQUASHED_IMAGE_NAME)})
    open(workflow.exported_image_sequence[-1].get("path"), 'a').close()

    runner = PostBuildPluginsRunner(
        docker_tasker,
        workflow,
        [{
            'name': CopyBuiltImageToNFSPlugin.key,
            'args': {
                "nfs_server_path": NFS_SERVER_PATH,
                "dest_dir": dest_dir,
                "mountpoint": str(mountpoint),
            }
        }]
    )
    runner.run()
    if dest_dir is None:
        assert os.path.isfile(os.path.join(str(mountpoint), EXPORTED_SQUASHED_IMAGE_NAME))
    else:
        assert os.path.isfile(os.path.join(str(mountpoint), dest_dir, EXPORTED_SQUASHED_IMAGE_NAME))
开发者ID:Akasurde,项目名称:atomic-reactor,代码行数:37,代码来源:test_cp_built_image_to_nfs.py

示例4: test_pulp

# 需要导入模块: from atomic_reactor.plugin import PostBuildPluginsRunner [as 别名]
# 或者: from atomic_reactor.plugin.PostBuildPluginsRunner import run [as 别名]
def test_pulp(tmpdir, check_repo_retval, should_raise):
    tasker = DockerTasker()
    workflow = DockerBuildWorkflow(SOURCE, "test-image")
    setattr(workflow, 'builder', X())
    setattr(workflow.builder, 'source', X())
    setattr(workflow.builder.source, 'dockerfile_path', None)
    setattr(workflow.builder.source, 'path', None)
    setattr(workflow, 'tag_conf', X())
    setattr(workflow.tag_conf, 'images', [ImageName(repo="image-name1"),
                                          ImageName(namespace="prefix",
                                                    repo="image-name2"),
                                          ImageName(repo="image-name3", tag="asd")])

    # Mock dockpulp and docker
    dockpulp.Pulp = flexmock(dockpulp.Pulp)
    dockpulp.Pulp.registry='registry.example.com'
    (flexmock(dockpulp.imgutils).should_receive('get_metadata')
     .with_args(object)
     .and_return([{'id': 'foo'}]))
    (flexmock(dockpulp.imgutils).should_receive('get_versions')
     .with_args(object)
     .and_return({'id': '1.6.0'}))
    (flexmock(dockpulp.imgutils).should_receive('check_repo')
     .and_return(check_repo_retval))
    (flexmock(dockpulp.Pulp)
     .should_receive('set_certs')
     .with_args(object, object))
    (flexmock(dockpulp.Pulp)
     .should_receive('push_tar_to_pulp')
     .with_args(object, object)
     .and_return([1, 2, 3]))
    (flexmock(dockpulp.Pulp)
     .should_receive('watch_tasks')
     .with_args(list))
    mock_docker()

    os.environ['SOURCE_SECRET_PATH'] = str(tmpdir)
    with open(os.path.join(str(tmpdir), "pulp.cer"), "wt") as cer:
        cer.write("pulp certificate\n")
    with open(os.path.join(str(tmpdir), "pulp.key"), "wt") as key:
        key.write("pulp key\n")

    runner = PostBuildPluginsRunner(tasker, workflow, [{
        'name': PulpPushPlugin.key,
        'args': {
            'pulp_registry_name': 'test'
        }}])

    if should_raise:
        with pytest.raises(Exception) as exc:
            runner.run()

        return

    runner.run()
    assert PulpPushPlugin.key is not None
    images = [i.to_str() for i in workflow.postbuild_results[PulpPushPlugin.key]]
    assert "registry.example.com/image-name1" in images
    assert "registry.example.com/prefix/image-name2" in images
    assert "registry.example.com/image-name3:asd" in images
开发者ID:TomasTomecek,项目名称:atomic-reactor,代码行数:62,代码来源:test_pulp.py

示例5: test_compare_components_plugin

# 需要导入模块: from atomic_reactor.plugin import PostBuildPluginsRunner [as 别名]
# 或者: from atomic_reactor.plugin.PostBuildPluginsRunner import run [as 别名]
def test_compare_components_plugin(tmpdir, caplog, base_from_scratch, mismatch, exception, fail):
    workflow = mock_workflow(tmpdir)
    worker_metadatas = mock_metadatas()

    # example data has 2 log items before component item hence output[2]
    component = worker_metadatas['ppc64le']['output'][2]['components'][0]
    if mismatch:
        component['version'] = 'bacon'
    if exception:
        workflow.plugin_workspace[ReactorConfigPlugin.key] = {
            WORKSPACE_CONF_KEY: ReactorConfig(
                {'version': 1, 'package_comparison_exceptions': [component['name']]}
            )
        }

    workflow.postbuild_results[PLUGIN_FETCH_WORKER_METADATA_KEY] = worker_metadatas
    workflow.builder.base_from_scratch = base_from_scratch

    runner = PostBuildPluginsRunner(
        None,
        workflow,
        [{
            'name': PLUGIN_COMPARE_COMPONENTS_KEY,
            "args": {}
        }]
    )

    if fail and not base_from_scratch:
        with pytest.raises(PluginFailedException):
            runner.run()
    else:
        runner.run()
        if base_from_scratch:
            log_msg = "Skipping comparing components: unsupported for FROM-scratch images"
            assert log_msg in caplog.text
开发者ID:projectatomic,项目名称:atomic-reactor,代码行数:37,代码来源:test_compare_components.py

示例6: test_pulp_tag_basic

# 需要导入模块: from atomic_reactor.plugin import PostBuildPluginsRunner [as 别名]
# 或者: from atomic_reactor.plugin.PostBuildPluginsRunner import run [as 别名]
def test_pulp_tag_basic(tmpdir, monkeypatch, v1_image_ids, should_raise, caplog):
    tasker, workflow = prepare(v1_image_ids)
    monkeypatch.setenv('SOURCE_SECRET_PATH', str(tmpdir))
    with open(os.path.join(str(tmpdir), "pulp.cer"), "wt") as cer:
        cer.write("pulp certificate\n")
    with open(os.path.join(str(tmpdir), "pulp.key"), "wt") as key:
        key.write("pulp key\n")

    runner = PostBuildPluginsRunner(tasker, workflow, [{
        'name': PLUGIN_PULP_TAG_KEY,
        'args': {
            'pulp_registry_name': 'test'
        }}])

    if should_raise:
        with pytest.raises(PluginFailedException):
            runner.run()
        return

    msg = None
    expected_results = {}
    for platform, v1_image_id in v1_image_ids.items():
        if v1_image_id:
            msg = "tagging v1-image-id ppc64le_v1_image_id for platform ppc64le"
            expected_results = {
                'redhat-image-name1': {'tag': 'latest:ppc64le_v1_image_id'},
            }
            break

    results = runner.run()
    if msg:
        assert msg in caplog.text()
    else:
        assert "tagging v1-image-id" not in caplog.text()
    assert results['pulp_tag'] == expected_results
开发者ID:vrutkovs,项目名称:atomic-reactor,代码行数:37,代码来源:test_pulp_tag.py

示例7: test_compress

# 需要导入模块: from atomic_reactor.plugin import PostBuildPluginsRunner [as 别名]
# 或者: from atomic_reactor.plugin.PostBuildPluginsRunner import run [as 别名]
    def test_compress(self, tmpdir, method, load_exported_image, extension):
        if MOCK:
            mock_docker()

        tasker = DockerTasker()
        workflow = DockerBuildWorkflow({'provider': 'git', 'uri': 'asd'}, 'test-image')
        workflow.builder = X()
        exp_img = os.path.join(str(tmpdir), 'img.tar')

        if load_exported_image:
            tarfile.open(exp_img, mode='w').close()
            workflow.exported_image_sequence.append({'path': exp_img})

        runner = PostBuildPluginsRunner(
            tasker,
            workflow,
            [{
                'name': CompressPlugin.key,
                'args': {
                    'method': method,
                    'load_exported_image': load_exported_image,
                },
            }]
        )

        runner.run()

        compressed_img = os.path.join(
            workflow.source.tmpdir,
            EXPORTED_COMPRESSED_IMAGE_NAME_TEMPLATE.format(extension))
        assert os.path.exists(compressed_img)
        assert workflow.exported_image_sequence[-1]['path'] == compressed_img
开发者ID:Akasurde,项目名称:atomic-reactor,代码行数:34,代码来源:test_compress.py

示例8: test_pulp_dedup_layers

# 需要导入模块: from atomic_reactor.plugin import PostBuildPluginsRunner [as 别名]
# 或者: from atomic_reactor.plugin.PostBuildPluginsRunner import run [as 别名]
def test_pulp_dedup_layers(
        tmpdir, existing_layers, should_raise, monkeypatch, subprocess_exceptions):
    tasker, workflow = prepare(
        check_repo_retval=0,
        existing_layers=existing_layers,
        subprocess_exceptions=subprocess_exceptions)
    monkeypatch.setenv('SOURCE_SECRET_PATH', str(tmpdir))
    with open(os.path.join(str(tmpdir), "pulp.cer"), "wt") as cer:
        cer.write("pulp certificate\n")
    with open(os.path.join(str(tmpdir), "pulp.key"), "wt") as key:
        key.write("pulp key\n")

    runner = PostBuildPluginsRunner(tasker, workflow, [{
        'name': PulpPushPlugin.key,
        'args': {
            'pulp_registry_name': 'test'
        }}])

    runner.run()
    assert PulpPushPlugin.key is not None
    top_layer, crane_images = workflow.postbuild_results[PulpPushPlugin.key]
    images = [i.to_str() for i in crane_images]
    assert "registry.example.com/image-name1:latest" in images
    assert "registry.example.com/prefix/image-name2:latest" in images
    assert "registry.example.com/image-name3:asd" in images
    assert top_layer == 'foo'
开发者ID:vrutkovs,项目名称:atomic-reactor,代码行数:28,代码来源:test_pulp.py

示例9: test_pulp_service_account_secret

# 需要导入模块: from atomic_reactor.plugin import PostBuildPluginsRunner [as 别名]
# 或者: from atomic_reactor.plugin.PostBuildPluginsRunner import run [as 别名]
def test_pulp_service_account_secret(tmpdir, monkeypatch, reactor_config_map):
    tasker, workflow = prepare()
    monkeypatch.setenv('SOURCE_SECRET_PATH', str(tmpdir) + "/not-used")
    with open(os.path.join(str(tmpdir), "pulp.cer"), "wt") as cer:
        cer.write("pulp certificate\n")
    with open(os.path.join(str(tmpdir), "pulp.key"), "wt") as key:
        key.write("pulp key\n")

    runner = PostBuildPluginsRunner(tasker, workflow, [{
        'name': PulpPushPlugin.key,
        'args': {
            'pulp_registry_name': 'test',
            'pulp_secret_path': str(tmpdir),
        }}])

    if reactor_config_map:
        workflow.plugin_workspace[ReactorConfigPlugin.key] = {}
        workflow.plugin_workspace[ReactorConfigPlugin.key][WORKSPACE_CONF_KEY] =\
            ReactorConfig({'version': 1,
                           'pulp': {'name': 'test',
                                    'auth': {'ssl_certs_dir': str(tmpdir)}}})

    runner.run()
    _, crane_images = workflow.postbuild_results[PulpPushPlugin.key]
    images = [i.to_str() for i in crane_images]
    assert "registry.example.com/image-name1:latest" in images
    assert "registry.example.com/prefix/image-name2:latest" in images
    assert "registry.example.com/image-name3:asd" in images
开发者ID:projectatomic,项目名称:atomic-reactor,代码行数:30,代码来源:test_pulp.py

示例10: test_pulp_source_secret

# 需要导入模块: from atomic_reactor.plugin import PostBuildPluginsRunner [as 别名]
# 或者: from atomic_reactor.plugin.PostBuildPluginsRunner import run [as 别名]
def test_pulp_source_secret(tmpdir, check_repo_retval, should_raise, monkeypatch,
                            reactor_config_map):
    tasker, workflow = prepare(check_repo_retval=check_repo_retval)
    monkeypatch.setenv('SOURCE_SECRET_PATH', str(tmpdir))
    with open(os.path.join(str(tmpdir), "pulp.cer"), "wt") as cer:
        cer.write("pulp certificate\n")
    with open(os.path.join(str(tmpdir), "pulp.key"), "wt") as key:
        key.write("pulp key\n")

    runner = PostBuildPluginsRunner(tasker, workflow, [{
        'name': PulpPushPlugin.key,
        'args': {
            'pulp_registry_name': 'test'
        }}])

    if reactor_config_map:
        workflow.plugin_workspace[ReactorConfigPlugin.key] = {}
        workflow.plugin_workspace[ReactorConfigPlugin.key][WORKSPACE_CONF_KEY] =\
            ReactorConfig({'version': 1, 'pulp': {'name': 'test',
                                                  'auth': {'ssl_certs_dir': str(tmpdir)}}})

    if should_raise:
        with pytest.raises(Exception):
            runner.run()

        return

    runner.run()
    assert PulpPushPlugin.key is not None
    _, crane_images = workflow.postbuild_results[PulpPushPlugin.key]
    images = [i.to_str() for i in crane_images]
    assert "registry.example.com/image-name1:latest" in images
    assert "registry.example.com/prefix/image-name2:latest" in images
    assert "registry.example.com/image-name3:asd" in images
开发者ID:projectatomic,项目名称:atomic-reactor,代码行数:36,代码来源:test_pulp.py

示例11: build_docker_image

# 需要导入模块: from atomic_reactor.plugin import PostBuildPluginsRunner [as 别名]
# 或者: from atomic_reactor.plugin.PostBuildPluginsRunner import run [as 别名]
    def build_docker_image(self):
        """
        build docker image

        :return: BuildResults
        """
        self.builder = InsideBuilder(self.source, self.image)
        try:
            # time to run pre-build plugins, so they can access cloned repo
            logger.info("running pre-build plugins")
            prebuild_runner = PreBuildPluginsRunner(self.builder.tasker, self, self.prebuild_plugins_conf,
                                                    plugin_files=self.plugin_files)
            try:
                prebuild_runner.run()
            except PluginFailedException as ex:
                logger.error("one or more prebuild plugins failed: %s", ex)
                raise

            build_result = self.builder.build()
            self.build_logs = build_result.logs

            self.build_failed = build_result.is_failed()

            if not build_result.is_failed():
                self.built_image_inspect = self.builder.inspect_built_image()

            # run prepublish plugins
            prepublish_runner = PrePublishPluginsRunner(self.builder.tasker, self, self.prepublish_plugins_conf,
                                                        plugin_files=self.plugin_files)
            try:
                prepublish_runner.run()
            except PluginFailedException as ex:
                logger.error("one or more prepublish plugins failed: %s", ex)
                raise

            if not build_result.is_failed():
                for registry in self.push_conf.docker_registries:
                    self.builder.push_built_image(registry.uri,
                                                  insecure=registry.insecure)

            postbuild_runner = PostBuildPluginsRunner(self.builder.tasker, self, self.postbuild_plugins_conf,
                                                      plugin_files=self.plugin_files)
            try:
                postbuild_runner.run()
            except PluginFailedException as ex:
                logger.error("one or more postbuild plugins failed: %s", ex)
                raise

            return build_result
        finally:
            self.source.remove_tmpdir()

            exit_runner = ExitPluginsRunner(self.builder.tasker, self,
                                            self.exit_plugins_conf,
                                            plugin_files=self.plugin_files)
            try:
                exit_runner.run()
            except PluginFailedException as ex:
                logger.error("one or more exit plugins failed: %s", ex)
开发者ID:fr34k8,项目名称:atomic-reactor,代码行数:61,代码来源:inner.py

示例12: test_mismatch_reporting

# 需要导入模块: from atomic_reactor.plugin import PostBuildPluginsRunner [as 别名]
# 或者: from atomic_reactor.plugin.PostBuildPluginsRunner import run [as 别名]
def test_mismatch_reporting(tmpdir, caplog, mismatch):
    """Test if expected log entries are reported when components mismatch"""
    workflow = mock_workflow(tmpdir)
    worker_metadatas = mock_metadatas()

    component_name = "openssl"
    component_ppc64le = worker_metadatas['ppc64le']['output'][2]['components'][4]
    assert component_ppc64le['name'] == component_name, "Error in test data"

    # add extra fake worker for s390x to having 3 different platforms
    # we care about only one component
    worker_metadatas['s390x'] = copy.deepcopy(worker_metadatas['ppc64le'])
    component_s390x = copy.deepcopy(component_ppc64le)
    component_s390x['arch'] = 's390x'
    worker_metadatas['s390x']['output'][2]['components'] = [component_s390x]

    if mismatch:
        component_ppc64le['version'] = 'bacon'
        component_s390x['version'] = 'sandwich'

    workflow.postbuild_results[PLUGIN_FETCH_WORKER_METADATA_KEY] = worker_metadatas

    runner = PostBuildPluginsRunner(
        None,
        workflow,
        [{
            'name': PLUGIN_COMPARE_COMPONENTS_KEY,
            "args": {}
        }]
    )

    log_entries = (
        'Comparison mismatch for component openssl:',
        'ppc64le: openssl-bacon-8.el7 (199e2f91fd431d51)',
        'x86_64: openssl-1.0.2k-8.el7 (199e2f91fd431d51)',
        's390x: openssl-sandwich-8.el7 (199e2f91fd431d51)',
    )

    if mismatch:
        # mismatch detected, failure and log entries are expected
        with pytest.raises(PluginFailedException):
            try:
                runner.run()
            except PluginFailedException as e:
                assert 'Failed component comparison for components: openssl' in str(e)
                raise

        for entry in log_entries:
            # component mismatch must be reported only once
            assert caplog.text.count(entry) == 1
    else:
        # no mismatch, no failure, no log entries
        runner.run()
        for entry in log_entries:
            assert entry not in caplog.text
开发者ID:projectatomic,项目名称:atomic-reactor,代码行数:57,代码来源:test_compare_components.py

示例13: test_tag_and_push_plugin

# 需要导入模块: from atomic_reactor.plugin import PostBuildPluginsRunner [as 别名]
# 或者: from atomic_reactor.plugin.PostBuildPluginsRunner import run [as 别名]
def test_tag_and_push_plugin(tmpdir, image_name, logs, should_raise, use_secret):
    if MOCK:
        mock_docker()
        flexmock(docker.Client, push=lambda iid, **kwargs: iter(logs),
                 login=lambda username, registry, dockercfg_path: {'Status': 'Login Succeeded'})

    tasker = DockerTasker()
    workflow = DockerBuildWorkflow({"provider": "git", "uri": "asd"}, TEST_IMAGE)
    workflow.tag_conf.add_primary_image(image_name)
    setattr(workflow, 'builder', X)

    secret_path = None
    if use_secret:
        temp_dir = mkdtemp()
        with open(os.path.join(temp_dir, ".dockercfg"), "w+") as dockerconfig:
            dockerconfig_contents = {
                LOCALHOST_REGISTRY: {
                    "username": "user", "email": "[email protected]", "password": "mypassword"}}
            dockerconfig.write(json.dumps(dockerconfig_contents))
            dockerconfig.flush()
            secret_path = temp_dir


    runner = PostBuildPluginsRunner(
        tasker,
        workflow,
        [{
            'name': TagAndPushPlugin.key,
            'args': {
                'registries': {
                    LOCALHOST_REGISTRY: {
                        'insecure': True,
                        'secret': secret_path
                    }
                }
            },
        }]
    )

    if should_raise:
        with pytest.raises(Exception):
            runner.run()
    else:
        output = runner.run()
        image = output[TagAndPushPlugin.key][0]
        tasker.remove_image(image)
        assert len(workflow.push_conf.docker_registries) > 0

        if MOCK:
            # we only test this when mocking docker because we don't expect
            # running actual docker against v2 registry
            assert workflow.push_conf.docker_registries[0].digests[image_name] == DIGEST1
开发者ID:lcarva,项目名称:atomic-reactor,代码行数:54,代码来源:test_tag_and_push.py

示例14: test_pulp_tag_service_account_secret

# 需要导入模块: from atomic_reactor.plugin import PostBuildPluginsRunner [as 别名]
# 或者: from atomic_reactor.plugin.PostBuildPluginsRunner import run [as 别名]
def test_pulp_tag_service_account_secret(tmpdir, monkeypatch, caplog):
    v1_image_ids = {'x86_64': None,
                    'ppc64le': 'ppc64le_v1_image_id'}
    msg = "tagging v1-image-id ppc64le_v1_image_id for platform ppc64le"
    expected_results = {
        'redhat-image-name1': {'tag': 'latest:ppc64le_v1_image_id'},
    }

    tasker, workflow = prepare(v1_image_ids)
    monkeypatch.setenv('SOURCE_SECRET_PATH', str(tmpdir) + "/not-used")
    with open(os.path.join(str(tmpdir), "pulp.cer"), "wt") as cer:
        cer.write("pulp certificate\n")
    with open(os.path.join(str(tmpdir), "pulp.key"), "wt") as key:
        key.write("pulp key\n")

    runner = PostBuildPluginsRunner(tasker, workflow, [{
        'name': PLUGIN_PULP_TAG_KEY,
        'args': {
            'pulp_registry_name': 'test',
            'pulp_secret_path': str(tmpdir),
        }}])

    results = runner.run()
    assert msg in caplog.text()
    assert results['pulp_tag'] == expected_results
开发者ID:vrutkovs,项目名称:atomic-reactor,代码行数:27,代码来源:test_pulp_tag.py

示例15: test_pulp_tag_service_account_secret

# 需要导入模块: from atomic_reactor.plugin import PostBuildPluginsRunner [as 别名]
# 或者: from atomic_reactor.plugin.PostBuildPluginsRunner import run [as 别名]
def test_pulp_tag_service_account_secret(tmpdir, monkeypatch, caplog, reactor_config_map):
    v1_image_ids = {'x86_64': None,
                    'ppc64le': 'ppc64le_v1_image_id'}
    msg = "tagging v1-image-id ppc64le_v1_image_id for platform ppc64le"
    expected_results = {
        'redhat-image-name1': {'tag': 'latest:ppc64le_v1_image_id'},
    }

    tasker, workflow = prepare(v1_image_ids)
    monkeypatch.setenv('SOURCE_SECRET_PATH', str(tmpdir) + "/not-used")
    with open(os.path.join(str(tmpdir), "pulp.cer"), "wt") as cer:
        cer.write("pulp certificate\n")
    with open(os.path.join(str(tmpdir), "pulp.key"), "wt") as key:
        key.write("pulp key\n")

    runner = PostBuildPluginsRunner(tasker, workflow, [{
        'name': PLUGIN_PULP_TAG_KEY,
        'args': {
            'pulp_registry_name': 'test',
            'pulp_secret_path': str(tmpdir),
        }}])

    if reactor_config_map:
        workflow.plugin_workspace[ReactorConfigPlugin.key] = {}
        workflow.plugin_workspace[ReactorConfigPlugin.key][WORKSPACE_CONF_KEY] =\
            ReactorConfig({'version': 1,
                           'pulp': {'name': 'test',
                                    'auth': {'ssl_certs_dir': str(tmpdir)}}})

    results = runner.run()
    assert msg in caplog.text
    assert results['pulp_tag'] == expected_results
开发者ID:projectatomic,项目名称:atomic-reactor,代码行数:34,代码来源:test_pulp_tag.py


注:本文中的atomic_reactor.plugin.PostBuildPluginsRunner.run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。