diff --git a/tests/test_ansible_configurator.py b/tests/test_ansible_configurator.py index a23818b4..8d34ba69 100644 --- a/tests/test_ansible_configurator.py +++ b/tests/test_ansible_configurator.py @@ -92,16 +92,15 @@ def test_generate_site_file_yaml_all_role(self): {'role': 'resistance_nextflow', 'tags': ['rn']}], 'vars_files': ['vars/common_configuration.yml', 'vars/hosts.yml', 'vars/rn']}] self.assertEqual(site_yaml, ansible_configurator.generate_site_file_yaml(user_roles)) - + def test_generate_common_configuration_false(self): cidrs = "42" cluster_id = "21" default_user = "ubuntu" ssh_user = "test" configuration = [{}] - common_configuration_yaml = {'auto_mount': False, 'bibigrid_version': version.__version__, - 'cloud_scheduling': {'sshTimeout': 4}, 'cluster_cidrs': cidrs, - 'cluster_id': cluster_id, 'default_user': default_user, + common_configuration_yaml = {'bibigrid_version': version.__version__, 'cloud_scheduling': {'sshTimeout': 4}, + 'cluster_cidrs': cidrs, 'cluster_id': cluster_id, 'default_user': default_user, 'dns_server_list': ['8.8.8.8'], 'enable_ide': False, 'enable_nfs': False, 'enable_slurm': False, 'enable_zabbix': False, 'local_dns_lookup': False, 'local_fs': False, 'slurm': True, @@ -125,9 +124,8 @@ def test_generate_common_configuration_true(self): ssh_user = "test" configuration = [ {elem: "True" for elem in ["localFS", "localDNSlookup", "useMasterAsCompute", "slurm", "zabbix", "ide"]}] - common_configuration_yaml = {'auto_mount': False, 'bibigrid_version': version.__version__, - 'cloud_scheduling': {'sshTimeout': 4}, 'cluster_cidrs': cidrs, - 'cluster_id': cluster_id, 'default_user': default_user, + common_configuration_yaml = {'bibigrid_version': version.__version__, 'cloud_scheduling': {'sshTimeout': 4}, + 'cluster_cidrs': cidrs, 'cluster_id': cluster_id, 'default_user': default_user, 'dns_server_list': ['8.8.8.8'], 'enable_ide': 'True', 'enable_nfs': False, 'enable_slurm': 'True', 'enable_zabbix': 'True', 'ide_conf': {'build': False, 'ide': False, 'port_end': 8383, 'port_start': 8181, @@ -154,9 +152,8 @@ def test_generate_common_configuration_nfs_shares(self): cluster_id = "21" default_user = "ubuntu" ssh_user = "test" - common_configuration_yaml = {'auto_mount': False, 'bibigrid_version': version.__version__, - 'cloud_scheduling': {'sshTimeout': 4}, 'cluster_cidrs': cidrs, - 'cluster_id': cluster_id, 'default_user': default_user, + common_configuration_yaml = {'bibigrid_version': version.__version__, 'cloud_scheduling': {'sshTimeout': 4}, + 'cluster_cidrs': cidrs, 'cluster_id': cluster_id, 'default_user': default_user, 'dns_server_list': ['8.8.8.8'], 'enable_ide': False, 'enable_nfs': 'True', 'enable_slurm': False, 'enable_zabbix': False, 'ext_nfs_mounts': [], 'local_dns_lookup': False, 'local_fs': False, @@ -180,9 +177,8 @@ def test_generate_common_configuration_nfs(self): cluster_id = "21" default_user = "ubuntu" ssh_user = "test" - common_configuration_yaml = {'auto_mount': False, 'bibigrid_version': version.__version__, - 'cloud_scheduling': {'sshTimeout': 4}, 'cluster_cidrs': cidrs, - 'cluster_id': cluster_id, 'default_user': default_user, + common_configuration_yaml = {'bibigrid_version': version.__version__, 'cloud_scheduling': {'sshTimeout': 4}, + 'cluster_cidrs': cidrs, 'cluster_id': cluster_id, 'default_user': default_user, 'dns_server_list': ['8.8.8.8'], 'enable_ide': False, 'enable_nfs': 'True', 'enable_slurm': False, 'enable_zabbix': False, 'ext_nfs_mounts': [], 'local_dns_lookup': False, 'local_fs': False, @@ -205,9 +201,8 @@ def test_generate_common_configuration_ext_nfs_shares(self): cluster_id = "21" default_user = "ubuntu" ssh_user = "test" - common_configuration_yaml = {'auto_mount': False, 'bibigrid_version': version.__version__, - 'cloud_scheduling': {'sshTimeout': 4}, 'cluster_cidrs': cidrs, - 'cluster_id': cluster_id, 'default_user': default_user, + common_configuration_yaml = {'bibigrid_version': version.__version__, 'cloud_scheduling': {'sshTimeout': 4}, + 'cluster_cidrs': cidrs, 'cluster_id': cluster_id, 'default_user': default_user, 'dns_server_list': ['8.8.8.8'], 'enable_ide': False, 'enable_nfs': 'True', 'enable_slurm': False, 'enable_zabbix': False, 'ext_nfs_mounts': [{'dst': '/vil/mil', 'src': '/vil/mil'}], @@ -231,9 +226,8 @@ def test_generate_common_configuration_ide(self): cluster_id = "21" default_user = "ubuntu" ssh_user = "test" - common_configuration_yaml = {'auto_mount': False, 'bibigrid_version': version.__version__, - 'cloud_scheduling': {'sshTimeout': 4}, 'cluster_cidrs': cidrs, - 'cluster_id': cluster_id, 'default_user': default_user, + common_configuration_yaml = {'bibigrid_version': version.__version__, 'cloud_scheduling': {'sshTimeout': 4}, + 'cluster_cidrs': cidrs, 'cluster_id': cluster_id, 'default_user': default_user, 'dns_server_list': ['8.8.8.8'], 'enable_ide': 'Some1', 'enable_nfs': False, 'enable_slurm': False, 'enable_zabbix': False, 'ide_conf': {'build': False, 'ide': False, 'key1': 'Some2', 'port_end': 8383, @@ -351,8 +345,8 @@ def test_write_yaml_alias(self, mock_yaml): @patch("bibigrid.core.utility.ansible_configurator.generate_site_file_yaml") @patch("bibigrid.core.utility.ansible_configurator.write_yaml") @patch("bibigrid.core.utility.ansible_configurator.get_cidrs") - def test_configure_ansible_yaml(self, mock_cidrs, mock_yaml, mock_site, mock_hosts, mock_list, - mock_common, mock_worker, mock_write): + def test_configure_ansible_yaml(self, mock_cidrs, mock_yaml, mock_site, mock_hosts, mock_list, mock_common, + mock_worker, mock_write): mock_cidrs.return_value = 421 mock_list.return_value = {2: 422} provider = MagicMock() diff --git a/tests/test_validate_configuration.py b/tests/test_validate_configuration.py index 322cbb36..27994fe2 100644 --- a/tests/test_validate_configuration.py +++ b/tests/test_validate_configuration.py @@ -211,7 +211,8 @@ def test_check_volumes_mismatch(self): provider1.get_volume_snapshot_by_id_or_name = MagicMock(return_value=None) provider1.cloud_specification = {"identifier": "1"} v_c = validate_configuration.ValidateConfiguration(providers=[provider1], - configurations=[{"masterMounts": ["Test"]}], log=Mock()) + configurations=[{"masterMounts": [{"name": "Test"}]}], + log=Mock()) self.assertFalse(v_c.check_volumes()) def test_check_volumes_match_snapshot(self): @@ -220,7 +221,8 @@ def test_check_volumes_match_snapshot(self): provider1.get_volume_snapshot_by_id_or_name = MagicMock(return_value={"size": 1}) provider1.cloud_specification = {"identifier": "1"} v_c = validate_configuration.ValidateConfiguration(providers=[provider1], - configurations=[{"masterMounts": ["Test"]}], log=Mock()) + configurations=[{"masterMounts": [{"name": "Test"}]}], + log=Mock()) self.assertTrue(v_c.check_volumes()) def test_check_volumes_match_snapshot_count(self): @@ -229,9 +231,8 @@ def test_check_volumes_match_snapshot_count(self): provider1.get_volume_by_id_or_name = MagicMock(return_value=None) provider1.get_volume_snapshot_by_id_or_name = MagicMock(return_value={"size": i}) provider1.cloud_specification = {"identifier": i} - v_c = validate_configuration.ValidateConfiguration(providers=[provider1] * i, - configurations=[{"masterMounts": ["Test"] * i}], - log=Mock()) + v_c = validate_configuration.ValidateConfiguration(providers=[provider1] * i, configurations=[ + {"masterMounts": [{"name": "Test"}] * i}], log=Mock()) self.assertTrue(v_c.check_volumes()) self.assertTrue(v_c.required_resources_dict[i]["volumes"] == i) self.assertTrue(v_c.required_resources_dict[i]["volume_gigabytes"] == i ** 2) @@ -242,7 +243,8 @@ def test_check_volumes_match_volume(self): provider1.get_volume_snapshot_by_id_or_name = MagicMock(return_value=None) provider1.cloud_specification = {"identifier": "1"} v_c = validate_configuration.ValidateConfiguration(providers=[provider1], - configurations=[{"masterMounts": ["Test"]}], log=Mock()) + configurations=[{"masterMounts": [{"name": "Test"}]}], + log=Mock()) self.assertTrue(v_c.check_volumes()) self.assertTrue(v_c.required_resources_dict["1"]["volumes"] == 0) self.assertTrue(v_c.required_resources_dict["1"]["volume_gigabytes"] == 0)