diff options
Diffstat (limited to 'utils/test')
-rw-r--r-- | utils/test/cli_installer_tests.py | 57 | ||||
-rw-r--r-- | utils/test/fixture.py | 9 |
2 files changed, 52 insertions, 14 deletions
diff --git a/utils/test/cli_installer_tests.py b/utils/test/cli_installer_tests.py index baab5d56f..6ba5ec1eb 100644 --- a/utils/test/cli_installer_tests.py +++ b/utils/test/cli_installer_tests.py @@ -72,6 +72,14 @@ MOCK_FACTS_QUICKHA = { 'public_hostname': 'proxy.example.com' } }, + '10.1.0.1': { + 'common': { + 'ip': '10.1.0.1', + 'public_ip': '10.1.0.1', + 'hostname': 'storage-private.example.com', + 'public_hostname': 'storage.example.com' + } + }, } # Missing connect_to on some hosts: @@ -137,6 +145,12 @@ hosts: public_ip: 24.222.0.5 public_hostname: proxy.example.com master_lb: true + - connect_to: 10.1.0.1 + ip: 10.1.0.1 + hostname: storage-private.example.com + public_ip: 24.222.0.6 + public_hostname: storage.example.com + storage: true """ QUICKHA_2_MASTER_CONFIG = """ @@ -169,6 +183,12 @@ hosts: public_ip: 24.222.0.5 public_hostname: proxy.example.com master_lb: true + - connect_to: 10.1.0.1 + ip: 10.1.0.1 + hostname: storage-private.example.com + public_ip: 24.222.0.6 + public_hostname: storage.example.com + storage: true """ QUICKHA_CONFIG_REUSED_LB = """ @@ -197,6 +217,12 @@ hosts: public_hostname: node2.example.com node: true master: true + - connect_to: 10.1.0.1 + ip: 10.1.0.1 + hostname: storage-private.example.com + public_ip: 24.222.0.6 + public_hostname: storage.example.com + storage: true """ QUICKHA_CONFIG_NO_LB = """ @@ -263,6 +289,12 @@ hosts: public_hostname: proxy.example.com master_lb: true preconfigured: true + - connect_to: 10.1.0.1 + ip: 10.1.0.1 + hostname: storage-private.example.com + public_ip: 24.222.0.6 + public_hostname: storage.example.com + storage: true """ class UnattendedCliTests(OOCliFixture): @@ -595,8 +627,8 @@ class UnattendedCliTests(OOCliFixture): # Make sure we ran on the expected masters and nodes: hosts = run_playbook_mock.call_args[0][0] hosts_to_run_on = run_playbook_mock.call_args[0][1] - self.assertEquals(5, len(hosts)) - self.assertEquals(5, len(hosts_to_run_on)) + self.assertEquals(6, len(hosts)) + self.assertEquals(6, len(hosts_to_run_on)) #unattended with two masters, one node, and haproxy @patch('ooinstall.openshift_ansible.run_main_playbook') @@ -665,8 +697,8 @@ class UnattendedCliTests(OOCliFixture): # Make sure we ran on the expected masters and nodes: hosts = run_playbook_mock.call_args[0][0] hosts_to_run_on = run_playbook_mock.call_args[0][1] - self.assertEquals(5, len(hosts)) - self.assertEquals(5, len(hosts_to_run_on)) + self.assertEquals(6, len(hosts)) + self.assertEquals(6, len(hosts_to_run_on)) class AttendedCliTests(OOCliFixture): @@ -805,17 +837,18 @@ class AttendedCliTests(OOCliFixture): ssh_user='root', variant_num=1, confirm_facts='y', - master_lb=('10.0.0.5', False)) + master_lb=('10.0.0.5', False), + storage='10.1.0.1',) self.cli_args.append("install") result = self.runner.invoke(cli.cli, self.cli_args, input=cli_input) self.assert_result(result, 0) self._verify_load_facts(load_facts_mock) - self._verify_run_playbook(run_playbook_mock, 5, 5) + self._verify_run_playbook(run_playbook_mock, 6, 6) written_config = read_yaml(self.config_file) - self._verify_config_hosts(written_config, 5) + self._verify_config_hosts(written_config, 6) inventory = ConfigParser.ConfigParser(allow_no_value=True) inventory.read(os.path.join(self.work_dir, '.ansible/hosts')) @@ -845,17 +878,18 @@ class AttendedCliTests(OOCliFixture): ssh_user='root', variant_num=1, confirm_facts='y', - master_lb=('10.0.0.5', False)) + master_lb=('10.0.0.5', False), + storage='10.1.0.1',) self.cli_args.append("install") result = self.runner.invoke(cli.cli, self.cli_args, input=cli_input) self.assert_result(result, 0) self._verify_load_facts(load_facts_mock) - self._verify_run_playbook(run_playbook_mock, 4, 4) + self._verify_run_playbook(run_playbook_mock, 5, 5) written_config = read_yaml(self.config_file) - self._verify_config_hosts(written_config, 4) + self._verify_config_hosts(written_config, 5) inventory = ConfigParser.ConfigParser(allow_no_value=True) inventory.read(os.path.join(self.work_dir, '.ansible/hosts')) @@ -881,7 +915,8 @@ class AttendedCliTests(OOCliFixture): ssh_user='root', variant_num=1, confirm_facts='y', - master_lb=(['10.0.0.2', '10.0.0.5'], False)) + master_lb=(['10.0.0.2', '10.0.0.5'], False), + storage='10.1.0.1') self.cli_args.append("install") result = self.runner.invoke(cli.cli, self.cli_args, input=cli_input) diff --git a/utils/test/fixture.py b/utils/test/fixture.py index 1b1c2e5c2..d6222dfaa 100644 --- a/utils/test/fixture.py +++ b/utils/test/fixture.py @@ -92,7 +92,7 @@ class OOCliFixture(OOInstallFixture): self.assertTrue('hostname' in host) self.assertTrue('public_hostname' in host) if 'preconfigured' not in host: - self.assertTrue(host['node']) + self.assertTrue('node' in host or 'storage' in host) self.assertTrue('ip' in host) self.assertTrue('public_ip' in host) @@ -142,7 +142,7 @@ class OOCliFixture(OOInstallFixture): #pylint: disable=too-many-arguments,too-many-branches,too-many-statements def build_input(ssh_user=None, hosts=None, variant_num=None, add_nodes=None, confirm_facts=None, schedulable_masters_ok=None, - master_lb=None): + master_lb=None, storage=None): """ Build an input string simulating a user entering values in an interactive attended install. @@ -197,7 +197,10 @@ def build_input(ssh_user=None, hosts=None, variant_num=None, inputs.append(master_lb[0]) inputs.append('y' if master_lb[1] else 'n') - inputs.append('example.com') + if storage: + inputs.append(storage) + + inputs.append('subdomain.example.com') # TODO: support option 2, fresh install if add_nodes: |