How to use the cekit.descriptor.Module function in cekit

To help you get started, we’ve selected a few cekit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cekit / cekit / tests / test_unit_image.py View on Github external
def test_module_processing_fail_when_a_module_aready_exists_in_registry():
    module_a = Module(yaml.safe_load("""
        name: org.test.module.a
        version: 1.0
        """), 'path', 'artifact_path')

    module_a1 = Module(yaml.safe_load("""
        name: org.test.module.a
        version: 1.0
        """), 'path', 'artifact_path')

    module_registry = ModuleRegistry()
    module_registry.add_module(module_a)

    with pytest.raises(CekitError) as excinfo:
        module_registry.add_module(module_a1)

    assert "Module 'org.test.module.a' with version '1.0' already exists in module registry" in str(
        excinfo.value)
github cekit / cekit / tests / test_unit_image.py View on Github external
def test_module_processing_modules_with_multiple_versions(caplog):
    caplog.set_level(logging.DEBUG, logger="cekit")

    image = Image(yaml.safe_load("""
        from: foo
        name: test/foo
        version: 1.9
        """), 'foo')

    module_a = Module(yaml.safe_load("""
        name: org.test.module.a
        version: 1.0
        """), 'path', 'artifact_path')

    module_b = Module(yaml.safe_load("""
        name: org.test.module.b
        version: 1.0
        """), 'path', 'artifact_path')

    module_b_1 = Module(yaml.safe_load("""
        name: org.test.module.b
        version: 1.1
        """), 'path', 'artifact_path')

    module_registry = ModuleRegistry()
    module_registry.add_module(module_a)
    module_registry.add_module(module_b)
    module_registry.add_module(module_b_1)

    resulting_install_list = OrderedDict()
github cekit / cekit / tests / test_unit_tools.py View on Github external
def test_merging_description_image():
    desc1 = Image({'name': 'foo', 'version': 1}, None)

    desc2 = Module({'name': 'mod1', 'version': 2,
                    'description': 'mod_desc'}, None, None)

    merged = _merge_descriptors(desc1, desc2)
    assert 'description' not in merged
github cekit / cekit / tests / test_unit_image.py View on Github external
def test_module_processing_fail_when_a_module_aready_exists_in_registry():
    module_a = Module(yaml.safe_load("""
        name: org.test.module.a
        version: 1.0
        """), 'path', 'artifact_path')

    module_a1 = Module(yaml.safe_load("""
        name: org.test.module.a
        version: 1.0
        """), 'path', 'artifact_path')

    module_registry = ModuleRegistry()
    module_registry.add_module(module_a)

    with pytest.raises(CekitError) as excinfo:
        module_registry.add_module(module_a1)

    assert "Module 'org.test.module.a' with version '1.0' already exists in module registry" in str(
github cekit / cekit / tests / test_unit_image.py View on Github external
def test_module_processing_simple_modules_order_to_install():
    image = Image(yaml.safe_load("""
        from: foo
        name: test/foo
        version: 1.9
        """), 'foo')

    module_a = Module(yaml.safe_load("""
        name: org.test.module.a
        version: 1.0
        """), 'path', 'artifact_path')

    module_b = Module(yaml.safe_load("""
        name: org.test.module.b
        version: 1.0
        """), 'path', 'artifact_path')

    module_registry = ModuleRegistry()
    module_registry.add_module(module_a)
    module_registry.add_module(module_b)

    resulting_install_list = OrderedDict()

    to_install_list = [
github cekit / cekit / tests / test_unit_image.py View on Github external
def test_module_processing_warning_when_a_module_version_cannot_be_parsed_as_pep_440(caplog):
    caplog.set_level(logging.DEBUG, logger="cekit")

    module_a = Module(yaml.safe_load("""
        name: org.test.module.a
        version: 1.0
        """), 'path', 'artifact_path')

    module_a1 = Module(yaml.safe_load("""
        name: org.test.module.a
        version: aa fs df
        """), 'path', 'artifact_path')

    module_registry = ModuleRegistry()
    module_registry.add_module(module_a)
    module_registry.add_module(module_a1)

    assert "Module's 'org.test.module.a' version 'aa fs df' does not follow PEP 440 versioning scheme (https://www.python.org/dev/peps/pep-0440), we suggest follow this versioning scheme in modules" in caplog.text