Improve resource cleanup in API v2 tests

LBaaS API v2 tests don't add cleanup right after resources are created,
they attempt to remove them at the end of the tests. In light of heavy
usage of class-level resources failure of any test leads to an
avalanche.

This change modifies API v2 tests to add clean-ups on resource
creation.

Change-Id: I1513690ff35210eaf1de7aef9db23bd69ff486e5
Closes-Bug: #1498447
This commit is contained in:
Elena Ezhova 2015-09-22 17:15:18 +03:00
parent 4ef9bb7ccd
commit c7cc766c2b
11 changed files with 67 additions and 201 deletions

View File

@ -234,28 +234,28 @@ class BaseTestCase(base.BaseNetworkTest):
cls.load_balancer.get('id'))
return pool
@classmethod
def _create_health_monitor(cls, wait=True, **health_monitor_kwargs):
hm = cls.health_monitors_client.create_health_monitor(
def _create_health_monitor(self, wait=True, cleanup=True,
**health_monitor_kwargs):
hm = self.health_monitors_client.create_health_monitor(
**health_monitor_kwargs)
if cleanup:
self.addCleanup(self._delete_health_monitor, hm.get('id'))
if wait:
cls._wait_for_load_balancer_status(cls.load_balancer.get('id'))
self._wait_for_load_balancer_status(self.load_balancer.get('id'))
return hm
@classmethod
def _delete_health_monitor(cls, health_monitor_id, wait=True):
cls.health_monitors_client.delete_health_monitor(health_monitor_id)
def _delete_health_monitor(self, health_monitor_id, wait=True):
self.health_monitors_client.delete_health_monitor(health_monitor_id)
if wait:
cls._wait_for_load_balancer_status(cls.load_balancer.get('id'))
self._wait_for_load_balancer_status(self.load_balancer.get('id'))
@classmethod
def _update_health_monitor(cls, health_monitor_id, wait=True,
def _update_health_monitor(self, health_monitor_id, wait=True,
**health_monitor_kwargs):
health_monitor = cls.health_monitors_client.update_health_monitor(
health_monitor = self.health_monitors_client.update_health_monitor(
health_monitor_id, **health_monitor_kwargs)
if wait:
cls._wait_for_load_balancer_status(
cls.load_balancer.get('id'))
self._wait_for_load_balancer_status(
self.load_balancer.get('id'))
return health_monitor
@classmethod

View File

@ -74,9 +74,6 @@ class TestHealthMonitors(base.BaseAdminTestCase):
hm_tenant_id = hm.get('tenant_id')
self.assertEqual(admin_tenant_id, hm_tenant_id)
# cleanup test
self._delete_health_monitor(hm.get('id'))
@test.attr(type='smoke')
def test_create_health_monitor_empty_tenant_id_field(self):
"""
@ -90,9 +87,6 @@ class TestHealthMonitors(base.BaseAdminTestCase):
self.assertEqual(hm.get('tenant_id'), "")
# cleanup test
self._delete_health_monitor(hm.get('id'))
@test.attr(type='smoke')
def test_create_health_monitor_for_another_tenant_id_field(self):
"""Test with admin user create health monitor for another tenant id.
@ -107,5 +101,3 @@ class TestHealthMonitors(base.BaseAdminTestCase):
self.assertEqual(hm.get('tenant_id'), tenantid)
self.assertNotEqual(hm.get('tenant_id'),
self.subnet.get('tenant_id'))
# cleanup test
self._delete_health_monitor(hm.get('id'))

View File

@ -62,8 +62,6 @@ class TestHealthMonitors(base.BaseTestCase):
pool_id=self.pool.get('id'))
hm_list = self.health_monitors_client.list_health_monitors()
self.assertIn(hm, hm_list)
# cleanup test
self._delete_health_monitor(hm.get('id'))
@test.attr(type='smoke')
def test_list_health_monitors_two(self):
@ -73,9 +71,11 @@ class TestHealthMonitors(base.BaseTestCase):
new_listener = self._create_listener(
loadbalancer_id=self.load_balancer.get('id'),
protocol='HTTP', protocol_port=88)
self.addCleanup(self._delete_listener, new_listener.get('id'))
new_pool = self._create_pool(
protocol='HTTP', lb_algorithm='ROUND_ROBIN',
listener_id=new_listener.get('id'))
self.addCleanup(self._delete_pool, new_pool.get('id'))
hm2 = self._create_health_monitor(
type='HTTP', max_retries=10, delay=3, timeout=5,
pool_id=new_pool.get('id'))
@ -83,11 +83,6 @@ class TestHealthMonitors(base.BaseTestCase):
self.assertEqual(2, len(hm_list))
self.assertIn(hm1, hm_list)
self.assertIn(hm2, hm_list)
# cleanup test
self._delete_health_monitor(hm1.get('id'))
self._delete_health_monitor(hm2.get('id'))
self._delete_pool(new_pool.get('id'))
self._delete_listener(new_listener.get('id'))
@test.attr(type='smoke')
def test_get_health_monitor(self):
@ -96,8 +91,6 @@ class TestHealthMonitors(base.BaseTestCase):
pool_id=self.pool.get('id'))
hm_test = self.health_monitors_client.get_health_monitor(hm.get('id'))
self.assertEqual(hm, hm_test)
# cleanup test
self._delete_health_monitor(hm.get('id'))
@test.attr(type='smoke')
def test_create_health_monitor(self):
@ -106,8 +99,6 @@ class TestHealthMonitors(base.BaseTestCase):
pool_id=self.pool.get('id'))
hm = self.health_monitors_client.get_health_monitor(new_hm.get('id'))
self.assertEqual(new_hm, hm)
# cleanup test
self._delete_health_monitor(new_hm.get('id'))
@test.attr(type='smoke')
def test_create_health_monitor_missing_attribute(self):
@ -170,8 +161,6 @@ class TestHealthMonitors(base.BaseTestCase):
hm_test = self.health_monitors_client.get_health_monitor(hm.get('id'))
self.assertEqual(hm, hm_test)
self.assertEqual(True, hm_test.get('admin_state_up'))
# cleanup test
self._delete_health_monitor(hm.get('id'))
@test.attr(type='smoke')
def test_create_health_monitor_missing_http_method(self):
@ -184,8 +173,6 @@ class TestHealthMonitors(base.BaseTestCase):
hm_test = self.health_monitors_client.get_health_monitor(hm.get('id'))
self.assertEqual(hm, hm_test)
self.assertEqual('GET', hm_test.get('http_method'))
# cleanup test
self._delete_health_monitor(hm.get('id'))
@test.attr(type='smoke')
def test_create_health_monitor_missing_url_path(self):
@ -198,8 +185,6 @@ class TestHealthMonitors(base.BaseTestCase):
hm_test = self.health_monitors_client.get_health_monitor(hm.get('id'))
self.assertEqual(hm, hm_test)
self.assertEqual('/', hm_test.get('url_path'))
# cleanup test
self._delete_health_monitor(hm.get('id'))
@test.attr(type='smoke')
def test_create_health_monitor_missing_expected_codes(self):
@ -212,8 +197,6 @@ class TestHealthMonitors(base.BaseTestCase):
hm_test = self.health_monitors_client.get_health_monitor(hm.get('id'))
self.assertEqual(hm, hm_test)
self.assertEqual('200', hm_test.get('expected_codes'))
# cleanup test
self._delete_health_monitor(hm.get('id'))
@test.attr(type='negative')
def test_create_health_monitor_invalid_tenant_id(self):
@ -385,8 +368,6 @@ class TestHealthMonitors(base.BaseTestCase):
new_hm = self._update_health_monitor(
hm.get('id'), max_retries=max_retries)
self.assertEqual(max_retries, new_hm.get('max_retries'))
# cleanup test
self._delete_health_monitor(new_hm.get('id'))
@test.attr(type='smoke')
def test_update_health_monitor_missing_admin_state_up(self):
@ -397,9 +378,6 @@ class TestHealthMonitors(base.BaseTestCase):
new_hm = self._update_health_monitor(hm.get('id'))
self.assertEqual(True, new_hm.get('admin_state_up'))
# cleanup test
self._delete_health_monitor(new_hm.get('id'))
@test.attr(type='smoke')
def test_update_health_monitor_missing_delay(self):
"""Test update health monitor with missing delay field"""
@ -409,9 +387,6 @@ class TestHealthMonitors(base.BaseTestCase):
new_hm = self._update_health_monitor(hm.get('id'))
self.assertEqual(hm.get('delay'), new_hm.get('delay'))
# cleanup test
self._delete_health_monitor(new_hm.get('id'))
@test.attr(type='smoke')
def test_update_health_monitor_missing_timeout(self):
"""Test update health monitor with missing timeout field"""
@ -421,9 +396,6 @@ class TestHealthMonitors(base.BaseTestCase):
new_hm = self._update_health_monitor(hm.get('id'))
self.assertEqual(hm.get('timeout'), new_hm.get('timeout'))
# cleanup test
self._delete_health_monitor(new_hm.get('id'))
@test.attr(type='smoke')
def test_update_health_monitor_missing_max_retries(self):
"""Test update health monitor with missing max retries field"""
@ -433,9 +405,6 @@ class TestHealthMonitors(base.BaseTestCase):
new_hm = self._update_health_monitor(hm.get('id'))
self.assertEqual(hm.get('max_retries'), new_hm.get('max_retries'))
# cleanup test
self._delete_health_monitor(new_hm.get('id'))
@decorators.skip_because(bug="1437086")
@test.attr(type='smoke')
def test_update_health_monitor_missing_http_method(self):
@ -446,9 +415,6 @@ class TestHealthMonitors(base.BaseTestCase):
new_hm = self._update_health_monitor(hm.get('id'))
self.assertEqual(hm.get('http_method'), new_hm.get('http_method'))
# cleanup test
self._delete_health_monitor(new_hm.get('id'))
@decorators.skip_because(bug="1437086")
@test.attr(type='smoke')
def test_update_health_monitor_missing_url_path(self):
@ -459,9 +425,6 @@ class TestHealthMonitors(base.BaseTestCase):
new_hm = self._update_health_monitor(hm.get('id'))
self.assertEqual(hm.get('url_path'), new_hm.get('url_path'))
# cleanup test
self._delete_health_monitor(new_hm.get('id'))
@test.attr(type='smoke')
def test_update_health_monitor_missing_expected_codes(self):
"""Test update health monitor with missing expected_codes field"""
@ -472,9 +435,6 @@ class TestHealthMonitors(base.BaseTestCase):
self.assertEqual(hm.get('expected_codes'),
new_hm.get('expected_codes'))
# cleanup test
self._delete_health_monitor(new_hm.get('id'))
@test.attr(type='negative')
def test_udpate_health_monitor_invalid_attribute(self):
hm = self._create_health_monitor(type='HTTP', delay=3, max_retries=10,
@ -483,8 +443,6 @@ class TestHealthMonitors(base.BaseTestCase):
self.assertRaises(ex.BadRequest,
self._update_health_monitor,
hm.get('id'), max_retries='blue')
# cleanup test
self._delete_health_monitor(hm.get('id'))
@test.attr(type='negative')
def test_udpate_health_monitor_invalid_admin_state_up(self):
@ -494,8 +452,6 @@ class TestHealthMonitors(base.BaseTestCase):
self.assertRaises(ex.BadRequest,
self._update_health_monitor,
hm.get('id'), admin_state_up='blah')
# cleanup test
self._delete_health_monitor(hm.get('id'))
@test.attr(type='negative')
def test_udpate_health_monitor_invalid_delay(self):
@ -505,8 +461,6 @@ class TestHealthMonitors(base.BaseTestCase):
self.assertRaises(ex.BadRequest,
self._update_health_monitor,
hm.get('id'), delay='blah')
# cleanup test
self._delete_health_monitor(hm.get('id'))
@test.attr(type='negative')
def test_udpate_health_monitor_invalid_timeout(self):
@ -516,8 +470,6 @@ class TestHealthMonitors(base.BaseTestCase):
self.assertRaises(ex.BadRequest,
self._update_health_monitor,
hm.get('id'), timeout='blah')
# cleanup test
self._delete_health_monitor(hm.get('id'))
@test.attr(type='negative')
def test_udpate_health_monitor_invalid_max_retries(self):
@ -527,8 +479,6 @@ class TestHealthMonitors(base.BaseTestCase):
self.assertRaises(ex.BadRequest,
self._update_health_monitor,
hm.get('id'), max_retries='blah')
# cleanup test
self._delete_health_monitor(hm.get('id'))
@decorators.skip_because(bug="1437086")
@test.attr(type='negative')
@ -539,8 +489,6 @@ class TestHealthMonitors(base.BaseTestCase):
self.assertRaises(ex.BadRequest,
self._update_health_monitor,
hm.get('id'), http_method='blah')
# cleanup test
self._delete_health_monitor(hm.get('id'))
@decorators.skip_because(bug="1437086")
@test.attr(type='negative')
@ -551,8 +499,6 @@ class TestHealthMonitors(base.BaseTestCase):
self.assertRaises(ex.BadRequest,
self._update_health_monitor,
hm.get('id'), url_path='blah')
# cleanup test
self._delete_health_monitor(hm.get('id'))
@test.attr(type='negative')
def test_udpate_health_monitor_invalid_expected_codes(self):
@ -562,8 +508,6 @@ class TestHealthMonitors(base.BaseTestCase):
self.assertRaises(ex.BadRequest,
self._update_health_monitor,
hm.get('id'), expected_codes='blah')
# cleanup test
self._delete_health_monitor(hm.get('id'))
@test.attr(type='negative')
def test_update_health_monitor_empty_admin_state_up(self):
@ -573,8 +517,6 @@ class TestHealthMonitors(base.BaseTestCase):
self.assertRaises(ex.BadRequest,
self._update_health_monitor,
hm.get('id'), admin_state_up='')
# cleanup test
self._delete_health_monitor(hm.get('id'))
@test.attr(type='negative')
def test_update_health_monitor_empty_delay(self):
@ -584,8 +526,6 @@ class TestHealthMonitors(base.BaseTestCase):
self.assertRaises(ex.BadRequest,
self._update_health_monitor,
hm.get('id'), empty_delay='')
# cleanup test
self._delete_health_monitor(hm.get('id'))
@test.attr(type='negative')
def test_update_health_monitor_empty_timeout(self):
@ -595,8 +535,6 @@ class TestHealthMonitors(base.BaseTestCase):
self.assertRaises(ex.BadRequest,
self._update_health_monitor,
hm.get('id'), timeout='')
# cleanup test
self._delete_health_monitor(hm.get('id'))
@test.attr(type='negative')
def test_update_health_monitor_empty_max_retries(self):
@ -606,8 +544,6 @@ class TestHealthMonitors(base.BaseTestCase):
self.assertRaises(ex.BadRequest,
self._update_health_monitor,
hm.get('id'), max_retries='')
# cleanup test
self._delete_health_monitor(hm.get('id'))
@decorators.skip_because(bug="1437086")
@test.attr(type='negative')
@ -618,8 +554,6 @@ class TestHealthMonitors(base.BaseTestCase):
self.assertRaises(ex.BadRequest,
self._update_health_monitor,
hm.get('id'), http_method='')
# cleanup test
self._delete_health_monitor(hm.get('id'))
@decorators.skip_because(bug="1437086")
@test.attr(type='negative')
@ -630,8 +564,6 @@ class TestHealthMonitors(base.BaseTestCase):
self.assertRaises(ex.BadRequest,
self._update_health_monitor,
hm.get('id'), http_method='')
# cleanup test
self._delete_health_monitor(hm.get('id'))
@test.attr(type='negative')
def test_update_health_monitor_empty_expected_codes(self):
@ -641,8 +573,6 @@ class TestHealthMonitors(base.BaseTestCase):
self.assertRaises(ex.BadRequest,
self._update_health_monitor,
hm.get('id'), expected_codes='')
# cleanup test
self._delete_health_monitor(hm.get('id'))
@test.attr(type='smoke')
def test_update_health_monitor_extra_attribute(self):
@ -652,13 +582,11 @@ class TestHealthMonitors(base.BaseTestCase):
self.assertRaises(ex.BadRequest,
self._update_health_monitor,
hm.get('id'), protocol='UDP')
# cleanup test
self._delete_health_monitor(hm.get('id'))
@test.attr(type='smoke')
def test_delete_health_monitor(self):
hm = self._create_health_monitor(type='HTTP', delay=3, max_retries=10,
timeout=5,
hm = self._create_health_monitor(cleanup=False, type='HTTP', delay=3,
max_retries=10, timeout=5,
pool_id=self.pool.get('id'))
self._delete_health_monitor(hm.get('id'))
self.assertRaises(ex.NotFound,

View File

@ -69,13 +69,13 @@ class ListenersTestJSON(base.BaseAdminTestCase):
new_listener = self._create_listener(
**create_new_listener_kwargs)
new_listener_id = new_listener['id']
self.addCleanup(self._delete_listener, new_listener_id)
self._check_status_tree(
load_balancer_id=self.load_balancer_id,
listener_ids=[self.listener_id, new_listener_id])
listener = self.listeners_client.get_listener(
new_listener_id)
self.assertEqual(new_listener, listener)
self._delete_listener(new_listener_id)
@test.attr(type='smoke')
def test_create_listener_invalid_tenant_id(self):
@ -86,13 +86,13 @@ class ListenersTestJSON(base.BaseAdminTestCase):
new_listener = self._create_listener(
**create_new_listener_kwargs)
new_listener_id = new_listener['id']
self.addCleanup(self._delete_listener, new_listener_id)
self._check_status_tree(
load_balancer_id=self.load_balancer_id,
listener_ids=[self.listener_id, new_listener_id])
listener = self.listeners_client.get_listener(
new_listener_id)
self.assertEqual(new_listener, listener)
self._delete_listener(new_listener_id)
@test.attr(type='smoke')
def test_create_listener_missing_tenant_id(self):
@ -107,6 +107,7 @@ class ListenersTestJSON(base.BaseAdminTestCase):
admin_listener = self._create_listener(
**create_new_listener_kwargs)
admin_listener_id = admin_listener['id']
self.addCleanup(self._delete_listener, admin_listener_id)
self._check_status_tree(
load_balancer_id=self.load_balancer_id,
listener_ids=[self.listener_id, admin_listener_id])
@ -115,4 +116,3 @@ class ListenersTestJSON(base.BaseAdminTestCase):
self.assertEqual(admin_listener, listener)
self.assertEqual(admin_listener.get('tenant_id'),
listener.get('tenant_id'))
self._delete_listener(admin_listener_id)

View File

@ -59,8 +59,7 @@ class ListenersTestJSON(base.BaseTestCase):
cls.create_listener_kwargs = {'loadbalancer_id': cls.load_balancer_id,
'protocol': cls.protocol,
'protocol_port': cls.port}
cls.listener = cls._create_listener(
**cls.create_listener_kwargs)
cls.listener = cls._create_listener(**cls.create_listener_kwargs)
cls.listener_id = cls.listener['id']
@test.attr(type='smoke')
@ -89,6 +88,7 @@ class ListenersTestJSON(base.BaseTestCase):
new_listener = self._create_listener(
**create_new_listener_kwargs)
new_listener_id = new_listener['id']
self.addCleanup(self._delete_listener, new_listener_id)
self._check_status_tree(
load_balancer_id=self.load_balancer_id,
listener_ids=[self.listener_id, new_listener_id])
@ -97,7 +97,6 @@ class ListenersTestJSON(base.BaseTestCase):
self.assertIn(self.listener, listeners)
self.assertIn(new_listener, listeners)
self.assertNotEqual(self.listener, new_listener)
self._delete_listener(new_listener_id)
@test.attr(type='smoke')
def test_create_listener(self):
@ -107,6 +106,7 @@ class ListenersTestJSON(base.BaseTestCase):
new_listener = self._create_listener(
**create_new_listener_kwargs)
new_listener_id = new_listener['id']
self.addCleanup(self._delete_listener, new_listener_id)
self._check_status_tree(
load_balancer_id=self.load_balancer_id,
listener_ids=[self.listener_id, new_listener_id])
@ -114,7 +114,6 @@ class ListenersTestJSON(base.BaseTestCase):
new_listener_id)
self.assertEqual(new_listener, listener)
self.assertNotEqual(self.listener, new_listener)
self._delete_listener(new_listener_id)
@test.attr(type='negative')
def test_create_listener_missing_field_loadbalancer(self):
@ -154,6 +153,7 @@ class ListenersTestJSON(base.BaseTestCase):
new_listener = self._create_listener(
**create_new_listener_kwargs)
new_listener_id = new_listener['id']
self.addCleanup(self._delete_listener, new_listener_id)
self._check_status_tree(
load_balancer_id=self.load_balancer_id,
listener_ids=[self.listener_id, new_listener_id])
@ -161,7 +161,6 @@ class ListenersTestJSON(base.BaseTestCase):
new_listener_id)
self.assertEqual(new_listener, listener)
self.assertTrue(new_listener['admin_state_up'])
self._delete_listener(new_listener_id)
@test.attr(type='negative')
def test_create_listener_invalid_load_balancer_id(self):
@ -324,13 +323,13 @@ class ListenersTestJSON(base.BaseTestCase):
new_listener = self._create_listener(
**create_new_listener_kwargs)
new_listener_id = new_listener['id']
self.addCleanup(self._delete_listener, new_listener_id)
self._check_status_tree(
load_balancer_id=self.load_balancer_id,
listener_ids=[self.listener_id, new_listener_id])
listener = self.listeners_client.get_listener(
new_listener_id)
self.assertEqual(new_listener, listener)
self._delete_listener(new_listener_id)
@test.attr(type='smoke')
def test_create_listener_empty_description(self):
@ -341,13 +340,13 @@ class ListenersTestJSON(base.BaseTestCase):
new_listener = self._create_listener(
**create_new_listener_kwargs)
new_listener_id = new_listener['id']
self.addCleanup(self._delete_listener, new_listener_id)
self._check_status_tree(
load_balancer_id=self.load_balancer_id,
listener_ids=[self.listener_id, new_listener_id])
listener = self.listeners_client.get_listener(
new_listener_id)
self.assertEqual(new_listener, listener)
self._delete_listener(new_listener_id)
@test.attr(type='negative')
def test_create_listener_empty_connection_limit(self):
@ -564,8 +563,7 @@ class ListenersTestJSON(base.BaseTestCase):
"""Test delete listener"""
create_new_listener_kwargs = self.create_listener_kwargs
create_new_listener_kwargs['protocol_port'] = 8083
new_listener = self._create_listener(
**create_new_listener_kwargs)
new_listener = self._create_listener(**create_new_listener_kwargs)
new_listener_id = new_listener['id']
self._check_status_tree(
load_balancer_id=self.load_balancer_id,

View File

@ -61,12 +61,12 @@ class LoadBalancersTestJSON(base.BaseAdminTestCase):
"""
load_balancer = self.load_balancers_client.create_load_balancer(
vip_subnet_id=self.subnet['id'])
self.addCleanup(self._delete_load_balancer, load_balancer['id'])
admin_lb = self.load_balancers_client.get_load_balancer(
load_balancer.get('id'))
self.assertEqual(load_balancer.get('tenant_id'),
admin_lb.get('tenant_id'))
self._wait_for_load_balancer_status(load_balancer['id'])
self._delete_load_balancer(load_balancer['id'])
@test.attr(type='smoke')
def test_create_load_balancer_missing_tenant_id_for_other_tenant(self):
@ -77,10 +77,10 @@ class LoadBalancersTestJSON(base.BaseAdminTestCase):
"""
load_balancer = self.load_balancers_client.create_load_balancer(
vip_subnet_id=self.subnet['id'])
self.addCleanup(self._delete_load_balancer, load_balancer['id'])
self.assertNotEqual(load_balancer.get('tenant_id'),
self.subnet['tenant_id'])
self._wait_for_load_balancer_status(load_balancer['id'])
self._delete_load_balancer(load_balancer['id'])
@test.attr(type='smoke')
def test_create_load_balancer_empty_tenant_id_field(self):
@ -88,9 +88,9 @@ class LoadBalancersTestJSON(base.BaseAdminTestCase):
load_balancer = self.load_balancers_client.create_load_balancer(
vip_subnet_id=self.subnet['id'],
tenant_id="")
self.addCleanup(self._delete_load_balancer, load_balancer['id'])
self.assertEqual(load_balancer.get('tenant_id'), "")
self._wait_for_load_balancer_status(load_balancer['id'])
self._delete_load_balancer(load_balancer['id'])
@test.attr(type='smoke')
def test_create_load_balancer_for_another_tenant(self):
@ -99,6 +99,6 @@ class LoadBalancersTestJSON(base.BaseAdminTestCase):
load_balancer = self.load_balancers_client.create_load_balancer(
vip_subnet_id=self.subnet['id'],
tenant_id=tenant)
self.addCleanup(self._delete_load_balancer, load_balancer['id'])
self.assertEqual(load_balancer.get('tenant_id'), tenant)
self._wait_for_load_balancer_status(load_balancer['id'])
self._delete_load_balancer(load_balancer['id'])

View File

@ -70,12 +70,12 @@ class LoadBalancersTestJSON(base.BaseTestCase):
new_load_balancer = self._create_active_load_balancer(
**self.create_lb_kwargs)
new_load_balancer_id = new_load_balancer['id']
self.addCleanup(self._delete_load_balancer, new_load_balancer_id)
load_balancers = self.load_balancers_client.list_load_balancers()
self.assertEqual(len(load_balancers), 2)
self.assertIn(self.load_balancer, load_balancers)
self.assertIn(new_load_balancer, load_balancers)
self.assertNotEqual(self.load_balancer, new_load_balancer)
self._delete_load_balancer(new_load_balancer_id)
@test.attr(type='smoke')
def test_get_load_balancer(self):
@ -90,11 +90,11 @@ class LoadBalancersTestJSON(base.BaseTestCase):
new_load_balancer = self._create_active_load_balancer(
**self.create_lb_kwargs)
new_load_balancer_id = new_load_balancer['id']
self.addCleanup(self._delete_load_balancer, new_load_balancer_id)
load_balancer = self.load_balancers_client.get_load_balancer(
new_load_balancer_id)
self.assertEqual(new_load_balancer, load_balancer)
self.assertNotEqual(self.load_balancer, new_load_balancer)
self._delete_load_balancer(new_load_balancer_id)
@test.attr(type='negative')
def test_create_load_balancer_missing_vip_subnet_id_field(self):
@ -120,8 +120,8 @@ class LoadBalancersTestJSON(base.BaseTestCase):
"""Test create load balancer with an empty description field"""
load_balancer = self._create_active_load_balancer(
vip_subnet_id=self.subnet['id'], description="")
self.addCleanup(self._delete_load_balancer, load_balancer['id'])
self.assertEqual(load_balancer.get('description'), "")
self._delete_load_balancer(load_balancer['id'])
@test.attr(type='negative')
def test_create_load_balancer_empty_vip_address_field(self):
@ -137,8 +137,8 @@ class LoadBalancersTestJSON(base.BaseTestCase):
"""Test create load balancer with a missing admin_state_up field"""
load_balancer = self._create_active_load_balancer(
vip_subnet_id=self.subnet['id'])
self.addCleanup(self._delete_load_balancer, load_balancer['id'])
self.assertEqual(load_balancer.get('admin_state_up'), True)
self._delete_load_balancer(load_balancer['id'])
@test.attr(type='negative')
def test_create_load_balancer_empty_admin_state_up_field(self):
@ -154,27 +154,27 @@ class LoadBalancersTestJSON(base.BaseTestCase):
"""Test create load balancer with a missing name field"""
load_balancer = self.load_balancers_client.create_load_balancer(
vip_subnet_id=self.subnet['id'])
self.addCleanup(self._delete_load_balancer, load_balancer['id'])
self.assertEqual(load_balancer.get('name'), '')
self._wait_for_load_balancer_status(load_balancer['id'])
self._delete_load_balancer(load_balancer['id'])
@test.attr(type='smoke')
def test_create_load_balancer_empty_name(self):
"""Test create load balancer with an empty name field"""
load_balancer = self.load_balancers_client.create_load_balancer(
vip_subnet_id=self.subnet['id'], name="")
self.addCleanup(self._delete_load_balancer, load_balancer['id'])
self.assertEqual(load_balancer.get('name'), "")
self._wait_for_load_balancer_status(load_balancer['id'])
self._delete_load_balancer(load_balancer['id'])
@test.attr(type='smoke')
def test_create_load_balancer_missing_description(self):
"""Test create load balancer with a missing description field"""
load_balancer = self.load_balancers_client.create_load_balancer(
vip_subnet_id=self.subnet['id'])
self.addCleanup(self._delete_load_balancer, load_balancer['id'])
self.assertEqual(load_balancer.get('description'), '')
self._wait_for_load_balancer_status(load_balancer['id'])
self._delete_load_balancer(load_balancer['id'])
@test.attr(type='smoke')
def test_create_load_balancer_missing_vip_address(self):
@ -184,6 +184,7 @@ class LoadBalancersTestJSON(base.BaseTestCase):
"""
load_balancer = self._create_active_load_balancer(
vip_subnet_id=self.subnet['id'])
self.addCleanup(self._delete_load_balancer, load_balancer['id'])
load_balancer_ip_initial = load_balancer['vip_address']
ip = IPAddress(load_balancer_ip_initial)
self.assertEqual(ip.version, 4)
@ -191,19 +192,18 @@ class LoadBalancersTestJSON(base.BaseTestCase):
load_balancer['id'])
load_balancer_final = load_balancer['vip_address']
self.assertEqual(load_balancer_ip_initial, load_balancer_final)
self._delete_load_balancer(load_balancer['id'])
@test.attr(type='smoke')
def test_create_load_balancer_missing_provider_field(self):
"""Test create load balancer with a missing provider field"""
load_balancer = self._create_active_load_balancer(
vip_subnet_id=self.subnet['id'])
self.addCleanup(self._delete_load_balancer, load_balancer['id'])
load_balancer_initial = load_balancer['provider']
load_balancer = self.load_balancers_client.get_load_balancer(
load_balancer['id'])
load_balancer_final = load_balancer['provider']
self.assertEqual(load_balancer_initial, load_balancer_final)
self._delete_load_balancer(load_balancer['id'])
@test.attr(type='negative')
def test_create_load_balancer_invalid_vip_subnet_id(self):
@ -266,10 +266,10 @@ class LoadBalancersTestJSON(base.BaseTestCase):
"""Test create load balancer with a missing tenant id field"""
load_balancer = self.load_balancers_client.create_load_balancer(
vip_subnet_id=self.subnet['id'])
self.addCleanup(self._delete_load_balancer, load_balancer['id'])
self.assertEqual(load_balancer.get('tenant_id'),
self.subnet['tenant_id'])
self._wait_for_load_balancer_status(load_balancer['id'])
self._delete_load_balancer(load_balancer['id'])
@test.attr(type='negative')
def test_create_load_balancer_empty_tenant_id_field(self):

View File

@ -70,10 +70,9 @@ class MemberTestJSON(base.BaseAdminTestCase):
member_opts['subnet_id'] = self.subnet_id
member_opts['tenant_id'] = "$232!$pw"
member = self._create_member(self.pool_id, **member_opts)
self.addCleanup(self._delete_member, self.pool_id, member['id'])
self.assertEqual(member['subnet_id'], self.subnet_id)
self.assertEqual(member['tenant_id'], "$232!$pw")
self._delete_member(self.pool_id, member['id'])
self.assertEmpty(self.members_client.list_members(self.pool_id))
@test.attr(type='smoke')
def test_create_member_empty_tenant_id(self):
@ -84,7 +83,6 @@ class MemberTestJSON(base.BaseAdminTestCase):
member_opts['subnet_id'] = self.subnet_id
member_opts['tenant_id'] = ""
member = self._create_member(self.pool_id, **member_opts)
self.addCleanup(self._delete_member, self.pool_id, member['id'])
self.assertEqual(member['subnet_id'], self.subnet_id)
self.assertEqual(member['tenant_id'], "")
self._delete_member(self.pool_id, member['id'])
self.assertEmpty(self.members_client.list_members(self.pool_id))

View File

@ -81,7 +81,8 @@ class MemberTestJSON(base.BaseTestCase):
for ip in member_ips_exp:
member_opts = self.build_member_opts()
member_opts["address"] = ip
self._create_member(self.pool_id, **member_opts)
member = self._create_member(self.pool_id, **member_opts)
self.addCleanup(self._delete_member, self.pool_id, member['id'])
members = self.members_client.list_members(self.pool_id)
self.assertEqual(3, len(members))
for member in members:
@ -90,9 +91,6 @@ class MemberTestJSON(base.BaseTestCase):
self.assertEqual(member["subnet_id"], self.subnet_id)
found_member_ips = set([m["address"] for m in members])
self.assertEqual(found_member_ips, member_ips_exp)
for member in members:
self._delete_member(self.pool_id,
member["id"])
@test.attr(type='smoke')
def test_add_member(self):
@ -102,6 +100,7 @@ class MemberTestJSON(base.BaseTestCase):
member_opts = self.build_member_opts()
member = self._create_member(self.pool_id, **member_opts)
member_id = member.get("id")
self.addCleanup(self._delete_member, self.pool_id, member_id)
self.assertEqual(member_opts["address"], member["address"])
self.assertEqual(self.tenant_id, member["tenant_id"])
self.assertEqual(80, member["protocol_port"])
@ -109,8 +108,6 @@ class MemberTestJSON(base.BaseTestCase):
# Should have default values for admin_state_up and weight
self.assertEqual(True, member["admin_state_up"])
self.assertEqual(1, member["weight"])
self._delete_member(self.pool_id, member_id)
self.assertEmpty(self.members_client.list_members(self.pool_id))
@test.attr(type='smoke')
def test_get_member(self):
@ -118,14 +115,13 @@ class MemberTestJSON(base.BaseTestCase):
member_opts = self.build_member_opts()
member_id = self._create_member(self.pool_id,
**member_opts)["id"]
self.addCleanup(self._delete_member, self.pool_id, member_id)
member = self.members_client.get_member(self.pool_id, member_id)
self.assertEqual(member_id, member["id"])
self.assertEqual(member_opts["address"], member["address"])
self.assertEqual(member_opts["tenant_id"], member["tenant_id"])
self.assertEqual(member_opts["protocol_port"], member["protocol_port"])
self.assertEqual(member_opts["subnet_id"], member["subnet_id"])
self._delete_member(self.pool_id, member_id)
self.assertEmpty(self.members_client.list_members(self.pool_id))
@test.attr(type='smoke')
def test_create_member_missing_required_field_tenant_id(self):
@ -137,8 +133,7 @@ class MemberTestJSON(base.BaseTestCase):
member_opts['protocol_port'] = 80
member_opts['subnet_id'] = self.subnet_id
member = self._create_member(self.pool_id, **member_opts)
self._delete_member(self.pool_id, member['id'])
self.assertEmpty(self.members_client.list_members(self.pool_id))
self.addCleanup(self._delete_member, self.pool_id, member['id'])
@test.attr(type='negative')
def test_create_member_missing_required_field_address(self):
@ -319,6 +314,7 @@ class MemberTestJSON(base.BaseTestCase):
member = self._create_member(self.pool_id,
**member_opts)
member_id = member["id"]
self.addCleanup(self._delete_member, self.pool_id, member['id'])
# Make sure the defaults are correct
self.assertEqual(True, member["admin_state_up"])
self.assertEqual(1, member["weight"])
@ -329,9 +325,6 @@ class MemberTestJSON(base.BaseTestCase):
# And make sure they stick
self.assertEqual(False, member["admin_state_up"])
self.assertEqual(10, member["weight"])
self._delete_member(self.pool_id, member["id"])
members = self.members_client.list_members(self.pool_id)
self.assertEmpty(members)
@test.attr(type='smoke')
def test_update_member_missing_admin_state_up(self):
@ -340,6 +333,7 @@ class MemberTestJSON(base.BaseTestCase):
member = self._create_member(self.pool_id,
**member_opts)
member_id = member["id"]
self.addCleanup(self._delete_member, self.pool_id, member_id)
self.assertEqual(True, member["admin_state_up"])
self.assertEqual(1, member["weight"])
member_opts = {"weight": 10}
@ -347,9 +341,6 @@ class MemberTestJSON(base.BaseTestCase):
**member_opts)
self.assertEqual(True, member["admin_state_up"])
self.assertEqual(10, member["weight"])
self._delete_member(self.pool_id, member["id"])
members = self.members_client.list_members(self.pool_id)
self.assertEmpty(members)
@test.attr(type='smoke')
def test_update_member_missing_weight(self):
@ -358,6 +349,7 @@ class MemberTestJSON(base.BaseTestCase):
member = self._create_member(self.pool_id,
**member_opts)
member_id = member["id"]
self.addCleanup(self._delete_member, self.pool_id, member_id)
self.assertEqual(True, member["admin_state_up"])
self.assertEqual(1, member["weight"])
member_opts = {"admin_state_up": False}
@ -365,9 +357,6 @@ class MemberTestJSON(base.BaseTestCase):
**member_opts)
self.assertEqual(False, member["admin_state_up"])
self.assertEqual(1, member["weight"])
self._delete_member(self.pool_id, member["id"])
members = self.members_client.list_members(self.pool_id)
self.assertEmpty(members)
@test.attr(type='negative')
def test_update_member_invalid_admin_state_up(self):
@ -376,14 +365,12 @@ class MemberTestJSON(base.BaseTestCase):
member = self._create_member(self.pool_id,
**member_opts)
member_id = member["id"]
self.addCleanup(self._delete_member, self.pool_id, member_id)
self.assertEqual(True, member["admin_state_up"])
self.assertEqual(1, member["weight"])
member_opts = {"weight": 10, "admin_state_up": "%^67"}
self.assertRaises(ex.BadRequest, self._update_member,
self.pool_id, member_id, **member_opts)
self._delete_member(self.pool_id, member["id"])
members = self.members_client.list_members(self.pool_id)
self.assertEmpty(members)
@test.attr(type='negative')
def test_update_member_invalid_weight(self):
@ -392,14 +379,12 @@ class MemberTestJSON(base.BaseTestCase):
member = self._create_member(self.pool_id,
**member_opts)
member_id = member["id"]
self.addCleanup(self._delete_member, self.pool_id, member_id)
self.assertEqual(True, member["admin_state_up"])
self.assertEqual(1, member["weight"])
member_opts = {"admin_state_up": False, "weight": "*^$df"}
self.assertRaises(ex.BadRequest, self._update_member,
self.pool_id, member_id, **member_opts)
self._delete_member(self.pool_id, member["id"])
members = self.members_client.list_members(self.pool_id)
self.assertEmpty(members)
@test.attr(type='negative')
def test_update_member_empty_admin_state_up(self):
@ -408,14 +393,12 @@ class MemberTestJSON(base.BaseTestCase):
member = self._create_member(self.pool_id,
**member_opts)
member_id = member["id"]
self.addCleanup(self._delete_member, self.pool_id, member_id)
self.assertEqual(True, member["admin_state_up"])
self.assertEqual(1, member["weight"])
member_opts = {"weight": 10, "admin_state_up": ""}
self.assertRaises(ex.BadRequest, self._update_member,
self.pool_id, member_id, **member_opts)
self._delete_member(self.pool_id, member["id"])
members = self.members_client.list_members(self.pool_id)
self.assertEmpty(members)
@test.attr(type='negative')
def test_update_member_empty_weight(self):
@ -424,14 +407,12 @@ class MemberTestJSON(base.BaseTestCase):
member = self._create_member(self.pool_id,
**member_opts)
member_id = member["id"]
self.addCleanup(self._delete_member, self.pool_id, member_id)
self.assertEqual(True, member["admin_state_up"])
self.assertEqual(1, member["weight"])
member_opts = {"admin_state_up": False, "weight": ""}
self.assertRaises(ex.BadRequest, self._update_member,
self.pool_id, member_id, **member_opts)
self._delete_member(self.pool_id, member["id"])
members = self.members_client.list_members(self.pool_id)
self.assertEmpty(members)
@test.attr(type='negative')
def test_raises_immutable_when_updating_immutable_attrs_on_member(self):
@ -439,14 +420,12 @@ class MemberTestJSON(base.BaseTestCase):
member_opts = self.build_member_opts()
member_id = self._create_member(self.pool_id,
**member_opts)["id"]
self.addCleanup(self._delete_member, self.pool_id, member_id)
member_opts = {"address": "127.0.0.69"}
# The following code actually raises a 400 instead of a 422 as expected
# Will need to consult with blogan as to what to fix
self.assertRaises(ex.BadRequest, self._update_member,
self.pool_id, member_id, **member_opts)
self._delete_member(self.pool_id, member_id)
members = self.members_client.list_members(self.pool_id)
self.assertEmpty(members)
@test.attr(type='negative')
def test_raises_exception_on_invalid_attr_on_create(self):
@ -462,10 +441,10 @@ class MemberTestJSON(base.BaseTestCase):
member_opts = self.build_member_opts()
member = self._create_member(self.pool_id, **member_opts)
member_id = member["id"]
self.addCleanup(self._delete_member, self.pool_id, member_id)
member_opts["invalid_op"] = "watch_this_break"
self.assertRaises(ex.BadRequest, self._update_member,
self.pool_id, member_id, **member_opts)
self._delete_member(self.pool_id, member_id)
@classmethod
def build_member_opts(cls, **kw):

View File

@ -68,6 +68,7 @@ class TestPools(base.BaseAdminTestCase):
lb_algorithm=lb_algorithm,
listener_id=listener_id,
**kwargs)
self.addCleanup(self._delete_pool, response['id'])
return response
@decorators.skip_because(bug="1468457")
@ -79,7 +80,6 @@ class TestPools(base.BaseAdminTestCase):
pool = self.pools_client.get_pool(new_pool.get('id'))
pool_tenant = pool.get('tenant_id')
self.assertEqual(pool_tenant, '')
self._delete_pool(new_pool.get('id'))
@decorators.skip_because(bug="1468457")
@test.attr(type='smoke')
@ -95,7 +95,6 @@ class TestPools(base.BaseAdminTestCase):
pool = self.pools_client.get_pool(new_pool.get('id'))
pool_tenant = pool['tenant_id']
self.assertNotEqual(pool_tenant, self.subnet['tenant_id'])
self._delete_pool(new_pool.get('id'))
@decorators.skip_because(bug="1468457")
@test.attr(type='smoke')
@ -110,7 +109,6 @@ class TestPools(base.BaseAdminTestCase):
pool = self.pools_client.get_pool(new_pool.get('id'))
pool_tenant = pool['tenant_id']
self.assertEqual(pool_tenant, pool.get('tenant_id'))
self._delete_pool(new_pool.get('id'))
@decorators.skip_because(bug="1468457")
@test.attr(type='smoke')
@ -122,4 +120,3 @@ class TestPools(base.BaseAdminTestCase):
pool = self.pools_client.get_pool(new_pool.get('id'))
pool_tenant = pool.get('tenant_id')
self.assertEqual(pool_tenant, tenant)
self._delete_pool(new_pool.get('id'))

View File

@ -54,7 +54,7 @@ class TestPools(base.BaseTestCase):
PROTOCOL_PORT += 1
def _prepare_and_create_pool(self, protocol=None, lb_algorithm=None,
listener_id=None, **kwargs):
listener_id=None, cleanup=True, **kwargs):
self._wait_for_load_balancer_status(self.load_balancer.get('id'))
self.increment_protocol_port()
if not protocol:
@ -72,6 +72,8 @@ class TestPools(base.BaseTestCase):
listener_id=listener_id,
wait=True,
**kwargs)
if cleanup:
self.addCleanup(self._delete_pool, response['id'])
return response
@test.attr(type='smoke')
@ -88,7 +90,6 @@ class TestPools(base.BaseTestCase):
pools = self.pools_client.list_pools()
self.assertEqual(1, len(pools))
self.assertIn(new_pool, pools)
self._delete_pool(new_pool.get('id'))
@decorators.skip_because(bug="1497471")
@test.attr(type='smoke')
@ -100,9 +101,6 @@ class TestPools(base.BaseTestCase):
self.assertEqual(2, len(pools))
self.assertIn(new_pool1, pools)
self.assertIn(new_pool2, pools)
self._delete_pool(new_pool1.get('id'))
self._wait_for_load_balancer_status(self.load_balancer.get('id'))
self._delete_pool(new_pool2.get('id'))
@test.attr(type='smoke')
def test_get_pool(self):
@ -110,7 +108,6 @@ class TestPools(base.BaseTestCase):
new_pool = self._prepare_and_create_pool()
pool = self.pools_client.get_pool(new_pool.get('id'))
self.assertEqual(new_pool, pool)
self._delete_pool(new_pool.get('id'))
@test.attr(type='smoke')
def test_create_pool(self):
@ -118,7 +115,6 @@ class TestPools(base.BaseTestCase):
new_pool = self._prepare_and_create_pool()
pool = self.pools_client.get_pool(new_pool.get('id'))
self.assertEqual(new_pool, pool)
self._delete_pool(new_pool.get('id'))
@test.attr(type='negative')
def test_create_pool_missing_required_fields(self):
@ -139,7 +135,6 @@ class TestPools(base.BaseTestCase):
pool = self.pools_client.get_pool(new_pool.get('id'))
pool_tenant = pool['tenant_id']
self.assertEqual(tenant_id, pool_tenant)
self._delete_pool(new_pool.get('id'))
@decorators.skip_because(bug="1497471")
@test.attr(type='negative')
@ -149,6 +144,7 @@ class TestPools(base.BaseTestCase):
listener = self.listeners_client.create_listener(
loadbalancer_id=self.load_balancer.get('id'),
protocol='HTTP', protocol_port=PROTOCOL_PORT)
self.addCleanup(self._delete_listener, listener['id'])
self._wait_for_load_balancer_status(self.load_balancer.get('id'))
listener_id = listener.get('id')
tenant_id = self.subnet.get('tenant_id')
@ -165,6 +161,7 @@ class TestPools(base.BaseTestCase):
listener = self.listeners_client.create_listener(
loadbalancer_id=self.load_balancer.get('id'),
protocol='HTTP', protocol_port=PROTOCOL_PORT)
self.addCleanup(self._delete_listener, listener['id'])
self._wait_for_load_balancer_status(self.load_balancer.get('id'))
listener_id = listener.get('id')
tenant_id = self.subnet.get('tenant_id')
@ -191,7 +188,6 @@ class TestPools(base.BaseTestCase):
pool_initial = self.pools_client.get_pool(new_pool.get('id'))
desc = pool_initial.get('description')
self.assertEqual(desc, "")
self._delete_pool(new_pool.get('id'))
@decorators.skip_because(bug="1497471")
@test.attr(type='smoke')
@ -202,7 +198,6 @@ class TestPools(base.BaseTestCase):
pool_initial = self.pools_client.get_pool(new_pool.get('id'))
name = pool_initial.get('name')
self.assertEqual(name, "")
self._delete_pool(new_pool.get('id'))
@decorators.skip_because(bug="1497471")
@test.attr(type='smoke')
@ -213,7 +208,6 @@ class TestPools(base.BaseTestCase):
pool_initial = self.pools_client.get_pool(new_pool.get('id'))
state = pool_initial.get('admin_state_up')
self.assertEqual(state, True)
self._delete_pool(new_pool.get('id'))
@decorators.skip_because(bug="1497471")
@test.attr(type='smoke')
@ -224,7 +218,6 @@ class TestPools(base.BaseTestCase):
pool_initial = self.pools_client.get_pool(new_pool.get('id'))
sess = pool_initial.get('session_persistence')
self.assertIsNone(sess)
self._delete_pool(new_pool.get('id'))
@test.attr(type='negative')
def test_create_pool_invalid_protocol(self):
@ -274,6 +267,7 @@ class TestPools(base.BaseTestCase):
listener = self.listeners_client.create_listener(
loadbalancer_id=self.load_balancer.get('id'),
protocol='HTTP', protocol_port=PROTOCOL_PORT)
self.addCleanup(self._delete_listener, listener['id'])
self._wait_for_load_balancer_status(self.load_balancer.get('id'))
listener_id = listener.get('id')
self.assertRaises(ex.BadRequest, self._create_pool,
@ -307,7 +301,6 @@ class TestPools(base.BaseTestCase):
pool = self.pools_client.get_pool(new_pool.get('id'))
pool_desc = pool.get('description')
self.assertEqual(pool_desc, '')
self._delete_pool(new_pool.get('id'))
@test.attr(type='smoke')
def test_create_pool_empty_name_field(self):
@ -316,7 +309,6 @@ class TestPools(base.BaseTestCase):
pool = self.pools_client.get_pool(new_pool.get('id'))
pool_name = pool.get('name')
self.assertEqual(pool_name, '')
self._delete_pool(new_pool.get('id'))
@test.attr(type='negative')
def test_create_pool_empty_protocol(self):
@ -406,7 +398,6 @@ class TestPools(base.BaseTestCase):
session_persistence={'type': 'HTTP_COOKIE'})
pool = self.pools_client.get_pool(new_pool.get('id'))
self.assertEqual(new_pool, pool)
self._delete_pool(new_pool.get('id'))
@test.attr(type='smoke')
def test_create_pool_with_session_persistence_app_cookie(self):
@ -416,7 +407,6 @@ class TestPools(base.BaseTestCase):
'cookie_name': 'sessionId'})
pool = self.pools_client.get_pool(new_pool.get('id'))
self.assertEqual(new_pool, pool)
self._delete_pool(new_pool.get('id'))
@test.attr(type='negative')
def test_create_pool_with_session_persistence_redundant_cookie_name(self):
@ -448,7 +438,6 @@ class TestPools(base.BaseTestCase):
description=desc,
wait=True)
self.assertEqual(desc, pool.get('description'))
self._delete_pool(new_pool.get('id'))
@decorators.skip_because(bug="1497471")
@test.attr(type='smoke')
@ -460,7 +449,6 @@ class TestPools(base.BaseTestCase):
pool = self.pools_client.update_pool(new_pool.get('id'))
self._wait_for_load_balancer_status(self.load_balancer.get('id'))
self.assertEqual(name, pool.get('name'))
self._delete_pool(new_pool.get('id'))
@decorators.skip_because(bug="1497471")
@test.attr(type='smoke')
@ -472,7 +460,6 @@ class TestPools(base.BaseTestCase):
pool = self.pools_client.update_pool(new_pool.get('id'))
self._wait_for_load_balancer_status(self.load_balancer.get('id'))
self.assertEqual(desc, pool.get('description'))
self._delete_pool(new_pool.get('id'))
@decorators.skip_because(bug="1497471")
@test.attr(type='smoke')
@ -484,7 +471,6 @@ class TestPools(base.BaseTestCase):
pool = self.pools_client.update_pool(new_pool.get('id'))
self._wait_for_load_balancer_status(self.load_balancer.get('id'))
self.assertEqual(admin, pool.get('admin_state_up'))
self._delete_pool(new_pool.get('id'))
@decorators.skip_because(bug="1497471")
@test.attr(type='smoke')
@ -493,10 +479,8 @@ class TestPools(base.BaseTestCase):
new_pool = self._prepare_and_create_pool()
pool_initial = self.pools_client.get_pool(new_pool.get('id'))
sess_pers = pool_initial.get('session_persistence')
pool = self.pools_client.update_pool(new_pool.get('id'))
pool = self._update_pool(new_pool.get('id'))
self.assertAlmostEqual(sess_pers, pool.get('session_persistence'))
self._wait_for_load_balancer_status(self.load_balancer.get('id'))
self._delete_pool(new_pool.get('id'))
@decorators.skip_because(bug="1434717")
@test.attr(type='negative')
@ -505,7 +489,6 @@ class TestPools(base.BaseTestCase):
new_pool = self._prepare_and_create_pool()
self.assertRaises(ex.BadRequest, self.pools_client.update_pool,
new_pool.get('id'), name='n' * 256)
self._delete_pool(new_pool.get('id'))
@decorators.skip_because(bug="1434717")
@test.attr(type='negative')
@ -515,7 +498,6 @@ class TestPools(base.BaseTestCase):
self.assertRaises(ex.BadRequest, self.pools_client.update_pool,
new_pool.get('id'),
description='d' * 256)
self._delete_pool(new_pool.get('id'))
@decorators.skip_because(bug="1497471")
@test.attr(type='negative')
@ -524,7 +506,6 @@ class TestPools(base.BaseTestCase):
new_pool = self._prepare_and_create_pool()
self.assertRaises(ex.BadRequest, self.pools_client.update_pool,
new_pool.get('id'), admin_state_up='hello')
self._delete_pool(new_pool.get('id'))
@decorators.skip_because(bug="1497471")
@test.attr(type='negative')
@ -534,7 +515,6 @@ class TestPools(base.BaseTestCase):
self.assertRaises(ex.BadRequest, self.pools_client.update_pool,
new_pool.get('id'),
session_persistence={'type': 'Hello'})
self._delete_pool(new_pool.get('id'))
@decorators.skip_because(bug="1497471")
@test.attr(type='smoke')
@ -544,7 +524,6 @@ class TestPools(base.BaseTestCase):
pool = self.pools_client.update_pool(new_pool.get('id'), name="")
self._wait_for_load_balancer_status(self.load_balancer.get('id'))
self.assertEqual(pool.get('name'), "")
self._delete_pool(new_pool.get('id'))
@decorators.skip_because(bug="1497471")
@test.attr(type='smoke')
@ -555,7 +534,6 @@ class TestPools(base.BaseTestCase):
description="")
self._wait_for_load_balancer_status(self.load_balancer.get('id'))
self.assertEqual(pool.get('description'), "")
self._delete_pool(new_pool.get('id'))
@decorators.skip_because(bug="1497471")
@test.attr(type='negative')
@ -564,7 +542,6 @@ class TestPools(base.BaseTestCase):
new_pool = self._prepare_and_create_pool()
self.assertRaises(ex.BadRequest, self.pools_client.update_pool,
new_pool.get('id'), admin_state_up="")
self._delete_pool(new_pool.get('id'))
@decorators.skip_because(bug="1497471")
@test.attr(type='negative')
@ -574,7 +551,6 @@ class TestPools(base.BaseTestCase):
self.assertRaises(ex.BadRequest, self.pools_client.update_pool,
new_pool.get('id'),
session_persistence="")
self.pools_client.delete_pool(new_pool.get('id'))
@decorators.skip_because(bug="1497471")
@test.attr(type='negative')
@ -583,7 +559,6 @@ class TestPools(base.BaseTestCase):
new_pool = self._prepare_and_create_pool()
self.assertRaises(ex.BadRequest, self._update_pool,
new_pool.get('id'), lb_algorithm='ROUNDED')
self._delete_pool(new_pool.get('id'))
@decorators.skip_because(bug="1497471")
@test.attr(type='negative')
@ -592,12 +567,11 @@ class TestPools(base.BaseTestCase):
new_pool = self._prepare_and_create_pool()
self.assertRaises(ex.BadRequest, self._update_pool,
new_pool.get('id'), protocol='HTTPS')
self._delete_pool(new_pool.get('id'))
@test.attr(type='smoke')
def test_delete_pool(self):
"""Test delete pool"""
new_pool = self._prepare_and_create_pool()
new_pool = self._prepare_and_create_pool(cleanup=False)
pool = self.pools_client.get_pool(new_pool.get('id'))
self.assertEqual(new_pool, pool)
self._delete_pool(new_pool.get('id'))
@ -608,7 +582,7 @@ class TestPools(base.BaseTestCase):
@test.attr(type='smoke')
def test_delete_invalid_pool(self):
"""Test delete pool that doesn't exist"""
new_pool = self._prepare_and_create_pool()
new_pool = self._prepare_and_create_pool(cleanup=False)
pool = self.pools_client.get_pool(new_pool.get('id'))
self.assertEqual(new_pool, pool)
self._delete_pool(new_pool.get('id'))