|
|
|
@ -44,7 +44,8 @@ class TestBayConductorWithK8s(base.TestCase):
|
|
|
|
|
'flannel_network_subnetlen': '26', |
|
|
|
|
'flannel_backend': 'vxlan'}, |
|
|
|
|
'tls_disabled': False, |
|
|
|
|
'server_type': 'vm' |
|
|
|
|
'server_type': 'vm', |
|
|
|
|
'registry_enabled': False |
|
|
|
|
} |
|
|
|
|
self.bay_dict = { |
|
|
|
|
'uuid': '5d12f6fd-a196-4bf0-ae4c-1f639a523a52', |
|
|
|
@ -148,6 +149,7 @@ class TestBayConductorWithK8s(base.TestCase):
|
|
|
|
|
'magnum_url': self.mock_osc.magnum_url.return_value, |
|
|
|
|
'region_name': self.mock_osc.cinder_region_name.return_value, |
|
|
|
|
'tls_disabled': False, |
|
|
|
|
'registry_enabled': False, |
|
|
|
|
'trustee_domain_id': '3527620c-b220-4f37-9ebc-6e63a81a9b2f', |
|
|
|
|
'trustee_username': 'fake_trustee', |
|
|
|
|
'trustee_password': 'fake_trustee_password', |
|
|
|
@ -160,6 +162,61 @@ class TestBayConductorWithK8s(base.TestCase):
|
|
|
|
|
|
|
|
|
|
self.assertEqual(expected, definition) |
|
|
|
|
|
|
|
|
|
@patch('magnum.objects.BayModel.get_by_uuid') |
|
|
|
|
def test_extract_template_definition_with_registry( |
|
|
|
|
self, |
|
|
|
|
mock_objects_baymodel_get_by_uuid): |
|
|
|
|
self.baymodel_dict['registry_enabled'] = True |
|
|
|
|
baymodel = objects.BayModel(self.context, **self.baymodel_dict) |
|
|
|
|
mock_objects_baymodel_get_by_uuid.return_value = baymodel |
|
|
|
|
bay = objects.Bay(self.context, **self.bay_dict) |
|
|
|
|
|
|
|
|
|
cfg.CONF.set_override('swift_region', |
|
|
|
|
'RegionOne', |
|
|
|
|
group='docker_registry') |
|
|
|
|
|
|
|
|
|
(template_path, |
|
|
|
|
definition) = bay_conductor._extract_template_definition(self.context, |
|
|
|
|
bay) |
|
|
|
|
|
|
|
|
|
expected = { |
|
|
|
|
'auth_url': 'http://192.168.10.10:5000/v3', |
|
|
|
|
'bay_uuid': '5d12f6fd-a196-4bf0-ae4c-1f639a523a52', |
|
|
|
|
'discovery_url': 'https://discovery.etcd.io/test', |
|
|
|
|
'dns_nameserver': 'dns_nameserver', |
|
|
|
|
'docker_volume_size': 20, |
|
|
|
|
'external_network': 'external_network_id', |
|
|
|
|
'flannel_backend': 'vxlan', |
|
|
|
|
'flannel_network_cidr': '10.101.0.0/16', |
|
|
|
|
'flannel_network_subnetlen': '26', |
|
|
|
|
'http_proxy': 'http_proxy', |
|
|
|
|
'https_proxy': 'https_proxy', |
|
|
|
|
'magnum_url': 'http://127.0.0.1:9511/v1', |
|
|
|
|
'master_flavor': 'master_flavor_id', |
|
|
|
|
'minion_flavor': 'flavor_id', |
|
|
|
|
'network_driver': 'network_driver', |
|
|
|
|
'no_proxy': 'no_proxy', |
|
|
|
|
'number_of_masters': 1, |
|
|
|
|
'number_of_minions': 1, |
|
|
|
|
'region_name': 'RegionOne', |
|
|
|
|
'registry_container': 'docker_registry', |
|
|
|
|
'registry_enabled': True, |
|
|
|
|
'server_image': 'image_id', |
|
|
|
|
'ssh_key_name': 'keypair_id', |
|
|
|
|
'swift_region': 'RegionOne', |
|
|
|
|
'tenant_name': 'fake_tenant', |
|
|
|
|
'tls_disabled': False, |
|
|
|
|
'trust_id': 'bd11efc5-d4e2-4dac-bbce-25e348ddf7de', |
|
|
|
|
'trustee_domain_id': '3527620c-b220-4f37-9ebc-6e63a81a9b2f', |
|
|
|
|
'trustee_password': 'fake_trustee_password', |
|
|
|
|
'trustee_user_id': '7b489f04-b458-4541-8179-6a48a553e656', |
|
|
|
|
'trustee_username': 'fake_trustee', |
|
|
|
|
'username': 'fake_user', |
|
|
|
|
'volume_driver': 'volume_driver' |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
self.assertEqual(expected, definition) |
|
|
|
|
|
|
|
|
|
@patch('magnum.objects.BayModel.get_by_uuid') |
|
|
|
|
def test_extract_template_definition_coreos_with_disovery( |
|
|
|
|
self, |
|
|
|
@ -192,6 +249,7 @@ class TestBayConductorWithK8s(base.TestCase):
|
|
|
|
|
'flannel_network_subnetlen': '26', |
|
|
|
|
'flannel_backend': 'vxlan', |
|
|
|
|
'tls_disabled': False, |
|
|
|
|
'registry_enabled': False, |
|
|
|
|
'trustee_domain_id': '3527620c-b220-4f37-9ebc-6e63a81a9b2f', |
|
|
|
|
'trustee_username': 'fake_trustee', |
|
|
|
|
'trustee_password': 'fake_trustee_password', |
|
|
|
@ -238,6 +296,7 @@ class TestBayConductorWithK8s(base.TestCase):
|
|
|
|
|
'flannel_network_subnetlen': '26', |
|
|
|
|
'flannel_backend': 'vxlan', |
|
|
|
|
'tls_disabled': False, |
|
|
|
|
'registry_enabled': False, |
|
|
|
|
'trustee_domain_id': '3527620c-b220-4f37-9ebc-6e63a81a9b2f', |
|
|
|
|
'trustee_username': 'fake_trustee', |
|
|
|
|
'trustee_password': 'fake_trustee_password', |
|
|
|
@ -358,6 +417,7 @@ class TestBayConductorWithK8s(base.TestCase):
|
|
|
|
|
'magnum_url': self.mock_osc.magnum_url.return_value, |
|
|
|
|
'region_name': self.mock_osc.cinder_region_name.return_value, |
|
|
|
|
'tls_disabled': False, |
|
|
|
|
'registry_enabled': False, |
|
|
|
|
'trustee_domain_id': '3527620c-b220-4f37-9ebc-6e63a81a9b2f', |
|
|
|
|
'trustee_username': 'fake_trustee', |
|
|
|
|
'trustee_password': 'fake_trustee_password', |
|
|
|
|