def test_get_service_nodes(self): basedn = BASEDN + '/cluster1/services/service0' basedn_nodes = BASEDN + '/cluster1/nodes' service = registry.Service(basedn) nodes = REGISTRY[PREFIX][USER][PRODUCT][VERSION]['cluster1']['services']['service0']['nodes'] expected = [ registry.Node('{}/{}'.format(basedn_nodes, n)) for n in nodes] self.assertEqual(sorted(service.nodes), sorted(expected))
def test_get_cluster_instance(self): nodes = REGISTRY['clusters']['cluster1']['nodes'] services = REGISTRY['clusters']['cluster1']['services'] dn = registry.instantiate(user='******', product='a', version='1.0.0', nodes=nodes, services=services) instance = registry.get_cluster(dn=dn) expected_dn = registry.PREFIX + '/jlopez/a/1.0.0/1' expected_nodes = [ registry.Node('{}/nodes/{}'.format(expected_dn, e)) for e in nodes ] expected_services = [ registry.Service('{}/services/{}'.format(expected_dn, e)) for e in services ] self.assertEqual(sorted(instance.nodes), sorted(expected_nodes)) self.assertEqual(sorted(instance.services), sorted(expected_services))
def test_get_cluster_services(self): cluster = registry.Cluster(BASEDN + '/cluster1') services = REGISTRY[PREFIX][USER][PRODUCT][VERSION]['cluster1']['services'].keys() expected = [registry.Service('{}/cluster1/services/{}'.format(BASEDN, e)) for e in services] self.assertEqual(sorted(cluster.services), sorted(expected))
def test_set_service_heap(self): service = registry.Service(BASEDN + '/cluster1/services/service0') expected = '1234' service.heap = expected self.assertEqual(service.heap, expected)
def test_get_service_heap(self): service = registry.Service(BASEDN + '/cluster1/services/service0') expected = REGISTRY[PREFIX][USER][PRODUCT][VERSION]['cluster1']['services']['service0']['heap'] heap = service.heap self.assertEqual(heap, expected)
def test_set_service_status(self): service = registry.Service(BASEDN + '/cluster1/services/service0') service.status = 'configured' self.assertEqual(service.status, 'configured')
def test_get_service_status(self): service = registry.Service(BASEDN + '/cluster1/services/service0') expected = REGISTRY[PREFIX][USER][PRODUCT][VERSION]['cluster1']['services']['service0']['status'] status = service.status self.assertEqual(status, expected)