Skip to content
This repository has been archived by the owner on Sep 14, 2021. It is now read-only.

Commit

Permalink
Add test that the default setup provider is Ansible.
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardomurri committed Feb 2, 2017
1 parent 1b8df6b commit d014459
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/test_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,32 @@ def test_get_cloud_provider_invalid(tmpdir):
assert 'invalid' not in conf['cloud']


def test_default_setup_provider_is_ansible(tmpdir):
wd = tmpdir.strpath
ssh_key_path = os.path.join(wd, 'id_rsa.pem')
with open(ssh_key_path, 'w+') as ssh_key_file:
# don't really care about SSH key, just that the file exists
ssh_key_file.write('')
ssh_key_file.flush()
config_path = os.path.join(wd, 'config.ini')
with open(config_path, 'w+') as config_file:
config_file.write(
make_config_snippet("cloud", "openstack")
+ make_config_snippet("cluster", "example_openstack")
+ make_config_snippet("login", "ubuntu", keyname='test', valid_path=ssh_key_path)
# *note:* no `provider=` line here
+ """
[setup/slurm_setup]
frontend_groups = slurm_master
compute_groups = slurm_worker
"""
)
creator = make_creator(config_path)
setup = creator.create_setup_provider('example_openstack')
from elasticluster.providers.ansible_provider import AnsibleSetupProvider
assert isinstance(setup, AnsibleSetupProvider)


# class TestCreator(unittest.TestCase):

# def setUp(self):
Expand Down

0 comments on commit d014459

Please sign in to comment.