diff --git a/octavia_proxy/api/v2/controllers/pool.py b/octavia_proxy/api/v2/controllers/pool.py index 3bed5e17..bb0d2b22 100644 --- a/octavia_proxy/api/v2/controllers/pool.py +++ b/octavia_proxy/api/v2/controllers/pool.py @@ -234,7 +234,8 @@ def _graph_create(self, session, lb, pool, hm=None, members=None, driver.name, driver.loadbalancer_delete, context.session, lb, cascade=True) - raise Exception("Pool creation failed") + raise Exception('Pool {pool} creation failed'.format( + pool=pool.name)) new_hm = None if hm: diff --git a/octavia_proxy/tests/functional/api/v2/base.py b/octavia_proxy/tests/functional/api/v2/base.py index 06ba43aa..917be023 100644 --- a/octavia_proxy/tests/functional/api/v2/base.py +++ b/octavia_proxy/tests/functional/api/v2/base.py @@ -21,10 +21,6 @@ _network = None _sdk = None _lb = None -_ecs = None -_keypair = None -_port = None -CIDR = '192.168.0.0/16' def _destroy_lb(_lb: dict): @@ -49,19 +45,6 @@ def _destroy_lb(_lb: dict): pass -def _destroy_ecs(self): - - if not self._sdk_connection: - self._sdk_connection = self._get_sdk_connection() - if _ecs: - self._sdk_connection.compute.delete_server(_ecs.id) - if _port: - self._sdk_connection.network.delete_port(_port.id) - if _keypair: - self._sdk_connection.compute.delete_keypair( - _keypair.id) - - class BaseAPITest(base.TestCase): BASE_PATH = '/v2' @@ -154,10 +137,6 @@ def tearDown(self): @classmethod def tearDownClass(cls): - try: - _destroy_ecs() - except Exception: - pass try: _destroy_lb(_lb) except Exception: @@ -171,7 +150,7 @@ def _get_sdk_connection(self): def _create_network(self): global _network - cidr = CIDR + cidr = '192.168.0.0/16' ipv4 = 4 router_name = 'octavia-proxy-test-router' net_name = 'octavia-proxy-test-net' @@ -223,38 +202,6 @@ def _create_lb(self): _lb = response.json.get('loadbalancer') return _lb - def _create_ecs(self): - global _ecs - global _keypair - global _port - ecs_name = 'octavia-proxy-test-ecs' - image = "Standard_CentOS_Stream_latest" - flavor = "s2.medium.1" - keyname = "octavia-proxy-test-keypair" - portname = "octavia-proxy-test-port" - - if not self._sdk_connection: - self._sdk_connection = self._get_sdk_connection() - if not _keypair: - _keypair = self._sdk_connection.compute.\ - create_keypair(name=keyname) - if not _port: - _port = self._sdk_connection.compute.create_post( - name=portname, network_id=self._network["network_id"]) - if not _ecs: - flavor = self._sdk_connection.compute.find_flavor(flavor) - image = self._sdk_connection.compute.find_image(image) - network_id = self._network["network_id"] - ecs = self._sdk_connection.compute.\ - create_server(name=ecs_name, image_id=image.id, - flavor_id=flavor.id, wait=True, - networks=[{"uuid": network_id}], - key_name=_keypair.name, - nics=[{'fixed_ip': _port.address}]) - cr_ecs = self._sdk_connection.compute.find_server(ecs.id) - _ecs = cr_ecs - return _ecs - def _make_app(self): # Note: we need to set argv=() to stop the wsgi setup_app from # pulling in the testing tool sys.argv diff --git a/octavia_proxy/tests/functional/api/v2/test_load_balancer.py b/octavia_proxy/tests/functional/api/v2/test_load_balancer.py index 174c5544..17f18b2a 100644 --- a/octavia_proxy/tests/functional/api/v2/test_load_balancer.py +++ b/octavia_proxy/tests/functional/api/v2/test_load_balancer.py @@ -89,7 +89,6 @@ def test_create_with_tags(self, **optionals): self.delete(self.LB_PATH.format(lb_id=self.api_lb.get('id'))) def test_complex_create_v2_0(self, **optionals): - # ecs = self._create_ecs() lb_json = {'name': 'test4', 'vip_subnet_id': self._network['subnet_id'], 'project_id': self.project_id, @@ -114,7 +113,9 @@ def test_complex_create_v2_0(self, **optionals): "protocol": "HTTP", "healthmonitor": {"type": "HTTP", "delay": "3", "max_retries": 2, - "timeout": 1} + "timeout": 1}, + "members": [{"address": "192.168.115.184", + "protocol_port": "80"}] }] } lb_json.update(optionals) @@ -125,10 +126,12 @@ def test_complex_create_v2_0(self, **optionals): pools = self.api_lb['pools'] hm = pools[0]['healthmonitor'] default_pool = listeners[0]["default_pool_id"] + members = pools[0]['members'] self.assertTrue(listeners) self.assertTrue(pools) self.assertTrue(hm) self.assertTrue(default_pool) + self.assertTrue(members) self.delete(self.LB_PATH.format(lb_id=self.api_lb.get('id')), params={'cascade': True})