def test_get_cluster_depl_tags(self): expected = { 'cluster_id': 3, 'attrs': { 'deployment_tags': set( ['ha', 'rhel', 'additional_components', 'murano', 'nova_network', 'public_on_all_nodes', 'enable_without_ceph']), 'release_version': '2015.2-1.0' } } with requests_mock.Mocker() as m: cluster = base.CLUSTERS[expected['cluster_id']] m.register_uri('GET', '/api/clusters/3', json=cluster['cluster_meta']) m.register_uri('GET', '/api/clusters/3/attributes', json=cluster['cluster_attributes']) m.register_uri('GET', '/api/releases/3', json=cluster['release_data']) m.register_uri('GET', '/api/nodes?cluster_id=3', json=cluster['cluster_node']) res = mixins._get_cluster_attrs(expected['cluster_id']) self.assertEqual(res, expected['attrs'])
def test_get_cluster_depl_tags(self): expected = { 'cluster_id': 3, 'attrs': { 'deployment_tags': set([ 'ha', 'rhel', 'additional_components', 'murano', 'nova_network', 'public_on_all_nodes', 'enable_without_ceph' ]), 'release_version': '2015.2-1.0' } } with requests_mock.Mocker() as m: cluster = base.CLUSTERS[expected['cluster_id']] m.register_uri('GET', '/api/clusters/3', json=cluster['cluster_meta']) m.register_uri('GET', '/api/clusters/3/attributes', json=cluster['cluster_attributes']) m.register_uri('GET', '/api/releases/3', json=cluster['release_data']) m.register_uri('GET', '/api/nodes?cluster_id=3', json=cluster['cluster_node']) res = mixins._get_cluster_attrs(expected['cluster_id']) self.assertEqual(res, expected['attrs'])
def test_dpdk_deployment_tag(self): expected = { 'cluster_id': 8, 'attrs': { 'deployment_tags': set( ['computes_with_dpdk', 'neutron', 'enable_without_ceph', 'ha', 'public_on_all_nodes', 'rhel', 'computes_without_dpdk']), 'release_version': '2015.2-1.0' } } with requests_mock.Mocker() as m: cluster = base.CLUSTERS[expected['cluster_id']] m.register_uri('GET', '/api/clusters/8', json=cluster['cluster_meta']) m.register_uri('GET', '/api/clusters/8/attributes', json=cluster['cluster_attributes']) m.register_uri('GET', '/api/releases/8', json=cluster['release_data']) m.register_uri('GET', '/api/nodes?cluster_id=8', json=cluster['cluster_node']) m.register_uri('GET', '/api/nodes/1/interfaces', json=cluster['node-1_interfaces']) m.register_uri('GET', '/api/nodes/2/interfaces', json=cluster['node-2_interfaces']) res = mixins._get_cluster_attrs(expected['cluster_id']) self.assertEqual(res, expected['attrs'])
def test_get_murano_tags_without_artifacts(self): expected = self.expected expected['cluster_id'] = 12 expected['attrs']['deployment_tags'].add('murano') expected['attrs']['deployment_tags'].add('murano_without_glare') with requests_mock.Mocker() as m: cluster = base.CLUSTERS[expected['cluster_id']] m.register_uri('GET', '/api/clusters/12', json=cluster['cluster_meta']) m.register_uri('GET', '/api/clusters/12/attributes', json=cluster['cluster_attributes']) m.register_uri('GET', '/api/releases/12', json=cluster['release_data']) m.register_uri('GET', '/api/nodes?cluster_id=12', json=cluster['cluster_node']) res = mixins._get_cluster_attrs(expected['cluster_id']) self.assertEqual(res, expected['attrs'])
def test_dpdk_deployment_tag(self): expected = { 'cluster_id': 8, 'attrs': { 'deployment_tags': set([ 'computes_with_dpdk', 'neutron', 'enable_without_ceph', 'ha', 'public_on_all_nodes', 'rhel', 'computes_without_dpdk' ]), 'release_version': '2015.2-1.0' } } with requests_mock.Mocker() as m: cluster = base.CLUSTERS[expected['cluster_id']] m.register_uri('GET', '/api/clusters/8', json=cluster['cluster_meta']) m.register_uri('GET', '/api/clusters/8/attributes', json=cluster['cluster_attributes']) m.register_uri('GET', '/api/releases/8', json=cluster['release_data']) m.register_uri('GET', '/api/nodes?cluster_id=8', json=cluster['cluster_node']) m.register_uri('GET', '/api/nodes/1/interfaces', json=cluster['node-1_interfaces']) m.register_uri('GET', '/api/nodes/2/interfaces', json=cluster['node-2_interfaces']) res = mixins._get_cluster_attrs(expected['cluster_id']) self.assertEqual(res, expected['attrs'])
def test_get_murano_tags_without_artifacts(self): expected = self.expected expected['cluster_id'] = 12 expected['attrs']['deployment_tags'].add('murano') expected['attrs']['deployment_tags'].add('murano_without_glare') with requests_mock.Mocker() as m: cluster = base.CLUSTERS[expected['cluster_id']] m.register_uri('GET', '/api/clusters/12', json=cluster['cluster_meta']) m.register_uri('GET', '/api/clusters/12/attributes', json=cluster['cluster_attributes']) m.register_uri('GET', '/api/releases/12', json=cluster['release_data']) m.register_uri('GET', '/api/nodes?cluster_id=12', json=cluster['cluster_node']) res = mixins._get_cluster_attrs(expected['cluster_id']) self.assertEqual(res, expected['attrs'])