Beispiel #1
0
def test_galaxy_requirements(exec_env_definition_file,
                             galaxy_requirements_file):
    galaxy_requirements_content = {
        'collections': [{
            'name': 'geerlingguy.php_roles',
            'version': '0.9.3',
            'source': 'https://galaxy.ansible.com'
        }]
    }

    galaxy_requirements_path = galaxy_requirements_file(
        galaxy_requirements_content)

    exec_env_content = {
        'version': 1,
        'dependencies': {
            'galaxy': str(galaxy_requirements_path)
        }
    }

    exec_env_path = exec_env_definition_file(content=exec_env_content)

    aee = AnsibleBuilder(filename=exec_env_path)
    aee.process()

    with open(aee.containerfile.path) as f:
        content = f.read()

    assert 'ADD requirements.yml' in content
Beispiel #2
0
def test_base_image(exec_env_definition_file):
    content = {'version': 1}
    path = exec_env_definition_file(content=content)
    aee = AnsibleBuilder(filename=path)
    aee.process()

    with open(aee.containerfile.path) as f:
        content = f.read()

    assert 'ansible-runner' in content

    aee = AnsibleBuilder(filename=path, base_image='my-custom-image')
    aee.process()

    with open(aee.containerfile.path) as f:
        content = f.read()

    assert 'my-custom-image' in content