def config_instance(temp_files): # TODO(retr0h): Rework molecule config so we can pass a generic # config here. Molecule currently expects to find a 'vagrant' # key in this dict. c = temp_files(fixtures=['molecule_vagrant_v1_config']) return config.ConfigV1(configs=c)
def openstack_molecule_instance(temp_dir, temp_files, state_path_without_data): c = temp_files(fixtures=['molecule_openstack_v1_config']) m = core.Molecule(config.ConfigV1(configs=c), {}) m.state = state.State(state_file=state_path_without_data) m.main() return m
def test_combine_local_config_overrides_default_and_project_config(temp_files): c = temp_files(fixtures=[ 'default_config_data', 'project_config_data', 'local_config_data' ]) config_instance = config.ConfigV1(configs=c).config assert 'local-override' == config_instance['foo'] assert 'local-override' == config_instance['baz']
def molecule_instance_with_env_expansion(temp_dir, temp_files, state_path_without_data): os.environ['MOLECULE_TEST_01'] = 'vagrant' os.environ['MOLECULE_TEST_02'] = 'ubuntu' os.environ['MOLECULE_TEST_03'] = 'trusty64' os.environ['MOLECULE_TEST_04'] = 'example1' os.environ['MOLECULE_TEST_05'] = 'append_platform_to_hostname' c = temp_files(fixtures=['molecule_vagrant_v1_config_using_env']) m = core.Molecule(config.ConfigV1(configs=c), {}) m.state = state.State(state_file=state_path_without_data) m.main() return m
def shell_instance(temp_files): confs = temp_files(fixtures=['molecule_vagrant_v1_config']) c = config.ConfigV1(configs=confs) c.config['dependency']['command'] = 'ls -l -a /tmp' return shell.Shell(c.config)
def ansible_galaxy_instance(temp_files): confs = temp_files(fixtures=['molecule_vagrant_v1_config']) c = config.ConfigV1(configs=confs) c.config['dependency']['requirements_file'] = 'requirements.yml' return ansible_galaxy.AnsibleGalaxy(c.config)
def _get_config(self): return config.ConfigV1()
def test_build_config_paths_preserves_full_path(temp_files): confs = temp_files(fixtures=['build_config_paths_molecule_data']) c = config.ConfigV1(configs=confs) assert '/full/path/vagrantfile_file' == c.config['molecule'][ 'vagrantfile_file']
def test_combine_default_config(temp_files): c = temp_files(fixtures=['default_config_data']) config_instance = config.ConfigV1(configs=c).config assert 'bar' == config_instance['foo'] assert 'qux' == config_instance['baz']
def test_molecule_file_exists(temp_files, patch_molecule_file_exists): configs = temp_files(fixtures=['molecule_vagrant_v1_config']) c = config.ConfigV1(configs=configs) assert c.molecule_file_exists()
def test_build_config_paths_preserves_relative_path(temp_files): confs = temp_files(fixtures=['build_config_paths_molecule_data']) c = config.ConfigV1(configs=confs) assert 'relative/path/rakefile_file' == c.config['molecule'][ 'rakefile_file']