Fix order of arguments in assertEqual
assertEqual expects that the arguments provided to it should be (expected, observed).If a particluar order is kept as a convention, then it helps to provide a cleaner message to the developer if Unit Tests fail. There are several Unit Test files where the arguments for assertEqual have been swapped. This commit fixes the issue in lbaas. Change-Id: I890deda05a26c9f84d7e2884970d051faa30830c Partial-Bug: #1259292 Related-Bug: #1259292
This commit is contained in:
parent
97a91376e7
commit
c37f43b27e
@ -28,8 +28,8 @@ class TestApiCache(base.BaseTestCase):
|
||||
self.api = api.LbaasAgentApi('topic', mock.sentinel.context, 'host')
|
||||
|
||||
def test_init(self):
|
||||
self.assertEqual(self.api.host, 'host')
|
||||
self.assertEqual(self.api.context, mock.sentinel.context)
|
||||
self.assertEqual('host', self.api.host)
|
||||
self.assertEqual(mock.sentinel.context, self.api.context)
|
||||
|
||||
def _test_method(self, method, **kwargs):
|
||||
add_host = ('get_ready_devices', 'plug_vip_port', 'unplug_vip_port')
|
||||
@ -47,7 +47,7 @@ class TestApiCache(base.BaseTestCase):
|
||||
rpc_mock.return_value = 'foo'
|
||||
rv = getattr(self.api, method)(**kwargs)
|
||||
|
||||
self.assertEqual(rv, 'foo')
|
||||
self.assertEqual('foo', rv)
|
||||
|
||||
prepare_args = {}
|
||||
prepare_mock.assert_called_once_with(**prepare_args)
|
||||
|
@ -94,8 +94,8 @@ class TestBarbicanCert(base.BaseTestCase):
|
||||
)
|
||||
|
||||
# Validate the cert functions
|
||||
self.assertEqual(cert.get_certificate(), self.certificate)
|
||||
self.assertEqual(cert.get_intermediates(), self.intermediates)
|
||||
self.assertEqual(cert.get_private_key(), self.private_key)
|
||||
self.assertEqual(cert.get_private_key_passphrase(),
|
||||
self.private_key_passphrase)
|
||||
self.assertEqual(self.certificate, cert.get_certificate())
|
||||
self.assertEqual(self.intermediates, cert.get_intermediates())
|
||||
self.assertEqual(self.private_key, cert.get_private_key())
|
||||
self.assertEqual(self.private_key_passphrase,
|
||||
cert.get_private_key_passphrase())
|
||||
|
@ -42,11 +42,11 @@ class TestLocalCert(base.BaseTestCase):
|
||||
)
|
||||
|
||||
# Validate the cert functions
|
||||
self.assertEqual(cert.get_certificate(), self.certificate)
|
||||
self.assertEqual(cert.get_intermediates(), self.intermediates)
|
||||
self.assertEqual(cert.get_private_key(), self.private_key)
|
||||
self.assertEqual(cert.get_private_key_passphrase(),
|
||||
self.private_key_passphrase)
|
||||
self.assertEqual(self.certificate, cert.get_certificate())
|
||||
self.assertEqual(self.intermediates, cert.get_intermediates())
|
||||
self.assertEqual(self.private_key, cert.get_private_key())
|
||||
self.assertEqual(self.private_key_passphrase,
|
||||
cert.get_private_key_passphrase())
|
||||
|
||||
|
||||
class TestLocalManager(base.BaseTestCase):
|
||||
|
@ -237,11 +237,11 @@ def _get_rsa_numbers(private_key, private_key_passphrase=None):
|
||||
class TestTLSParseUtils(base.BaseTestCase):
|
||||
def test_alt_subject_name_parses(self):
|
||||
hosts = cert_parser.get_host_names(ALT_EXT_CRT)
|
||||
self.assertEqual(hosts['cn'], 'www.CNFromSubject.org')
|
||||
self.assertEqual(hosts['dns_names'][0], 'www.hostFrom_dNSName1.com')
|
||||
self.assertEqual(hosts['dns_names'][1], 'www.hostFrom_dNSName2.com')
|
||||
self.assertEqual(hosts['dns_names'][2], 'www.hostFrom_dNSName3.com')
|
||||
self.assertEqual(hosts['dns_names'][3], 'www.hostFrom_dNSName4.com')
|
||||
self.assertEqual('www.CNFromSubject.org', hosts['cn'])
|
||||
self.assertEqual('www.hostFrom_dNSName1.com', hosts['dns_names'][0])
|
||||
self.assertEqual('www.hostFrom_dNSName2.com', hosts['dns_names'][1])
|
||||
self.assertEqual('www.hostFrom_dNSName3.com', hosts['dns_names'][2])
|
||||
self.assertEqual('www.hostFrom_dNSName4.com', hosts['dns_names'][3])
|
||||
|
||||
def test_x509_parses(self):
|
||||
self.assertRaises(exceptions.UnreadableCert,
|
||||
|
@ -136,7 +136,7 @@ class LoadBalancerTestMixin(object):
|
||||
vip_req = self.new_create_request('vips', data, fmt)
|
||||
vip_res = vip_req.get_response(self.ext_api)
|
||||
if expected_res_status:
|
||||
self.assertEqual(vip_res.status_int, expected_res_status)
|
||||
self.assertEqual(expected_res_status, vip_res.status_int)
|
||||
|
||||
return vip_res
|
||||
|
||||
@ -154,7 +154,7 @@ class LoadBalancerTestMixin(object):
|
||||
pool_req = self.new_create_request('pools', data, fmt)
|
||||
pool_res = pool_req.get_response(self.ext_api)
|
||||
if expected_res_status:
|
||||
self.assertEqual(pool_res.status_int, expected_res_status)
|
||||
self.assertEqual(expected_res_status, pool_res.status_int)
|
||||
|
||||
return pool_res
|
||||
|
||||
@ -171,7 +171,7 @@ class LoadBalancerTestMixin(object):
|
||||
member_req = self.new_create_request('members', data, fmt)
|
||||
member_res = member_req.get_response(self.ext_api)
|
||||
if expected_res_status:
|
||||
self.assertEqual(member_res.status_int, expected_res_status)
|
||||
self.assertEqual(expected_res_status, member_res.status_int)
|
||||
|
||||
return member_res
|
||||
|
||||
@ -192,7 +192,7 @@ class LoadBalancerTestMixin(object):
|
||||
|
||||
res = req.get_response(self.ext_api)
|
||||
if expected_res_status:
|
||||
self.assertEqual(res.status_int, expected_res_status)
|
||||
self.assertEqual(expected_res_status, res.status_int)
|
||||
|
||||
return res
|
||||
|
||||
@ -376,9 +376,9 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
self.assertTrue(vip['vip'].get(k, None))
|
||||
|
||||
self.assertEqual(
|
||||
expected,
|
||||
dict((k, v)
|
||||
for k, v in vip['vip'].items() if k in expected),
|
||||
expected
|
||||
for k, v in vip['vip'].items() if k in expected)
|
||||
)
|
||||
return vip
|
||||
|
||||
@ -469,7 +469,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
# check that pool1.vip became None
|
||||
self.assertIsNone(db_pool1.vip)
|
||||
# and pool2 got vip
|
||||
self.assertEqual(db_pool2.vip.id, vip['vip']['id'])
|
||||
self.assertEqual(vip['vip']['id'], db_pool2.vip.id)
|
||||
|
||||
def test_create_vip_with_invalid_values(self):
|
||||
invalid = {
|
||||
@ -528,8 +528,8 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
data = {'vip': {'pool_id': pool['pool']['id']}}
|
||||
req = self.new_update_request('vips', data, vip['vip']['id'])
|
||||
res = req.get_response(self.ext_api)
|
||||
self.assertEqual(res.status_int,
|
||||
webob.exc.HTTPClientError.code)
|
||||
self.assertEqual(webob.exc.HTTPClientError.code,
|
||||
res.status_int)
|
||||
|
||||
def test_reset_session_persistence(self):
|
||||
name = 'vip4'
|
||||
@ -539,8 +539,8 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
|
||||
with self.vip(name=name, session_persistence=session_persistence) as v:
|
||||
# Ensure that vip has been created properly
|
||||
self.assertEqual(v['vip']['session_persistence'],
|
||||
session_persistence)
|
||||
self.assertEqual(session_persistence,
|
||||
v['vip']['session_persistence'])
|
||||
|
||||
# Try resetting session_persistence
|
||||
req = self.new_update_request('vips', update_info, v['vip']['id'])
|
||||
@ -568,7 +568,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
req = self.new_update_request('vips', data, vip['vip']['id'])
|
||||
res = self.deserialize(self.fmt, req.get_response(self.ext_api))
|
||||
for k, v in keys:
|
||||
self.assertEqual(res['vip'][k], v)
|
||||
self.assertEqual(v, res['vip'][k])
|
||||
|
||||
def test_delete_vip(self):
|
||||
with self.pool():
|
||||
@ -576,7 +576,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
req = self.new_delete_request('vips',
|
||||
vip['vip']['id'])
|
||||
res = req.get_response(self.ext_api)
|
||||
self.assertEqual(res.status_int, webob.exc.HTTPNoContent.code)
|
||||
self.assertEqual(webob.exc.HTTPNoContent.code, res.status_int)
|
||||
|
||||
def test_show_vip(self):
|
||||
name = "vip_show"
|
||||
@ -592,7 +592,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
vip['vip']['id'])
|
||||
res = self.deserialize(self.fmt, req.get_response(self.ext_api))
|
||||
for k, v in keys:
|
||||
self.assertEqual(res['vip'][k], v)
|
||||
self.assertEqual(v, res['vip'][k])
|
||||
|
||||
def test_list_vips(self):
|
||||
name = "vips_list"
|
||||
@ -607,9 +607,9 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
keys.append(('subnet_id', vip['vip']['subnet_id']))
|
||||
req = self.new_list_request('vips')
|
||||
res = self.deserialize(self.fmt, req.get_response(self.ext_api))
|
||||
self.assertEqual(len(res['vips']), 1)
|
||||
self.assertEqual(1, len(res['vips']))
|
||||
for k, v in keys:
|
||||
self.assertEqual(res['vips'][0][k], v)
|
||||
self.assertEqual(v, res['vips'][0][k])
|
||||
|
||||
def test_list_vips_with_sort_emulated(self):
|
||||
with self.subnet() as subnet:
|
||||
@ -679,8 +679,8 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
'description': ''}
|
||||
self.plugin.create_pool(ctx, {'pool': pool})
|
||||
assoc = ctx.session.query(sdb.ProviderResourceAssociation).one()
|
||||
self.assertEqual(assoc.provider_name,
|
||||
pconf.normalize_provider_name(provider_name))
|
||||
self.assertEqual(pconf.normalize_provider_name(provider_name),
|
||||
assoc.provider_name)
|
||||
|
||||
def test_create_pool_another_provider(self):
|
||||
self._create_pool_directly_via_plugin('lbaas')
|
||||
@ -705,7 +705,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
|
||||
with self.pool(name=name) as pool:
|
||||
for k, v in keys:
|
||||
self.assertEqual(pool['pool'][k], v)
|
||||
self.assertEqual(v, pool['pool'][k])
|
||||
|
||||
def test_create_pool_with_members(self):
|
||||
name = "pool2"
|
||||
@ -728,7 +728,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
member1 = self.deserialize(self.fmt, res1)
|
||||
self.assertEqual(member1['member']['id'],
|
||||
pool_updated['pool']['members'][0])
|
||||
self.assertEqual(len(pool_updated['pool']['members']), 1)
|
||||
self.assertEqual(1, len(pool_updated['pool']['members']))
|
||||
|
||||
keys = [('address', '192.168.1.100'),
|
||||
('protocol_port', 80),
|
||||
@ -737,7 +737,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
('admin_state_up', True),
|
||||
('status', 'PENDING_CREATE')]
|
||||
for k, v in keys:
|
||||
self.assertEqual(member1['member'][k], v)
|
||||
self.assertEqual(v, member1['member'][k])
|
||||
self._delete('members', member1['member']['id'])
|
||||
|
||||
def test_delete_pool(self):
|
||||
@ -747,7 +747,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
req = self.new_delete_request('pools',
|
||||
pool['pool']['id'])
|
||||
res = req.get_response(self.ext_api)
|
||||
self.assertEqual(res.status_int, webob.exc.HTTPNoContent.code)
|
||||
self.assertEqual(webob.exc.HTTPNoContent.code, res.status_int)
|
||||
|
||||
def test_delete_pool_preserve_state(self):
|
||||
with self.pool(do_delete=False) as pool:
|
||||
@ -755,16 +755,16 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
req = self.new_delete_request('pools',
|
||||
pool['pool']['id'])
|
||||
res = req.get_response(self.ext_api)
|
||||
self.assertEqual(res.status_int, webob.exc.HTTPConflict.code)
|
||||
self.assertEqual(webob.exc.HTTPConflict.code, res.status_int)
|
||||
req = self.new_show_request('pools',
|
||||
pool['pool']['id'],
|
||||
fmt=self.fmt)
|
||||
res = req.get_response(self.ext_api)
|
||||
self.assertEqual(res.status_int, webob.exc.HTTPOk.code)
|
||||
self.assertEqual(webob.exc.HTTPOk.code, res.status_int)
|
||||
res = self.deserialize(self.fmt,
|
||||
req.get_response(self.ext_api))
|
||||
self.assertEqual(res['pool']['status'],
|
||||
constants.PENDING_CREATE)
|
||||
self.assertEqual(constants.PENDING_CREATE,
|
||||
res['pool']['status'])
|
||||
req = self.new_delete_request('pools',
|
||||
pool['pool']['id'])
|
||||
|
||||
@ -802,7 +802,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
fmt=self.fmt)
|
||||
res = self.deserialize(self.fmt, req.get_response(self.ext_api))
|
||||
for k, v in keys:
|
||||
self.assertEqual(res['pool'][k], v)
|
||||
self.assertEqual(v, res['pool'][k])
|
||||
|
||||
def test_list_pools_with_sort_emulated(self):
|
||||
with contextlib.nested(self.pool(name='p1'),
|
||||
@ -888,7 +888,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
self.fmt,
|
||||
req.get_response(self.ext_api)
|
||||
)
|
||||
self.assertEqual(len(pool1_update['pool']['members']), 1)
|
||||
self.assertEqual(1, len(pool1_update['pool']['members']))
|
||||
|
||||
req = self.new_show_request('pools',
|
||||
pool2['pool']['id'],
|
||||
@ -897,8 +897,8 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
self.fmt,
|
||||
req.get_response(self.ext_api)
|
||||
)
|
||||
self.assertEqual(len(pool1_update['pool']['members']), 1)
|
||||
self.assertEqual(len(pool2_update['pool']['members']), 0)
|
||||
self.assertEqual(1, len(pool1_update['pool']['members']))
|
||||
self.assertEqual(0, len(pool2_update['pool']['members']))
|
||||
|
||||
data = {'member': {'pool_id': pool2['pool']['id'],
|
||||
'weight': 10,
|
||||
@ -911,7 +911,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
req.get_response(self.ext_api)
|
||||
)
|
||||
for k, v in keys:
|
||||
self.assertEqual(res['member'][k], v)
|
||||
self.assertEqual(v, res['member'][k])
|
||||
|
||||
req = self.new_show_request('pools',
|
||||
pool1['pool']['id'],
|
||||
@ -929,8 +929,8 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
req.get_response(self.ext_api)
|
||||
)
|
||||
|
||||
self.assertEqual(len(pool2_update['pool']['members']), 1)
|
||||
self.assertEqual(len(pool1_update['pool']['members']), 0)
|
||||
self.assertEqual(1, len(pool2_update['pool']['members']))
|
||||
self.assertEqual(0, len(pool1_update['pool']['members']))
|
||||
|
||||
def test_delete_member(self):
|
||||
with self.pool() as pool:
|
||||
@ -940,7 +940,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
req = self.new_delete_request('members',
|
||||
member['member']['id'])
|
||||
res = req.get_response(self.ext_api)
|
||||
self.assertEqual(res.status_int, webob.exc.HTTPNoContent.code)
|
||||
self.assertEqual(webob.exc.HTTPNoContent.code, res.status_int)
|
||||
|
||||
req = self.new_show_request('pools',
|
||||
pool_id,
|
||||
@ -949,7 +949,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
self.fmt,
|
||||
req.get_response(self.ext_api)
|
||||
)
|
||||
self.assertEqual(len(pool_update['pool']['members']), 0)
|
||||
self.assertEqual(0, len(pool_update['pool']['members']))
|
||||
|
||||
def test_show_member(self):
|
||||
with self.pool() as pool:
|
||||
@ -969,7 +969,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
req.get_response(self.ext_api)
|
||||
)
|
||||
for k, v in keys:
|
||||
self.assertEqual(res['member'][k], v)
|
||||
self.assertEqual(v, res['member'][k])
|
||||
|
||||
def test_list_members_with_sort_emulated(self):
|
||||
with self.pool() as pool:
|
||||
@ -1018,7 +1018,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
('admin_state_up', True)]
|
||||
with self.health_monitor() as monitor:
|
||||
for k, v in keys:
|
||||
self.assertEqual(monitor['health_monitor'][k], v)
|
||||
self.assertEqual(v, monitor['health_monitor'][k])
|
||||
|
||||
def test_create_health_monitor_with_timeout_delay_invalid(self):
|
||||
data = {'health_monitor': {'type': type,
|
||||
@ -1060,7 +1060,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
monitor['health_monitor']['id'])
|
||||
res = self.deserialize(self.fmt, req.get_response(self.ext_api))
|
||||
for k, v in keys:
|
||||
self.assertEqual(res['health_monitor'][k], v)
|
||||
self.assertEqual(v, res['health_monitor'][k])
|
||||
|
||||
def test_delete_healthmonitor(self):
|
||||
with self.health_monitor(do_delete=False) as monitor:
|
||||
@ -1072,7 +1072,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
req = self.new_delete_request('health_monitors',
|
||||
monitor['health_monitor']['id'])
|
||||
res = req.get_response(self.ext_api)
|
||||
self.assertEqual(res.status_int, webob.exc.HTTPNoContent.code)
|
||||
self.assertEqual(webob.exc.HTTPNoContent.code, res.status_int)
|
||||
qry = ctx.session.query(ldb.HealthMonitor)
|
||||
qry = qry.filter_by(id=monitor['health_monitor']['id'])
|
||||
self.assertIsNone(qry.first())
|
||||
@ -1093,7 +1093,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
id=pool['pool']['id'],
|
||||
subresource='health_monitors')
|
||||
res = req.get_response(self.ext_api)
|
||||
self.assertEqual(res.status_int, webob.exc.HTTPCreated.code)
|
||||
self.assertEqual(webob.exc.HTTPCreated.code, res.status_int)
|
||||
|
||||
ctx = context.get_admin_context()
|
||||
|
||||
@ -1107,7 +1107,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
monitor['health_monitor']['id']
|
||||
)
|
||||
res = req.get_response(self.ext_api)
|
||||
self.assertEqual(res.status_int, webob.exc.HTTPConflict.code)
|
||||
self.assertEqual(webob.exc.HTTPConflict.code, res.status_int)
|
||||
|
||||
qry = ctx.session.query(ldb.HealthMonitor)
|
||||
qry = qry.filter_by(id=monitor['health_monitor']['id'])
|
||||
@ -1130,7 +1130,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
fmt=self.fmt)
|
||||
res = self.deserialize(self.fmt, req.get_response(self.ext_api))
|
||||
for k, v in keys:
|
||||
self.assertEqual(res['health_monitor'][k], v)
|
||||
self.assertEqual(v, res['health_monitor'][k])
|
||||
|
||||
def test_list_healthmonitors_with_sort_emulated(self):
|
||||
with contextlib.nested(self.health_monitor(delay=30),
|
||||
@ -1176,7 +1176,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
self.plugin.update_pool_stats(ctx, pool_id)
|
||||
pool_obj = ctx.session.query(ldb.Pool).filter_by(id=pool_id).one()
|
||||
for key in keys:
|
||||
self.assertEqual(pool_obj.stats.__dict__[key], 0)
|
||||
self.assertEqual(0, pool_obj.stats.__dict__[key])
|
||||
|
||||
def test_update_pool_stats_with_negative_values(self):
|
||||
stats_data = {"bytes_in": -1,
|
||||
@ -1204,7 +1204,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
self.plugin.update_pool_stats(ctx, pool_id, stats_data)
|
||||
pool_obj = ctx.session.query(ldb.Pool).filter_by(id=pool_id).one()
|
||||
for k, v in stats_data.items():
|
||||
self.assertEqual(pool_obj.stats.__dict__[k], v)
|
||||
self.assertEqual(v, pool_obj.stats.__dict__[k])
|
||||
|
||||
def test_update_pool_stats_members_statuses(self):
|
||||
with self.pool() as pool:
|
||||
@ -1235,7 +1235,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
fmt=self.fmt)
|
||||
res = self.deserialize(self.fmt, req.get_response(self.ext_api))
|
||||
for k, v in keys:
|
||||
self.assertEqual(res['stats'][k], v)
|
||||
self.assertEqual(v, res['stats'][k])
|
||||
|
||||
def test_create_healthmonitor_of_pool(self):
|
||||
with self.health_monitor(type="TCP") as monitor1:
|
||||
@ -1251,8 +1251,8 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
id=pool['pool']['id'],
|
||||
subresource="health_monitors")
|
||||
res = req.get_response(self.ext_api)
|
||||
self.assertEqual(res.status_int,
|
||||
webob.exc.HTTPCreated.code)
|
||||
self.assertEqual(webob.exc.HTTPCreated.code,
|
||||
res.status_int)
|
||||
|
||||
data = {"health_monitor": {
|
||||
"id": monitor2['health_monitor']['id'],
|
||||
@ -1264,8 +1264,8 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
id=pool['pool']['id'],
|
||||
subresource="health_monitors")
|
||||
res = req.get_response(self.ext_api)
|
||||
self.assertEqual(res.status_int,
|
||||
webob.exc.HTTPCreated.code)
|
||||
self.assertEqual(webob.exc.HTTPCreated.code,
|
||||
res.status_int)
|
||||
|
||||
req = self.new_show_request(
|
||||
'pools',
|
||||
@ -1305,8 +1305,8 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
id=pool['pool']['id'],
|
||||
subresource="health_monitors")
|
||||
res = req.get_response(self.ext_api)
|
||||
self.assertEqual(res.status_int,
|
||||
webob.exc.HTTPCreated.code)
|
||||
self.assertEqual(webob.exc.HTTPCreated.code,
|
||||
res.status_int)
|
||||
|
||||
data = {"health_monitor": {
|
||||
"id": monitor2['health_monitor']['id'],
|
||||
@ -1318,8 +1318,8 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
id=pool['pool']['id'],
|
||||
subresource="health_monitors")
|
||||
res = req.get_response(self.ext_api)
|
||||
self.assertEqual(res.status_int,
|
||||
webob.exc.HTTPCreated.code)
|
||||
self.assertEqual(webob.exc.HTTPCreated.code,
|
||||
res.status_int)
|
||||
|
||||
# remove one of healthmonitor from the pool
|
||||
req = self.new_delete_request(
|
||||
@ -1329,8 +1329,8 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
sub_id=monitor1['health_monitor']['id'],
|
||||
subresource="health_monitors")
|
||||
res = req.get_response(self.ext_api)
|
||||
self.assertEqual(res.status_int,
|
||||
webob.exc.HTTPNoContent.code)
|
||||
self.assertEqual(webob.exc.HTTPNoContent.code,
|
||||
res.status_int)
|
||||
|
||||
req = self.new_show_request(
|
||||
'pools',
|
||||
@ -1381,7 +1381,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
'3',
|
||||
True)
|
||||
health_monitor = self.deserialize(self.fmt, req)
|
||||
self.assertEqual(req.status_int, webob.exc.HTTPCreated.code)
|
||||
self.assertEqual(webob.exc.HTTPCreated.code, req.status_int)
|
||||
|
||||
# Associate the health_monitor to the pool
|
||||
data = {"health_monitor": {
|
||||
@ -1393,7 +1393,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
id=pool['pool']['id'],
|
||||
subresource="health_monitors")
|
||||
res = req.get_response(self.ext_api)
|
||||
self.assertEqual(res.status_int, webob.exc.HTTPCreated.code)
|
||||
self.assertEqual(webob.exc.HTTPCreated.code, res.status_int)
|
||||
|
||||
# Get pool and vip
|
||||
req = self.new_show_request('pools',
|
||||
@ -1426,8 +1426,8 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
self.fmt,
|
||||
req.get_response(self.ext_api)
|
||||
)
|
||||
self.assertEqual(vip_updated['vip']['pool_id'],
|
||||
pool_updated['pool']['id'])
|
||||
self.assertEqual(pool_updated['pool']['id'],
|
||||
vip_updated['vip']['pool_id'])
|
||||
|
||||
# clean up
|
||||
# disassociate the health_monitor from the pool first
|
||||
@ -1438,7 +1438,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
subresource="health_monitors",
|
||||
sub_id=health_monitor['health_monitor']['id'])
|
||||
res = req.get_response(self.ext_api)
|
||||
self.assertEqual(res.status_int, webob.exc.HTTPNoContent.code)
|
||||
self.assertEqual(webob.exc.HTTPNoContent.code, res.status_int)
|
||||
self._delete('health_monitors',
|
||||
health_monitor['health_monitor']['id'])
|
||||
self._delete('members', member1['member']['id'])
|
||||
@ -1470,8 +1470,8 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
res = self.plugin.get_pool_health_monitor(
|
||||
context.get_admin_context(),
|
||||
health_mon2['health_monitor']['id'], pool['pool']['id'])
|
||||
self.assertEqual(res['tenant_id'],
|
||||
health_mon1['health_monitor']['tenant_id'])
|
||||
self.assertEqual(health_mon1['health_monitor']['tenant_id'],
|
||||
res['tenant_id'])
|
||||
|
||||
def test_driver_call_create_pool_health_monitor(self):
|
||||
with mock.patch.object(self.plugin.drivers['lbaas'],
|
||||
@ -1516,8 +1516,8 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
{'pool_id': p2['pool']['id'],
|
||||
'status': 'PENDING_CREATE',
|
||||
'status_description': None}]
|
||||
self.assertEqual(sorted(healthmon['pools']),
|
||||
sorted(pool_data))
|
||||
self.assertEqual(sorted(pool_data),
|
||||
sorted(healthmon['pools']))
|
||||
req = self.new_show_request(
|
||||
'health_monitors',
|
||||
hm['health_monitor']['id'],
|
||||
@ -1526,8 +1526,8 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
self.fmt,
|
||||
req.get_response(self.ext_api)
|
||||
)
|
||||
self.assertEqual(sorted(hm['health_monitor']['pools']),
|
||||
sorted(pool_data))
|
||||
self.assertEqual(sorted(pool_data),
|
||||
sorted(hm['health_monitor']['pools']))
|
||||
|
||||
def test_create_pool_health_monitor_already_associated(self):
|
||||
with contextlib.nested(
|
||||
@ -1568,22 +1568,22 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
|
||||
def test_update_status(self):
|
||||
with self.pool() as pool:
|
||||
self.assertEqual(pool['pool']['status'], 'PENDING_CREATE')
|
||||
self.assertEqual('PENDING_CREATE', pool['pool']['status'])
|
||||
self.assertFalse(pool['pool']['status_description'])
|
||||
|
||||
self.plugin.update_status(context.get_admin_context(), ldb.Pool,
|
||||
pool['pool']['id'], 'ERROR', 'unknown')
|
||||
updated_pool = self.plugin.get_pool(context.get_admin_context(),
|
||||
pool['pool']['id'])
|
||||
self.assertEqual(updated_pool['status'], 'ERROR')
|
||||
self.assertEqual(updated_pool['status_description'], 'unknown')
|
||||
self.assertEqual('ERROR', updated_pool['status'])
|
||||
self.assertEqual('unknown', updated_pool['status_description'])
|
||||
|
||||
# update status to ACTIVE, status_description should be cleared
|
||||
self.plugin.update_status(context.get_admin_context(), ldb.Pool,
|
||||
pool['pool']['id'], 'ACTIVE')
|
||||
updated_pool = self.plugin.get_pool(context.get_admin_context(),
|
||||
pool['pool']['id'])
|
||||
self.assertEqual(updated_pool['status'], 'ACTIVE')
|
||||
self.assertEqual('ACTIVE', updated_pool['status'])
|
||||
self.assertFalse(updated_pool['status_description'])
|
||||
|
||||
def test_update_pool_health_monitor(self):
|
||||
@ -1602,7 +1602,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
context.get_admin_context(),
|
||||
hm['health_monitor']['id'],
|
||||
pool['pool']['id'])
|
||||
self.assertEqual(assoc['status'], 'PENDING_CREATE')
|
||||
self.assertEqual('PENDING_CREATE', assoc['status'])
|
||||
self.assertIsNone(assoc['status_description'])
|
||||
|
||||
self.plugin.update_pool_health_monitor(
|
||||
@ -1614,8 +1614,8 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
context.get_admin_context(),
|
||||
hm['health_monitor']['id'],
|
||||
pool['pool']['id'])
|
||||
self.assertEqual(assoc['status'], 'ACTIVE')
|
||||
self.assertEqual(assoc['status_description'], 'ok')
|
||||
self.assertEqual('ACTIVE', assoc['status'])
|
||||
self.assertEqual('ok', assoc['status_description'])
|
||||
|
||||
def test_check_orphan_pool_associations(self):
|
||||
with contextlib.nested(
|
||||
@ -1626,7 +1626,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
#checking that 3 associations exist
|
||||
ctx = context.get_admin_context()
|
||||
qry = ctx.session.query(sdb.ProviderResourceAssociation)
|
||||
self.assertEqual(qry.count(), 2)
|
||||
self.assertEqual(2, qry.count())
|
||||
#removing driver
|
||||
self.set_override([
|
||||
constants.LOADBALANCER +
|
||||
|
@ -79,7 +79,7 @@ class LbaasTestMixin(object):
|
||||
lb_req = self.new_create_request('loadbalancers', data, fmt)
|
||||
lb_res = lb_req.get_response(self.ext_api)
|
||||
if expected_res_status:
|
||||
self.assertEqual(lb_res.status_int, expected_res_status)
|
||||
self.assertEqual(expected_res_status, lb_res.status_int)
|
||||
|
||||
return lb_res
|
||||
|
||||
@ -102,7 +102,7 @@ class LbaasTestMixin(object):
|
||||
listener_req = self.new_create_request('listeners', data, fmt)
|
||||
listener_res = listener_req.get_response(self.ext_api)
|
||||
if expected_res_status:
|
||||
self.assertEqual(listener_res.status_int, expected_res_status)
|
||||
self.assertEqual(expected_res_status, listener_res.status_int)
|
||||
|
||||
return listener_res
|
||||
|
||||
@ -124,7 +124,7 @@ class LbaasTestMixin(object):
|
||||
pool_req = self.new_create_request('pools', data, fmt)
|
||||
pool_res = pool_req.get_response(self.ext_api)
|
||||
if expected_res_status:
|
||||
self.assertEqual(pool_res.status_int, expected_res_status)
|
||||
self.assertEqual(expected_res_status, pool_res.status_int)
|
||||
|
||||
return pool_res
|
||||
|
||||
@ -150,7 +150,7 @@ class LbaasTestMixin(object):
|
||||
subresource='members')
|
||||
member_res = member_req.get_response(self.ext_api)
|
||||
if expected_res_status:
|
||||
self.assertEqual(member_res.status_int, expected_res_status)
|
||||
self.assertEqual(expected_res_status, member_res.status_int)
|
||||
|
||||
return member_res
|
||||
|
||||
@ -175,7 +175,7 @@ class LbaasTestMixin(object):
|
||||
hm_req = self.new_create_request('healthmonitors', data, fmt=fmt)
|
||||
hm_res = hm_req.get_response(self.ext_api)
|
||||
if expected_res_status:
|
||||
self.assertEqual(hm_res.status_int, expected_res_status)
|
||||
self.assertEqual(expected_res_status, hm_res.status_int)
|
||||
|
||||
return hm_res
|
||||
|
||||
@ -270,8 +270,7 @@ class LbaasTestMixin(object):
|
||||
subresource='members',
|
||||
sub_id=member['member']['id'])
|
||||
del_res = del_req.get_response(self.ext_api)
|
||||
self.assertEqual(del_res.status_int,
|
||||
webob.exc.HTTPNoContent.code)
|
||||
self.assertEqual(webob.exc.HTTPNoContent.code, del_res.status_int)
|
||||
|
||||
@contextlib.contextmanager
|
||||
def healthmonitor(self, fmt=None, pool_id='pool1id', type='TCP', delay=1,
|
||||
@ -298,7 +297,7 @@ class LbaasTestMixin(object):
|
||||
'healthmonitors', fmt=fmt,
|
||||
id=healthmonitor['healthmonitor']['id'])
|
||||
del_res = del_req.get_response(self.ext_api)
|
||||
self.assertEqual(del_res.status_int, webob.exc.HTTPNoContent.code)
|
||||
self.assertEqual(webob.exc.HTTPNoContent.code, del_res.status_int)
|
||||
|
||||
|
||||
class LbaasPluginDbTestCase(LbaasTestMixin, base.NeutronDbPluginV2TestCase):
|
||||
@ -469,7 +468,7 @@ class LbaasLoadBalancerTests(LbaasPluginDbTestCase):
|
||||
actual = dict((k, v)
|
||||
for k, v in lb['loadbalancer'].items()
|
||||
if k in expected)
|
||||
self.assertEqual(actual, expected)
|
||||
self.assertEqual(expected, actual)
|
||||
self._validate_statuses(lb_id)
|
||||
return lb
|
||||
|
||||
@ -502,8 +501,8 @@ class LbaasLoadBalancerTests(LbaasPluginDbTestCase):
|
||||
resp, res = self._update_loadbalancer_api(loadbalancer_id,
|
||||
data)
|
||||
for k in expected_values:
|
||||
self.assertEqual(res['loadbalancer'][k],
|
||||
expected_values[k])
|
||||
self.assertEqual(expected_values[k],
|
||||
res['loadbalancer'][k])
|
||||
self._validate_statuses(loadbalancer_id,
|
||||
loadbalancer_disabled=True)
|
||||
|
||||
@ -513,7 +512,7 @@ class LbaasLoadBalancerTests(LbaasPluginDbTestCase):
|
||||
no_delete=True) as loadbalancer:
|
||||
loadbalancer_id = loadbalancer['loadbalancer']['id']
|
||||
resp = self._delete_loadbalancer_api(loadbalancer_id)
|
||||
self.assertEqual(resp.status_int, webob.exc.HTTPNoContent.code)
|
||||
self.assertEqual(webob.exc.HTTPNoContent.code, resp.status_int)
|
||||
|
||||
def test_delete_loadbalancer_when_loadbalancer_in_use(self):
|
||||
with self.subnet() as subnet:
|
||||
@ -550,8 +549,8 @@ class LbaasLoadBalancerTests(LbaasPluginDbTestCase):
|
||||
lb['loadbalancer']['vip_port_id'])
|
||||
resp, body = self._get_loadbalancer_api(lb_id)
|
||||
for k in expected_values:
|
||||
self.assertEqual(body['loadbalancer'][k],
|
||||
expected_values[k])
|
||||
self.assertEqual(expected_values[k],
|
||||
body['loadbalancer'][k])
|
||||
|
||||
def test_list_loadbalancers(self):
|
||||
name = 'lb_show'
|
||||
@ -576,10 +575,10 @@ class LbaasLoadBalancerTests(LbaasPluginDbTestCase):
|
||||
expected_values['vip_port_id'] = (
|
||||
lb['loadbalancer']['vip_port_id'])
|
||||
resp, body = self._list_loadbalancers_api()
|
||||
self.assertEqual(len(body['loadbalancers']), 1)
|
||||
self.assertEqual(1, len(body['loadbalancers']))
|
||||
for k in expected_values:
|
||||
self.assertEqual(body['loadbalancers'][0][k],
|
||||
expected_values[k])
|
||||
self.assertEqual(expected_values[k],
|
||||
body['loadbalancers'][0][k])
|
||||
|
||||
def test_list_loadbalancers_with_sort_emulated(self):
|
||||
with self.subnet() as subnet:
|
||||
@ -623,7 +622,7 @@ class LbaasLoadBalancerTests(LbaasPluginDbTestCase):
|
||||
with self.loadbalancer(subnet=subnet) as lb:
|
||||
lb_id = lb['loadbalancer']['id']
|
||||
resp, body = self._get_loadbalancer_stats_api(lb_id)
|
||||
self.assertEqual(body, expected_values)
|
||||
self.assertEqual(expected_values, body)
|
||||
|
||||
def test_show_loadbalancer_with_listeners(self):
|
||||
name = 'lb_show'
|
||||
@ -655,8 +654,8 @@ class LbaasLoadBalancerTests(LbaasPluginDbTestCase):
|
||||
{'id': listener2_id})
|
||||
resp, body = self._get_loadbalancer_api(lb_id)
|
||||
for k in expected_values:
|
||||
self.assertEqual(body['loadbalancer'][k],
|
||||
expected_values[k])
|
||||
self.assertEqual(expected_values[k],
|
||||
body['loadbalancer'][k])
|
||||
|
||||
def test_port_delete_via_port_api(self):
|
||||
port = {
|
||||
@ -713,7 +712,7 @@ class LoadBalancerDelegateVIPCreation(LbaasPluginDbTestCase):
|
||||
actual = dict((k, v)
|
||||
for k, v in lb['loadbalancer'].items()
|
||||
if k in expected)
|
||||
self.assertEqual(actual, expected)
|
||||
self.assertEqual(expected, actual)
|
||||
self._validate_statuses(lb_id)
|
||||
return lb
|
||||
|
||||
@ -809,7 +808,7 @@ class LbaasListenerTests(ListenerTestBase):
|
||||
for k, v in listener['listener'].items():
|
||||
if k in expected:
|
||||
actual[k] = v
|
||||
self.assertEqual(actual, expected)
|
||||
self.assertEqual(expected, actual)
|
||||
self._validate_statuses(self.lb_id, listener_id)
|
||||
return listener
|
||||
|
||||
@ -987,10 +986,10 @@ class LbaasListenerTests(ListenerTestBase):
|
||||
loadbalancer_id=self.lb_id, protocol_port=443,
|
||||
**extras) as listener:
|
||||
self.assertEqual(
|
||||
expected,
|
||||
dict((k, v)
|
||||
for k, v in listener['listener'].items()
|
||||
if k in expected),
|
||||
expected
|
||||
if k in expected)
|
||||
)
|
||||
|
||||
def test_create_listener_loadbalancer_id_does_not_exist(self):
|
||||
@ -1015,7 +1014,7 @@ class LbaasListenerTests(ListenerTestBase):
|
||||
'admin_state_up': False}}
|
||||
resp, body = self._update_listener_api(listener_id, data)
|
||||
for k in expected_values:
|
||||
self.assertEqual(body['listener'][k], expected_values[k])
|
||||
self.assertEqual(expected_values[k], body['listener'][k])
|
||||
self._validate_statuses(self.lb_id, listener_id,
|
||||
listener_disabled=True)
|
||||
|
||||
@ -1052,9 +1051,9 @@ class LbaasListenerTests(ListenerTestBase):
|
||||
# Test order and validation behavior.
|
||||
listener = self.plugin.create_listener(context.get_admin_context(),
|
||||
{'listener': listener_data})
|
||||
self.assertEqual(listener['sni_container_refs'],
|
||||
[sni_tls_container_ref_1,
|
||||
sni_tls_container_ref_2])
|
||||
self.assertEqual([sni_tls_container_ref_1,
|
||||
sni_tls_container_ref_2],
|
||||
listener['sni_container_refs'])
|
||||
|
||||
# Default container and two other SNI containers
|
||||
# Test order and validation behavior.
|
||||
@ -1069,9 +1068,9 @@ class LbaasListenerTests(ListenerTestBase):
|
||||
listener['id'],
|
||||
{'listener': listener_data}
|
||||
)
|
||||
self.assertEqual(listener['sni_container_refs'],
|
||||
[sni_tls_container_ref_3,
|
||||
sni_tls_container_ref_4])
|
||||
self.assertEqual([sni_tls_container_ref_3,
|
||||
sni_tls_container_ref_4],
|
||||
listener['sni_container_refs'])
|
||||
|
||||
# Default container, two old SNI containers ordered differently
|
||||
# and one new SNI container.
|
||||
@ -1083,17 +1082,17 @@ class LbaasListenerTests(ListenerTestBase):
|
||||
listener = self.plugin.update_listener(context.get_admin_context(),
|
||||
listener['id'],
|
||||
{'listener': listener_data})
|
||||
self.assertEqual(listener['sni_container_refs'],
|
||||
[sni_tls_container_ref_4,
|
||||
self.assertEqual([sni_tls_container_ref_4,
|
||||
sni_tls_container_ref_3,
|
||||
sni_tls_container_ref_5])
|
||||
sni_tls_container_ref_5],
|
||||
listener['sni_container_refs'])
|
||||
|
||||
def test_delete_listener(self):
|
||||
with self.listener(no_delete=True,
|
||||
loadbalancer_id=self.lb_id) as listener:
|
||||
listener_id = listener['listener']['id']
|
||||
resp = self._delete_listener_api(listener_id)
|
||||
self.assertEqual(resp.status_int, webob.exc.HTTPNoContent.code)
|
||||
self.assertEqual(webob.exc.HTTPNoContent.code, resp.status_int)
|
||||
resp, body = self._get_loadbalancer_api(self.lb_id)
|
||||
self.assertEqual(0, len(body['loadbalancer']['listeners']))
|
||||
|
||||
@ -1112,7 +1111,7 @@ class LbaasListenerTests(ListenerTestBase):
|
||||
listener_id = listener['listener']['id']
|
||||
resp, body = self._get_listener_api(listener_id)
|
||||
for k in expected_values:
|
||||
self.assertEqual(body['listener'][k], expected_values[k])
|
||||
self.assertEqual(expected_values[k], body['listener'][k])
|
||||
|
||||
def test_list_listeners(self):
|
||||
name = 'list_listeners'
|
||||
@ -1129,9 +1128,9 @@ class LbaasListenerTests(ListenerTestBase):
|
||||
expected_values['id'] = listener_id
|
||||
resp, body = self._list_listeners_api()
|
||||
listener_list = body['listeners']
|
||||
self.assertEqual(len(listener_list), 1)
|
||||
self.assertEqual(1, len(listener_list))
|
||||
for k in expected_values:
|
||||
self.assertEqual(listener_list[0][k], expected_values[k])
|
||||
self.assertEqual(expected_values[k], listener_list[0][k])
|
||||
|
||||
def test_cannot_delete_listener_with_pool(self):
|
||||
with self.listener(loadbalancer_id=self.lb_id) as listener:
|
||||
@ -1258,7 +1257,7 @@ class LbaasPoolTests(PoolTestBase):
|
||||
for k, v in pool['pool'].items():
|
||||
if k in expected:
|
||||
actual[k] = v
|
||||
self.assertEqual(actual, expected)
|
||||
self.assertEqual(expected, actual)
|
||||
self._validate_statuses(self.lb_id, self.listener_id, pool_id)
|
||||
return pool
|
||||
|
||||
@ -1325,7 +1324,7 @@ class LbaasPoolTests(PoolTestBase):
|
||||
self.assertIsNotNone(qry.first())
|
||||
|
||||
resp = self._delete_pool_api(pool_id)
|
||||
self.assertEqual(resp.status_int, webob.exc.HTTPNoContent.code)
|
||||
self.assertEqual(webob.exc.HTTPNoContent.code, resp.status_int)
|
||||
qry = ctx.session.query(models.PoolV2)
|
||||
qry = qry.filter_by(id=pool['pool']['id'])
|
||||
self.assertIsNone(qry.first())
|
||||
@ -1356,7 +1355,7 @@ class LbaasPoolTests(PoolTestBase):
|
||||
'tenant_id': self._tenant_id,
|
||||
'listener_id': self.listener_id}}
|
||||
resp, body = self._create_pool_api(data)
|
||||
self.assertEqual(resp.status_int, webob.exc.HTTPConflict.code)
|
||||
self.assertEqual(webob.exc.HTTPConflict.code, resp.status_int)
|
||||
|
||||
def test_create_pool_with_pool_protocol_mismatch(self):
|
||||
with self.listener(protocol=lb_const.PROTOCOL_HTTPS,
|
||||
@ -1368,7 +1367,7 @@ class LbaasPoolTests(PoolTestBase):
|
||||
'lb_algorithm': lb_const.LB_METHOD_ROUND_ROBIN,
|
||||
'tenant_id': self._tenant_id}}
|
||||
resp, body = self._create_pool_api(data)
|
||||
self.assertEqual(resp.status_int, webob.exc.HTTPConflict.code)
|
||||
self.assertEqual(webob.exc.HTTPConflict.code, resp.status_int)
|
||||
|
||||
def test_create_pool_with_protocol_invalid(self):
|
||||
data = {'pool': {
|
||||
@ -1467,9 +1466,9 @@ class LbaasPoolTests(PoolTestBase):
|
||||
expected_values['id'] = pool_id
|
||||
resp, body = self._list_pools_api()
|
||||
pool_list = body['pools']
|
||||
self.assertEqual(len(pool_list), 1)
|
||||
self.assertEqual(1, len(pool_list))
|
||||
for k in expected_values:
|
||||
self.assertEqual(pool_list[0][k], expected_values[k])
|
||||
self.assertEqual(expected_values[k], pool_list[0][k])
|
||||
|
||||
def test_list_pools_with_sort_emulated(self):
|
||||
with contextlib.nested(self.listener(loadbalancer_id=self.lb_id,
|
||||
@ -1617,7 +1616,7 @@ class LbaasMemberTests(MemberTestBase):
|
||||
for k, v in member['member'].items():
|
||||
if k in expected:
|
||||
actual[k] = v
|
||||
self.assertEqual(actual, expected)
|
||||
self.assertEqual(expected, actual)
|
||||
self._validate_statuses(self.lb_id, self.listener_id, self.pool_id,
|
||||
member_id)
|
||||
return member
|
||||
@ -1649,13 +1648,13 @@ class LbaasMemberTests(MemberTestBase):
|
||||
with self.member(pool_id=self.pool_id) as member:
|
||||
member_id = member['member']['id']
|
||||
resp, pool1_update = self._get_pool_api(self.pool_id)
|
||||
self.assertEqual(len(pool1_update['pool']['members']), 1)
|
||||
self.assertEqual(1, len(pool1_update['pool']['members']))
|
||||
data = {'member': {'weight': 10, 'admin_state_up': False}}
|
||||
resp, body = self._update_member_api(self.pool_id, member_id, data)
|
||||
for k, v in keys:
|
||||
self.assertEqual(body['member'][k], v)
|
||||
self.assertEqual(v, body['member'][k])
|
||||
resp, pool1_update = self._get_pool_api(self.pool_id)
|
||||
self.assertEqual(len(pool1_update['pool']['members']), 1)
|
||||
self.assertEqual(1, len(pool1_update['pool']['members']))
|
||||
self._validate_statuses(self.lb_id, self.listener_id, self.pool_id,
|
||||
member_id, member_disabled=True)
|
||||
|
||||
@ -1663,9 +1662,9 @@ class LbaasMemberTests(MemberTestBase):
|
||||
with self.member(pool_id=self.pool_id, no_delete=True) as member:
|
||||
member_id = member['member']['id']
|
||||
resp = self._delete_member_api(self.pool_id, member_id)
|
||||
self.assertEqual(resp.status_int, webob.exc.HTTPNoContent.code)
|
||||
self.assertEqual(webob.exc.HTTPNoContent.code, resp.status_int)
|
||||
resp, pool_update = self._get_pool_api(self.pool_id)
|
||||
self.assertEqual(len(pool_update['pool']['members']), 0)
|
||||
self.assertEqual(0, len(pool_update['pool']['members']))
|
||||
|
||||
def test_show_member(self):
|
||||
keys = [('address', "127.0.0.1"),
|
||||
@ -1677,12 +1676,12 @@ class LbaasMemberTests(MemberTestBase):
|
||||
member_id = member['member']['id']
|
||||
resp, body = self._get_member_api(self.pool_id, member_id)
|
||||
for k, v in keys:
|
||||
self.assertEqual(body['member'][k], v)
|
||||
self.assertEqual(v, body['member'][k])
|
||||
|
||||
def test_list_members(self):
|
||||
with self.member(pool_id=self.pool_id, protocol_port=81):
|
||||
resp, body = self._list_members_api(self.pool_id)
|
||||
self.assertEqual(len(body['members']), 1)
|
||||
self.assertEqual(1, len(body['members']))
|
||||
|
||||
def test_list_members_with_sort_emulated(self):
|
||||
with self.member(pool_id=self.pool_id, protocol_port=81) as m1:
|
||||
@ -1716,17 +1715,17 @@ class LbaasMemberTests(MemberTestBase):
|
||||
|
||||
def test_list_members_invalid_pool_id(self):
|
||||
resp, body = self._list_members_api('WRONG_POOL_ID')
|
||||
self.assertEqual(resp.status_int, webob.exc.HTTPNotFound.code)
|
||||
self.assertEqual(webob.exc.HTTPNotFound.code, resp.status_int)
|
||||
resp, body = self._list_members_api(self.pool_id)
|
||||
self.assertEqual(resp.status_int, webob.exc.HTTPOk.code)
|
||||
self.assertEqual(webob.exc.HTTPOk.code, resp.status_int)
|
||||
|
||||
def test_get_member_invalid_pool_id(self):
|
||||
with self.member(pool_id=self.pool_id) as member:
|
||||
member_id = member['member']['id']
|
||||
resp, body = self._get_member_api('WRONG_POOL_ID', member_id)
|
||||
self.assertEqual(resp.status_int, webob.exc.HTTPNotFound.code)
|
||||
self.assertEqual(webob.exc.HTTPNotFound.code, resp.status_int)
|
||||
resp, body = self._get_member_api(self.pool_id, member_id)
|
||||
self.assertEqual(resp.status_int, webob.exc.HTTPOk.code)
|
||||
self.assertEqual(webob.exc.HTTPOk.code, resp.status_int)
|
||||
|
||||
def test_create_member_invalid_pool_id(self):
|
||||
data = {'member': {'address': '127.0.0.1',
|
||||
@ -1736,7 +1735,7 @@ class LbaasMemberTests(MemberTestBase):
|
||||
'tenant_id': self._tenant_id,
|
||||
'subnet_id': self.test_subnet_id}}
|
||||
resp, body = self._create_member_api('WRONG_POOL_ID', data)
|
||||
self.assertEqual(resp.status_int, webob.exc.HTTPNotFound.code)
|
||||
self.assertEqual(webob.exc.HTTPNotFound.code, resp.status_int)
|
||||
|
||||
def test_update_member_invalid_pool_id(self):
|
||||
with self.member(pool_id=self.pool_id) as member:
|
||||
@ -1744,13 +1743,13 @@ class LbaasMemberTests(MemberTestBase):
|
||||
data = {'member': {'weight': 1}}
|
||||
resp, body = self._update_member_api(
|
||||
'WRONG_POOL_ID', member_id, data)
|
||||
self.assertEqual(resp.status_int, webob.exc.HTTPNotFound.code)
|
||||
self.assertEqual(webob.exc.HTTPNotFound.code, resp.status_int)
|
||||
|
||||
def test_delete_member_invalid_pool_id(self):
|
||||
with self.member(pool_id=self.pool_id) as member:
|
||||
member_id = member['member']['id']
|
||||
resp = self._delete_member_api('WRONG_POOL_ID', member_id)
|
||||
self.assertEqual(resp.status_int, webob.exc.HTTPNotFound.code)
|
||||
self.assertEqual(webob.exc.HTTPNotFound.code, resp.status_int)
|
||||
|
||||
def test_get_pool_shows_members(self):
|
||||
with self.member(pool_id=self.pool_id) as member:
|
||||
@ -1822,9 +1821,9 @@ class LbaasHealthMonitorTests(HealthMonitorTestBase):
|
||||
hm_id=hm_id)
|
||||
_, pool = self._get_pool_api(self.pool_id)
|
||||
self.assertEqual(
|
||||
pool['pool'].get('session_persistence'),
|
||||
{'type': lb_const.SESSION_PERSISTENCE_HTTP_COOKIE,
|
||||
'cookie_name': None})
|
||||
'cookie_name': None},
|
||||
pool['pool'].get('session_persistence'))
|
||||
return healthmonitor
|
||||
|
||||
def test_show_healthmonitor(self, **extras):
|
||||
@ -1893,7 +1892,7 @@ class LbaasHealthMonitorTests(HealthMonitorTestBase):
|
||||
no_delete=True) as healthmonitor:
|
||||
hm_id = healthmonitor['healthmonitor']['id']
|
||||
resp = self._delete_healthmonitor_api(hm_id)
|
||||
self.assertEqual(resp.status_int, webob.exc.HTTPNoContent.code)
|
||||
self.assertEqual(webob.exc.HTTPNoContent.code, resp.status_int)
|
||||
|
||||
def test_create_health_monitor_with_timeout_invalid(self):
|
||||
data = {'healthmonitor': {'type': 'HTTP',
|
||||
@ -2011,7 +2010,7 @@ class LbaasHealthMonitorTests(HealthMonitorTestBase):
|
||||
'tenant_id': self._tenant_id,
|
||||
'pool_id': uuidutils.generate_uuid()}}
|
||||
resp, body = self._create_healthmonitor_api(data)
|
||||
self.assertEqual(resp.status_int, webob.exc.HTTPNotFound.code)
|
||||
self.assertEqual(webob.exc.HTTPNotFound.code, resp.status_int)
|
||||
|
||||
def test_only_one_healthmonitor_per_pool(self):
|
||||
with self.healthmonitor(pool_id=self.pool_id):
|
||||
@ -2022,7 +2021,7 @@ class LbaasHealthMonitorTests(HealthMonitorTestBase):
|
||||
'tenant_id': self._tenant_id,
|
||||
'pool_id': self.pool_id}}
|
||||
resp, body = self._create_healthmonitor_api(data)
|
||||
self.assertEqual(resp.status_int, webob.exc.HTTPConflict.code)
|
||||
self.assertEqual(webob.exc.HTTPConflict.code, resp.status_int)
|
||||
|
||||
def test_get_healthmonitor(self):
|
||||
expected = {
|
||||
@ -2079,7 +2078,7 @@ class LbaasHealthMonitorTests(HealthMonitorTestBase):
|
||||
provisioning_status=constants.ACTIVE,
|
||||
operating_status=lb_const.DEGRADED)
|
||||
db_hm = self.plugin.db.get_healthmonitor(ctx, hm_id)
|
||||
self.assertEqual(db_hm.provisioning_status, constants.ACTIVE)
|
||||
self.assertEqual(constants.ACTIVE, db_hm.provisioning_status)
|
||||
self.assertFalse(hasattr(db_hm, 'operating_status'))
|
||||
|
||||
|
||||
|
@ -60,7 +60,7 @@ class TestLoadBalancerCallbacks(
|
||||
ready = self.callbacks.get_ready_devices(
|
||||
context.get_admin_context(),
|
||||
)
|
||||
self.assertEqual(ready, [lb_id])
|
||||
self.assertEqual([lb_id], ready)
|
||||
|
||||
def test_get_ready_devices_multiple_listeners_and_loadbalancers(self):
|
||||
ctx = context.get_admin_context()
|
||||
@ -95,14 +95,14 @@ class TestLoadBalancerCallbacks(
|
||||
|
||||
ctx.session.flush()
|
||||
|
||||
self.assertEqual(ctx.session.query(ldb.models.LoadBalancer).count(), 3)
|
||||
self.assertEqual(ctx.session.query(ldb.models.Listener).count(), 2)
|
||||
self.assertEqual(3, ctx.session.query(ldb.models.LoadBalancer).count())
|
||||
self.assertEqual(2, ctx.session.query(ldb.models.Listener).count())
|
||||
with mock.patch(
|
||||
'neutron_lbaas.agent_scheduler.LbaasAgentSchedulerDbMixin'
|
||||
'.list_loadbalancers_on_lbaas_agent') as mock_agent_lbs:
|
||||
mock_agent_lbs.return_value = loadbalancers
|
||||
ready = self.callbacks.get_ready_devices(ctx)
|
||||
self.assertEqual(len(ready), 3)
|
||||
self.assertEqual(3, len(ready))
|
||||
self.assertIn(loadbalancers[0].id, ready)
|
||||
self.assertIn(loadbalancers[1].id, ready)
|
||||
self.assertIn(loadbalancers[2].id, ready)
|
||||
@ -172,7 +172,7 @@ class TestLoadBalancerCallbacks(
|
||||
func(ctx, port_id=db_lb.vip_port_id, **kwargs)
|
||||
db_port = core.get_port(ctx, db_lb.vip_port_id)
|
||||
for k, v in six.iteritems(expected):
|
||||
self.assertEqual(db_port[k], v)
|
||||
self.assertEqual(v, db_port[k])
|
||||
|
||||
def test_plug_vip_port(self):
|
||||
exp = {
|
||||
|
@ -58,7 +58,7 @@ class TestLoadBalancerAgentApi(base.BaseTestCase):
|
||||
self.api = agent_driver_base.LoadBalancerAgentApi('topic')
|
||||
|
||||
def test_init(self):
|
||||
self.assertEqual(self.api.client.target.topic, 'topic')
|
||||
self.assertEqual('topic', self.api.client.target.topic)
|
||||
|
||||
def _call_test_helper(self, method_name, method_args):
|
||||
with contextlib.nested(
|
||||
|
@ -60,8 +60,8 @@ class TestHaproxyNSDriver(base.BaseTestCase):
|
||||
self.driver.vif_driver = self.vif_driver
|
||||
|
||||
def test_get_ns_name(self):
|
||||
self.assertEqual(namespace_driver.get_ns_name('ns_id_1'),
|
||||
namespace_driver.NS_PREFIX + 'ns_id_1')
|
||||
self.assertEqual(namespace_driver.NS_PREFIX + 'ns_id_1',
|
||||
namespace_driver.get_ns_name('ns_id_1'))
|
||||
|
||||
def test_deploy_existing_instance(self):
|
||||
dirs = ['lbid1', 'lbid2']
|
||||
@ -138,7 +138,7 @@ class TestHaproxyNSDriver(base.BaseTestCase):
|
||||
self.driver.conf.host = 'host1'
|
||||
ret = {'admin_state_up': True,
|
||||
portbindings.HOST_ID: self.conf.host}
|
||||
self.assertEqual(ret, self.driver._build_port_dict())
|
||||
self.assertEqual(self.driver._build_port_dict(), ret)
|
||||
|
||||
def test_get_state_file_path(self):
|
||||
with mock.patch('os.makedirs') as mkdir:
|
||||
@ -156,7 +156,7 @@ class TestHaproxyNSDriver(base.BaseTestCase):
|
||||
'get_subnet', return_value=ret_subnet):
|
||||
self.driver._populate_subnets(self.context_mock, port)
|
||||
for fixed_ip in port.fixed_ips:
|
||||
self.assertEqual(ret_subnet, fixed_ip.subnet)
|
||||
self.assertEqual(fixed_ip.subnet, ret_subnet)
|
||||
|
||||
def test_plug(self):
|
||||
fixed_ips = [data_models.IPAllocation(ip_address='10.0.0.2',
|
||||
@ -402,7 +402,7 @@ class TestHaproxyNSDriver(base.BaseTestCase):
|
||||
listener = data_models.Listener(default_pool=pool)
|
||||
lb = data_models.LoadBalancer(listeners=[listener])
|
||||
ret_members = [member for member in self.driver._get_members(lb)]
|
||||
self.assertEqual(len(ret_members), len(members))
|
||||
self.assertEqual(len(members), len(ret_members))
|
||||
self.assertIn(members[0], ret_members)
|
||||
self.assertIn(members[1], ret_members)
|
||||
|
||||
@ -1120,7 +1120,7 @@ class TestPoolManager(BaseTestManager):
|
||||
self.pool.delete(self.context, pool)
|
||||
refresh_instance.assert_called_once_with(self.context,
|
||||
loadbalancer)
|
||||
self.assertEqual(listener.default_pool, None)
|
||||
self.assertEqual(None, listener.default_pool)
|
||||
success.assert_called_once_with(self.context, pool,
|
||||
delete=True)
|
||||
|
||||
|
@ -43,7 +43,7 @@ def patch_manager(func):
|
||||
func(*args[:-1])
|
||||
|
||||
s = str(log_mock.mock_calls[0])
|
||||
parent.assertEqual(s[:11], "call.debug(")
|
||||
parent.assertEqual("call.debug(", s[:11])
|
||||
parent.assertTrue(s.index(model.id) != -1,
|
||||
msg="Model ID not found in log")
|
||||
|
||||
@ -123,7 +123,7 @@ class LoadBalancerManagerTest(ManagerTestWithUpdates):
|
||||
"total_connections": 0
|
||||
}
|
||||
h = self.manager.stats(self.parent.context, model)
|
||||
self.parent.assertEqual(h, dummy_stats)
|
||||
self.parent.assertEqual(dummy_stats, h)
|
||||
|
||||
|
||||
class TestLoggingNoopLoadBalancerDriver(
|
||||
|
@ -247,7 +247,7 @@ class TestLBaaSDriver(TestLBaaSDriverBase):
|
||||
try:
|
||||
self.driver._verify_workflow_templates()
|
||||
except r_exc.WorkflowTemplateMissing as e:
|
||||
self.assertEqual(e.msg, message)
|
||||
self.assertEqual(message, e.msg)
|
||||
|
||||
templates_to_return.append(
|
||||
{'name': self.driver.workflow_template_name})
|
||||
@ -426,9 +426,10 @@ class TestLBaaSDriver(TestLBaaSDriverBase):
|
||||
|
||||
stats = self.plugin_instance.stats(
|
||||
context.get_admin_context(), lb_id,)
|
||||
self.assertEqual(stats, {'stats': {'bytes_in': 100,
|
||||
self.assertEqual({'stats': {'bytes_in': 100,
|
||||
'total_connections': 2,
|
||||
'active_connections': 1, 'bytes_out': 200}})
|
||||
'active_connections': 1, 'bytes_out': 200}},
|
||||
stats)
|
||||
|
||||
def test_member_crud(self):
|
||||
with self.subnet(cidr='10.0.0.0/24') as s:
|
||||
@ -535,8 +536,8 @@ class TestLBaaSDriver(TestLBaaSDriverBase):
|
||||
lb = self.plugin_instance.db.get_loadbalancer(
|
||||
context.get_admin_context(),
|
||||
lb_id).to_dict(listener=False)
|
||||
self.assertEqual(lb['provisioning_status'],
|
||||
'ACTIVE')
|
||||
self.assertEqual('ACTIVE',
|
||||
lb['provisioning_status'])
|
||||
|
||||
def test_build_objects_with_tls(self):
|
||||
with self.subnet(cidr='10.0.0.0/24') as vip_sub:
|
||||
|
@ -27,8 +27,8 @@ class TestApiCache(base.BaseTestCase):
|
||||
self.api = api.LbaasAgentApi('topic', mock.sentinel.context, 'host')
|
||||
|
||||
def test_init(self):
|
||||
self.assertEqual(self.api.host, 'host')
|
||||
self.assertEqual(self.api.context, mock.sentinel.context)
|
||||
self.assertEqual('host', self.api.host)
|
||||
self.assertEqual(mock.sentinel.context, self.api.context)
|
||||
|
||||
def _test_method(self, method, **kwargs):
|
||||
add_host = ('get_ready_devices', 'plug_vip_port', 'unplug_vip_port',
|
||||
@ -47,7 +47,7 @@ class TestApiCache(base.BaseTestCase):
|
||||
rpc_mock.return_value = 'foo'
|
||||
rv = getattr(self.api, method)(**kwargs)
|
||||
|
||||
self.assertEqual(rv, 'foo')
|
||||
self.assertEqual('foo', rv)
|
||||
|
||||
prepare_args = {}
|
||||
prepare_mock.assert_called_once_with(**prepare_args)
|
||||
|
@ -51,19 +51,19 @@ class TestA10ThunderDriver(test_db_loadbalancer.LoadBalancerPluginDbTestCase):
|
||||
|
||||
def test__hm_binding_count(self):
|
||||
n = self.driver._hm_binding_count(self.context, 'hm01')
|
||||
self.assertEqual(n, 0)
|
||||
self.assertEqual(0, n)
|
||||
|
||||
def test__member_count(self):
|
||||
self.m = fake_member('mem1')
|
||||
n = self.driver._member_count(self.context, self.m)
|
||||
self.assertEqual(n, 0)
|
||||
self.assertEqual(0, n)
|
||||
|
||||
def test__member_get_ip(self):
|
||||
self.m = fake_member('mem1')
|
||||
z = self.driver._member_get_ip(self.context, self.m, False)
|
||||
self.assertEqual(z, '1.1.1.1')
|
||||
self.assertEqual('1.1.1.1', z)
|
||||
z = self.driver._member_get_ip(self.context, self.m, True)
|
||||
self.assertEqual(z, '1.1.1.1')
|
||||
self.assertEqual('1.1.1.1', z)
|
||||
|
||||
def test__pool_get_hm(self):
|
||||
self.driver._pool_get_hm(self.context, 'hm01')
|
||||
@ -72,16 +72,16 @@ class TestA10ThunderDriver(test_db_loadbalancer.LoadBalancerPluginDbTestCase):
|
||||
|
||||
def test__pool_get_tenant_id(self):
|
||||
z = self.driver._pool_get_tenant_id(self.context, 'pool1')
|
||||
self.assertEqual(z, '')
|
||||
self.assertEqual('', z)
|
||||
|
||||
def test__pool_get_vip_id(self):
|
||||
z = self.driver._pool_get_vip_id(self.context, 'pool1')
|
||||
self.assertEqual(z, '')
|
||||
self.assertEqual('', z)
|
||||
|
||||
def test__pool_total(self):
|
||||
n = self.driver._pool_total(self.context,
|
||||
tenant_id='whatareyoudoingdave')
|
||||
self.assertEqual(n, 0)
|
||||
self.assertEqual(0, n)
|
||||
|
||||
def test__active(self):
|
||||
self.driver._active(self.context, 'vip', 'vip1')
|
||||
|
@ -183,8 +183,8 @@ class TestHaproxyCfg(base.BaseTestCase):
|
||||
|
||||
def test_get_session_persistence(self):
|
||||
config = {'vip': {'session_persistence': {'type': 'SOURCE_IP'}}}
|
||||
self.assertEqual(cfg._get_session_persistence(config),
|
||||
['stick-table type ip size 10k', 'stick on src'])
|
||||
self.assertEqual(['stick-table type ip size 10k', 'stick on src'],
|
||||
cfg._get_session_persistence(config))
|
||||
|
||||
config = {'vip': {'session_persistence': {'type': 'HTTP_COOKIE'}},
|
||||
'members': []}
|
||||
@ -195,42 +195,42 @@ class TestHaproxyCfg(base.BaseTestCase):
|
||||
|
||||
config = {'vip': {'session_persistence': {'type': 'HTTP_COOKIE'}},
|
||||
'members': [{'id': 'member1_id'}]}
|
||||
self.assertEqual(cfg._get_session_persistence(config),
|
||||
['cookie SRV insert indirect nocache'])
|
||||
self.assertEqual(['cookie SRV insert indirect nocache'],
|
||||
cfg._get_session_persistence(config))
|
||||
|
||||
config = {'vip': {'session_persistence': {'type': 'APP_COOKIE',
|
||||
'cookie_name': 'test'}}}
|
||||
self.assertEqual(cfg._get_session_persistence(config),
|
||||
['appsession test len 56 timeout 3h'])
|
||||
self.assertEqual(['appsession test len 56 timeout 3h'],
|
||||
cfg._get_session_persistence(config))
|
||||
|
||||
config = {'vip': {'session_persistence': {'type': 'APP_COOKIE'}}}
|
||||
self.assertEqual(cfg._get_session_persistence(config), [])
|
||||
self.assertEqual([], cfg._get_session_persistence(config))
|
||||
|
||||
config = {'vip': {'session_persistence': {'type': 'UNSUPPORTED'}}}
|
||||
self.assertEqual(cfg._get_session_persistence(config), [])
|
||||
self.assertEqual([], cfg._get_session_persistence(config))
|
||||
|
||||
def test_expand_expected_codes(self):
|
||||
exp_codes = ''
|
||||
self.assertEqual(cfg._expand_expected_codes(exp_codes), set([]))
|
||||
self.assertEqual(set([]), cfg._expand_expected_codes(exp_codes))
|
||||
exp_codes = '200'
|
||||
self.assertEqual(cfg._expand_expected_codes(exp_codes), set(['200']))
|
||||
self.assertEqual(set(['200']), cfg._expand_expected_codes(exp_codes))
|
||||
exp_codes = '200, 201'
|
||||
self.assertEqual(cfg._expand_expected_codes(exp_codes),
|
||||
set(['200', '201']))
|
||||
self.assertEqual(set(['200', '201']),
|
||||
cfg._expand_expected_codes(exp_codes))
|
||||
exp_codes = '200, 201,202'
|
||||
self.assertEqual(cfg._expand_expected_codes(exp_codes),
|
||||
set(['200', '201', '202']))
|
||||
self.assertEqual(set(['200', '201', '202']),
|
||||
cfg._expand_expected_codes(exp_codes))
|
||||
exp_codes = '200-202'
|
||||
self.assertEqual(cfg._expand_expected_codes(exp_codes),
|
||||
set(['200', '201', '202']))
|
||||
self.assertEqual(set(['200', '201', '202']),
|
||||
cfg._expand_expected_codes(exp_codes))
|
||||
exp_codes = '200-202, 205'
|
||||
self.assertEqual(cfg._expand_expected_codes(exp_codes),
|
||||
set(['200', '201', '202', '205']))
|
||||
self.assertEqual(set(['200', '201', '202', '205']),
|
||||
cfg._expand_expected_codes(exp_codes))
|
||||
exp_codes = '200, 201-203'
|
||||
self.assertEqual(cfg._expand_expected_codes(exp_codes),
|
||||
set(['200', '201', '202', '203']))
|
||||
self.assertEqual(set(['200', '201', '202', '203']),
|
||||
cfg._expand_expected_codes(exp_codes))
|
||||
exp_codes = '200, 201-203, 205'
|
||||
self.assertEqual(cfg._expand_expected_codes(exp_codes),
|
||||
set(['200', '201', '202', '203', '205']))
|
||||
self.assertEqual(set(['200', '201', '202', '203', '205']),
|
||||
cfg._expand_expected_codes(exp_codes))
|
||||
exp_codes = '201-200, 205'
|
||||
self.assertEqual(cfg._expand_expected_codes(exp_codes), set(['205']))
|
||||
self.assertEqual(set(['205']), cfg._expand_expected_codes(exp_codes))
|
||||
|
@ -477,28 +477,28 @@ class TestHaproxyCfg(base.BaseTestCase):
|
||||
|
||||
def test_expand_expected_codes(self):
|
||||
exp_codes = ''
|
||||
self.assertEqual(jinja_cfg._expand_expected_codes(exp_codes), set([]))
|
||||
self.assertEqual(set([]), jinja_cfg._expand_expected_codes(exp_codes))
|
||||
exp_codes = '200'
|
||||
self.assertEqual(
|
||||
jinja_cfg._expand_expected_codes(exp_codes), set(['200']))
|
||||
self.assertEqual(set(['200']),
|
||||
jinja_cfg._expand_expected_codes(exp_codes))
|
||||
exp_codes = '200, 201'
|
||||
self.assertEqual(jinja_cfg._expand_expected_codes(exp_codes),
|
||||
set(['200', '201']))
|
||||
self.assertEqual(set(['200', '201']),
|
||||
jinja_cfg._expand_expected_codes(exp_codes))
|
||||
exp_codes = '200, 201,202'
|
||||
self.assertEqual(jinja_cfg._expand_expected_codes(exp_codes),
|
||||
set(['200', '201', '202']))
|
||||
self.assertEqual(set(['200', '201', '202']),
|
||||
jinja_cfg._expand_expected_codes(exp_codes))
|
||||
exp_codes = '200-202'
|
||||
self.assertEqual(jinja_cfg._expand_expected_codes(exp_codes),
|
||||
set(['200', '201', '202']))
|
||||
self.assertEqual(set(['200', '201', '202']),
|
||||
jinja_cfg._expand_expected_codes(exp_codes))
|
||||
exp_codes = '200-202, 205'
|
||||
self.assertEqual(jinja_cfg._expand_expected_codes(exp_codes),
|
||||
set(['200', '201', '202', '205']))
|
||||
self.assertEqual(set(['200', '201', '202', '205']),
|
||||
jinja_cfg._expand_expected_codes(exp_codes))
|
||||
exp_codes = '200, 201-203'
|
||||
self.assertEqual(jinja_cfg._expand_expected_codes(exp_codes),
|
||||
set(['200', '201', '202', '203']))
|
||||
self.assertEqual(set(['200', '201', '202', '203']),
|
||||
jinja_cfg._expand_expected_codes(exp_codes))
|
||||
exp_codes = '200, 201-203, 205'
|
||||
self.assertEqual(jinja_cfg._expand_expected_codes(exp_codes),
|
||||
set(['200', '201', '202', '203', '205']))
|
||||
self.assertEqual(set(['200', '201', '202', '203', '205']),
|
||||
jinja_cfg._expand_expected_codes(exp_codes))
|
||||
exp_codes = '201-200, 205'
|
||||
self.assertEqual(
|
||||
jinja_cfg._expand_expected_codes(exp_codes), set(['205']))
|
||||
self.assertEqual(set(['205']),
|
||||
jinja_cfg._expand_expected_codes(exp_codes))
|
||||
|
@ -58,7 +58,7 @@ class TestHaproxyNSDriver(base.BaseTestCase):
|
||||
return mock.call(**kwargs)
|
||||
|
||||
def test_get_name(self):
|
||||
self.assertEqual(self.driver.get_name(), namespace_driver.DRIVER_NAME)
|
||||
self.assertEqual(namespace_driver.DRIVER_NAME, self.driver.get_name())
|
||||
|
||||
def test_create(self):
|
||||
with mock.patch.object(self.driver, '_plug') as plug:
|
||||
|
@ -321,7 +321,7 @@ class TestLoadBalancerPlugin(TestLoadBalancerPluginBase):
|
||||
context.get_admin_context(),
|
||||
vip['id']
|
||||
)
|
||||
self.assertEqual(new_vip['status'], constants.ACTIVE)
|
||||
self.assertEqual(constants.ACTIVE, new_vip['status'])
|
||||
|
||||
# Delete VIP
|
||||
self.plugin_instance.delete_vip(
|
||||
@ -397,7 +397,7 @@ class TestLoadBalancerPlugin(TestLoadBalancerPluginBase):
|
||||
context.get_admin_context(),
|
||||
vip['id']
|
||||
)
|
||||
self.assertEqual(new_vip['status'], constants.ACTIVE)
|
||||
self.assertEqual(constants.ACTIVE, new_vip['status'])
|
||||
|
||||
# Test that PIP neutron port was created
|
||||
pip_port_filter = {
|
||||
@ -457,7 +457,7 @@ class TestLoadBalancerPlugin(TestLoadBalancerPluginBase):
|
||||
|
||||
updated_vip = self.plugin_instance.get_vip(
|
||||
context.get_admin_context(), vip['id'])
|
||||
self.assertEqual(updated_vip['status'], constants.ACTIVE)
|
||||
self.assertEqual(constants.ACTIVE, updated_vip['status'])
|
||||
|
||||
# delete VIP
|
||||
self.plugin_instance.delete_vip(
|
||||
@ -501,7 +501,7 @@ class TestLoadBalancerPlugin(TestLoadBalancerPluginBase):
|
||||
|
||||
updated_vip = self.plugin_instance.get_vip(
|
||||
context.get_admin_context(), vip['id'])
|
||||
self.assertEqual(updated_vip['status'], constants.ACTIVE)
|
||||
self.assertEqual(constants.ACTIVE, updated_vip['status'])
|
||||
|
||||
# delete VIP
|
||||
self.plugin_instance.delete_vip(
|
||||
@ -547,11 +547,11 @@ class TestLoadBalancerPlugin(TestLoadBalancerPluginBase):
|
||||
context.get_admin_context(),
|
||||
hm['health_monitor']['id'], pool['pool']['id'])
|
||||
|
||||
self.assertEqual(u_vip['status'], constants.ERROR)
|
||||
self.assertEqual(u_pool['status'], constants.ACTIVE)
|
||||
self.assertEqual(u_mem1['status'], constants.ACTIVE)
|
||||
self.assertEqual(u_mem2['status'], constants.ACTIVE)
|
||||
self.assertEqual(u_phm['status'], constants.ACTIVE)
|
||||
self.assertEqual(constants.ERROR, u_vip['status'])
|
||||
self.assertEqual(constants.ACTIVE, u_pool['status'])
|
||||
self.assertEqual(constants.ACTIVE, u_mem1['status'])
|
||||
self.assertEqual(constants.ACTIVE, u_mem2['status'])
|
||||
self.assertEqual(constants.ACTIVE, u_phm['status'])
|
||||
|
||||
def test_delete_vip(self):
|
||||
with self.subnet() as subnet:
|
||||
@ -647,7 +647,7 @@ class TestLoadBalancerPlugin(TestLoadBalancerPluginBase):
|
||||
pool['pool']['id'], pool)
|
||||
pool_db = self.plugin_instance.get_pool(
|
||||
context.get_admin_context(), pool['pool']['id'])
|
||||
self.assertEqual(pool_db['status'], constants.PENDING_UPDATE)
|
||||
self.assertEqual(constants.PENDING_UPDATE, pool_db['status'])
|
||||
|
||||
def test_delete_pool_with_vip(self):
|
||||
with self.subnet() as subnet:
|
||||
@ -722,19 +722,19 @@ class TestLoadBalancerPlugin(TestLoadBalancerPluginBase):
|
||||
member_subnet_array = params['member_subnet_array']
|
||||
member_mask_array = params['member_mask_array']
|
||||
member_gw_array = params['member_gw_array']
|
||||
self.assertEqual(member_subnet_array,
|
||||
['10.0.0.0',
|
||||
self.assertEqual(['10.0.0.0',
|
||||
'255.255.255.255',
|
||||
'30.0.0.0'])
|
||||
self.assertEqual(member_mask_array,
|
||||
['255.255.255.0',
|
||||
'30.0.0.0'],
|
||||
member_subnet_array)
|
||||
self.assertEqual(['255.255.255.0',
|
||||
'255.255.255.255',
|
||||
'255.255.255.0'])
|
||||
'255.255.255.0'],
|
||||
member_mask_array)
|
||||
self.assertEqual(
|
||||
member_gw_array,
|
||||
[pool_sub['subnet']['gateway_ip'],
|
||||
'255.255.255.255',
|
||||
pool_sub['subnet']['gateway_ip']])
|
||||
pool_sub['subnet']['gateway_ip']],
|
||||
member_gw_array)
|
||||
|
||||
def test_create_member_on_different_subnet_no_port(self):
|
||||
with contextlib.nested(
|
||||
@ -763,12 +763,12 @@ class TestLoadBalancerPlugin(TestLoadBalancerPluginBase):
|
||||
member_subnet_array = params['member_subnet_array']
|
||||
member_mask_array = params['member_mask_array']
|
||||
member_gw_array = params['member_gw_array']
|
||||
self.assertEqual(member_subnet_array,
|
||||
['30.0.0.2'])
|
||||
self.assertEqual(member_mask_array,
|
||||
['255.255.255.255'])
|
||||
self.assertEqual(member_gw_array,
|
||||
[pool_sub['subnet']['gateway_ip']])
|
||||
self.assertEqual(['30.0.0.2'],
|
||||
member_subnet_array)
|
||||
self.assertEqual(['255.255.255.255'],
|
||||
member_mask_array)
|
||||
self.assertEqual([pool_sub['subnet']['gateway_ip']],
|
||||
member_gw_array)
|
||||
|
||||
def test_create_member_on_different_subnet_multiple_ports(self):
|
||||
cfg.CONF.set_override("allow_overlapping_ips", 'true')
|
||||
@ -805,13 +805,13 @@ class TestLoadBalancerPlugin(TestLoadBalancerPluginBase):
|
||||
m_sub_array = params['member_subnet_array']
|
||||
m_mask_array = params['member_mask_array']
|
||||
m_gw_array = params['member_gw_array']
|
||||
self.assertEqual(m_sub_array,
|
||||
['30.0.0.2'])
|
||||
self.assertEqual(m_mask_array,
|
||||
['255.255.255.255'])
|
||||
self.assertEqual(['30.0.0.2'],
|
||||
m_sub_array)
|
||||
self.assertEqual(['255.255.255.255'],
|
||||
m_mask_array)
|
||||
self.assertEqual(
|
||||
m_gw_array,
|
||||
[pool_sub['subnet']['gateway_ip']])
|
||||
[pool_sub['subnet']['gateway_ip']],
|
||||
m_gw_array)
|
||||
|
||||
def test_update_member_with_vip(self):
|
||||
with self.subnet() as subnet:
|
||||
@ -847,8 +847,8 @@ class TestLoadBalancerPlugin(TestLoadBalancerPluginBase):
|
||||
context.get_admin_context(),
|
||||
member['member']['id']
|
||||
)
|
||||
self.assertEqual(updated_member['status'],
|
||||
constants.ACTIVE)
|
||||
self.assertEqual(constants.ACTIVE,
|
||||
updated_member['status'])
|
||||
|
||||
def test_update_member_without_vip(self):
|
||||
with self.subnet():
|
||||
@ -859,8 +859,8 @@ class TestLoadBalancerPlugin(TestLoadBalancerPluginBase):
|
||||
context.get_admin_context(),
|
||||
member['member']['id'], member
|
||||
)
|
||||
self.assertEqual(updated_member['status'],
|
||||
constants.PENDING_UPDATE)
|
||||
self.assertEqual(constants.PENDING_UPDATE,
|
||||
updated_member['status'])
|
||||
|
||||
def test_delete_member_with_vip(self):
|
||||
with self.subnet() as subnet:
|
||||
@ -950,7 +950,7 @@ class TestLoadBalancerPlugin(TestLoadBalancerPluginBase):
|
||||
context.get_admin_context(),
|
||||
hm['health_monitor']['id'], pool['pool']['id']
|
||||
)
|
||||
self.assertEqual(phm['status'], constants.ACTIVE)
|
||||
self.assertEqual(constants.ACTIVE, phm['status'])
|
||||
|
||||
def test_delete_pool_hm_with_vip(self):
|
||||
with self.subnet() as subnet:
|
||||
|
@ -81,7 +81,7 @@ class TestLoadBalancerCallbacks(TestLoadBalancerPluginBase):
|
||||
ready = self.callbacks.get_ready_devices(
|
||||
context.get_admin_context(),
|
||||
)
|
||||
self.assertEqual(ready, [vip['vip']['pool_id']])
|
||||
self.assertEqual([vip['vip']['pool_id']], ready)
|
||||
|
||||
def test_get_ready_devices_multiple_vips_and_pools(self):
|
||||
ctx = context.get_admin_context()
|
||||
@ -120,8 +120,8 @@ class TestLoadBalancerCallbacks(TestLoadBalancerPluginBase):
|
||||
|
||||
ctx.session.flush()
|
||||
|
||||
self.assertEqual(ctx.session.query(ldb.Pool).count(), 3)
|
||||
self.assertEqual(ctx.session.query(ldb.Vip).count(), 2)
|
||||
self.assertEqual(3, ctx.session.query(ldb.Pool).count())
|
||||
self.assertEqual(2, ctx.session.query(ldb.Vip).count())
|
||||
with mock.patch('neutron_lbaas.services.loadbalancer.agent_scheduler'
|
||||
'.LbaasAgentSchedulerDbMixin'
|
||||
'.list_pools_on_lbaas_agent') as mock_agent_pools:
|
||||
@ -129,7 +129,7 @@ class TestLoadBalancerCallbacks(TestLoadBalancerPluginBase):
|
||||
{'id': pools[1].id},
|
||||
{'id': pools[2].id}]}
|
||||
ready = self.callbacks.get_ready_devices(ctx)
|
||||
self.assertEqual(len(ready), 3)
|
||||
self.assertEqual(3, len(ready))
|
||||
self.assertIn(pools[0].id, ready)
|
||||
self.assertIn(pools[1].id, ready)
|
||||
self.assertIn(pools[2].id, ready)
|
||||
@ -241,7 +241,7 @@ class TestLoadBalancerCallbacks(TestLoadBalancerPluginBase):
|
||||
ctx, pool['id']
|
||||
)
|
||||
|
||||
self.assertEqual(logical_config, expected)
|
||||
self.assertEqual(expected, logical_config)
|
||||
|
||||
def test_get_logical_device_inactive_member(self):
|
||||
with self.pool() as pool:
|
||||
@ -325,7 +325,7 @@ class TestLoadBalancerCallbacks(TestLoadBalancerPluginBase):
|
||||
db_port = core.get_port(ctx, vip['vip']['port_id'])
|
||||
|
||||
for k, v in six.iteritems(expected):
|
||||
self.assertEqual(db_port[k], v)
|
||||
self.assertEqual(v, db_port[k])
|
||||
|
||||
def test_plug_vip_port(self):
|
||||
exp = {
|
||||
@ -436,7 +436,7 @@ class TestLoadBalancerAgentApi(base.BaseTestCase):
|
||||
self.api = agent_driver_base.LoadBalancerAgentApi('topic')
|
||||
|
||||
def test_init(self):
|
||||
self.assertEqual(self.api.client.target.topic, 'topic')
|
||||
self.assertEqual('topic', self.api.client.target.topic)
|
||||
|
||||
def _call_test_helper(self, method_name, method_args):
|
||||
with contextlib.nested(
|
||||
@ -553,8 +553,8 @@ class TestLoadBalancerPluginNotificationWrapper(TestLoadBalancerPluginBase):
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
new_vip['status'],
|
||||
constants.PENDING_UPDATE
|
||||
constants.PENDING_UPDATE,
|
||||
new_vip['status']
|
||||
)
|
||||
|
||||
def test_delete_vip(self):
|
||||
@ -617,7 +617,7 @@ class TestLoadBalancerPluginNotificationWrapper(TestLoadBalancerPluginBase):
|
||||
req = self.new_delete_request('pools',
|
||||
pool['pool']['id'])
|
||||
res = req.get_response(self.ext_api)
|
||||
self.assertEqual(res.status_int, exc.HTTPNoContent.code)
|
||||
self.assertEqual(exc.HTTPNoContent.code, res.status_int)
|
||||
pool['pool']['status'] = 'PENDING_DELETE'
|
||||
self.mock_api.delete_pool.assert_called_once_with(
|
||||
mock.ANY, pool['pool'], 'host')
|
||||
@ -664,7 +664,7 @@ class TestLoadBalancerPluginNotificationWrapper(TestLoadBalancerPluginBase):
|
||||
req = self.new_delete_request('members',
|
||||
member['member']['id'])
|
||||
res = req.get_response(self.ext_api)
|
||||
self.assertEqual(res.status_int, exc.HTTPNoContent.code)
|
||||
self.assertEqual(exc.HTTPNoContent.code, res.status_int)
|
||||
member['member']['status'] = 'PENDING_DELETE'
|
||||
self.mock_api.delete_member.assert_called_once_with(
|
||||
mock.ANY, member['member'], 'host')
|
||||
@ -718,7 +718,7 @@ class TestLoadBalancerPluginNotificationWrapper(TestLoadBalancerPluginBase):
|
||||
id=pool['pool']['id'],
|
||||
subresource='health_monitors')
|
||||
res = req.get_response(self.ext_api)
|
||||
self.assertEqual(res.status_int, exc.HTTPCreated.code)
|
||||
self.assertEqual(exc.HTTPCreated.code, res.status_int)
|
||||
# hm now has a ref to the pool with which it is associated
|
||||
ctx = context.get_admin_context()
|
||||
hm = self.plugin.get_health_monitor(
|
||||
|
@ -105,8 +105,8 @@ class LBaaSAgentSchedulerTestCase(test_agent.AgentDBTestMixIn,
|
||||
lbaas_agent = self._get_lbaas_agent_hosting_pool(
|
||||
pool['pool']['id'])
|
||||
self.assertIsNotNone(lbaas_agent)
|
||||
self.assertEqual(lbaas_agent['agent']['agent_type'],
|
||||
constants.AGENT_TYPE_LOADBALANCER)
|
||||
self.assertEqual(constants.AGENT_TYPE_LOADBALANCER,
|
||||
lbaas_agent['agent']['agent_type'])
|
||||
pools = self._list_pools_hosted_by_lbaas_agent(
|
||||
lbaas_agent['agent']['id'])
|
||||
self.assertEqual(1, len(pools['pools']))
|
||||
@ -184,8 +184,8 @@ class LBaaSAgentSchedulerTestCase(test_agent.AgentDBTestMixIn,
|
||||
lbaas_agent = self._get_lbaas_agent_hosting_pool(
|
||||
pool['pool']['id'])
|
||||
self.assertIsNotNone(lbaas_agent)
|
||||
self.assertEqual(lbaas_agent['agent']['agent_type'],
|
||||
constants.AGENT_TYPE_LOADBALANCER)
|
||||
self.assertEqual(constants.AGENT_TYPE_LOADBALANCER,
|
||||
lbaas_agent['agent']['agent_type'])
|
||||
pools = self._list_pools_hosted_by_lbaas_agent(
|
||||
lbaas_agent['agent']['id'])
|
||||
self.assertEqual(1, len(pools['pools']))
|
||||
@ -194,7 +194,7 @@ class LBaaSAgentSchedulerTestCase(test_agent.AgentDBTestMixIn,
|
||||
req = self.new_delete_request('pools',
|
||||
pool['pool']['id'])
|
||||
res = req.get_response(self.ext_api)
|
||||
self.assertEqual(res.status_int, exc.HTTPNoContent.code)
|
||||
self.assertEqual(exc.HTTPNoContent.code, res.status_int)
|
||||
pools = self._list_pools_hosted_by_lbaas_agent(
|
||||
lbaas_agent['agent']['id'])
|
||||
self.assertEqual(0, len(pools['pools']))
|
||||
|
@ -64,10 +64,10 @@ class LoadBalancerExtensionTestCase(base.ExtensionTestCase):
|
||||
content_type='application/%s' % self.fmt)
|
||||
instance.create_vip.assert_called_with(mock.ANY,
|
||||
vip=data)
|
||||
self.assertEqual(res.status_int, exc.HTTPCreated.code)
|
||||
self.assertEqual(exc.HTTPCreated.code, res.status_int)
|
||||
res = self.deserialize(res)
|
||||
self.assertIn('vip', res)
|
||||
self.assertEqual(res['vip'], return_value)
|
||||
self.assertEqual(return_value, res['vip'])
|
||||
|
||||
def test_vip_list(self):
|
||||
vip_id = _uuid()
|
||||
@ -83,7 +83,7 @@ class LoadBalancerExtensionTestCase(base.ExtensionTestCase):
|
||||
|
||||
instance.get_vips.assert_called_with(mock.ANY, fields=mock.ANY,
|
||||
filters=mock.ANY)
|
||||
self.assertEqual(res.status_int, exc.HTTPOk.code)
|
||||
self.assertEqual(exc.HTTPOk.code, res.status_int)
|
||||
|
||||
def test_vip_update(self):
|
||||
vip_id = _uuid()
|
||||
@ -102,10 +102,10 @@ class LoadBalancerExtensionTestCase(base.ExtensionTestCase):
|
||||
|
||||
instance.update_vip.assert_called_with(mock.ANY, vip_id,
|
||||
vip=update_data)
|
||||
self.assertEqual(res.status_int, exc.HTTPOk.code)
|
||||
self.assertEqual(exc.HTTPOk.code, res.status_int)
|
||||
res = self.deserialize(res)
|
||||
self.assertIn('vip', res)
|
||||
self.assertEqual(res['vip'], return_value)
|
||||
self.assertEqual(return_value, res['vip'])
|
||||
|
||||
def test_vip_get(self):
|
||||
vip_id = _uuid()
|
||||
@ -122,10 +122,10 @@ class LoadBalancerExtensionTestCase(base.ExtensionTestCase):
|
||||
|
||||
instance.get_vip.assert_called_with(mock.ANY, vip_id,
|
||||
fields=mock.ANY)
|
||||
self.assertEqual(res.status_int, exc.HTTPOk.code)
|
||||
self.assertEqual(exc.HTTPOk.code, res.status_int)
|
||||
res = self.deserialize(res)
|
||||
self.assertIn('vip', res)
|
||||
self.assertEqual(res['vip'], return_value)
|
||||
self.assertEqual(return_value, res['vip'])
|
||||
|
||||
def test_vip_delete(self):
|
||||
self._test_entity_delete('vip')
|
||||
@ -153,10 +153,10 @@ class LoadBalancerExtensionTestCase(base.ExtensionTestCase):
|
||||
data['pool']['provider'] = attr.ATTR_NOT_SPECIFIED
|
||||
instance.create_pool.assert_called_with(mock.ANY,
|
||||
pool=data)
|
||||
self.assertEqual(res.status_int, exc.HTTPCreated.code)
|
||||
self.assertEqual(exc.HTTPCreated.code, res.status_int)
|
||||
res = self.deserialize(res)
|
||||
self.assertIn('pool', res)
|
||||
self.assertEqual(res['pool'], return_value)
|
||||
self.assertEqual(return_value, res['pool'])
|
||||
|
||||
def test_pool_list(self):
|
||||
pool_id = _uuid()
|
||||
@ -172,7 +172,7 @@ class LoadBalancerExtensionTestCase(base.ExtensionTestCase):
|
||||
|
||||
instance.get_pools.assert_called_with(mock.ANY, fields=mock.ANY,
|
||||
filters=mock.ANY)
|
||||
self.assertEqual(res.status_int, exc.HTTPOk.code)
|
||||
self.assertEqual(exc.HTTPOk.code, res.status_int)
|
||||
|
||||
def test_pool_update(self):
|
||||
pool_id = _uuid()
|
||||
@ -191,10 +191,10 @@ class LoadBalancerExtensionTestCase(base.ExtensionTestCase):
|
||||
|
||||
instance.update_pool.assert_called_with(mock.ANY, pool_id,
|
||||
pool=update_data)
|
||||
self.assertEqual(res.status_int, exc.HTTPOk.code)
|
||||
self.assertEqual(exc.HTTPOk.code, res.status_int)
|
||||
res = self.deserialize(res)
|
||||
self.assertIn('pool', res)
|
||||
self.assertEqual(res['pool'], return_value)
|
||||
self.assertEqual(return_value, res['pool'])
|
||||
|
||||
def test_pool_get(self):
|
||||
pool_id = _uuid()
|
||||
@ -211,10 +211,10 @@ class LoadBalancerExtensionTestCase(base.ExtensionTestCase):
|
||||
|
||||
instance.get_pool.assert_called_with(mock.ANY, pool_id,
|
||||
fields=mock.ANY)
|
||||
self.assertEqual(res.status_int, exc.HTTPOk.code)
|
||||
self.assertEqual(exc.HTTPOk.code, res.status_int)
|
||||
res = self.deserialize(res)
|
||||
self.assertIn('pool', res)
|
||||
self.assertEqual(res['pool'], return_value)
|
||||
self.assertEqual(return_value, res['pool'])
|
||||
|
||||
def test_pool_delete(self):
|
||||
self._test_entity_delete('pool')
|
||||
@ -231,10 +231,10 @@ class LoadBalancerExtensionTestCase(base.ExtensionTestCase):
|
||||
res = self.api.get(path)
|
||||
|
||||
instance.stats.assert_called_with(mock.ANY, pool_id)
|
||||
self.assertEqual(res.status_int, exc.HTTPOk.code)
|
||||
self.assertEqual(exc.HTTPOk.code, res.status_int)
|
||||
res = self.deserialize(res)
|
||||
self.assertIn('stats', res)
|
||||
self.assertEqual(res['stats'], stats['stats'])
|
||||
self.assertEqual(stats['stats'], res['stats'])
|
||||
|
||||
def test_member_create(self):
|
||||
member_id = _uuid()
|
||||
@ -254,10 +254,10 @@ class LoadBalancerExtensionTestCase(base.ExtensionTestCase):
|
||||
content_type='application/%s' % self.fmt)
|
||||
instance.create_member.assert_called_with(mock.ANY,
|
||||
member=data)
|
||||
self.assertEqual(res.status_int, exc.HTTPCreated.code)
|
||||
self.assertEqual(exc.HTTPCreated.code, res.status_int)
|
||||
res = self.deserialize(res)
|
||||
self.assertIn('member', res)
|
||||
self.assertEqual(res['member'], return_value)
|
||||
self.assertEqual(return_value, res['member'])
|
||||
|
||||
def test_member_list(self):
|
||||
member_id = _uuid()
|
||||
@ -273,7 +273,7 @@ class LoadBalancerExtensionTestCase(base.ExtensionTestCase):
|
||||
|
||||
instance.get_members.assert_called_with(mock.ANY, fields=mock.ANY,
|
||||
filters=mock.ANY)
|
||||
self.assertEqual(res.status_int, exc.HTTPOk.code)
|
||||
self.assertEqual(exc.HTTPOk.code, res.status_int)
|
||||
|
||||
def test_member_update(self):
|
||||
member_id = _uuid()
|
||||
@ -292,10 +292,10 @@ class LoadBalancerExtensionTestCase(base.ExtensionTestCase):
|
||||
|
||||
instance.update_member.assert_called_with(mock.ANY, member_id,
|
||||
member=update_data)
|
||||
self.assertEqual(res.status_int, exc.HTTPOk.code)
|
||||
self.assertEqual(exc.HTTPOk.code, res.status_int)
|
||||
res = self.deserialize(res)
|
||||
self.assertIn('member', res)
|
||||
self.assertEqual(res['member'], return_value)
|
||||
self.assertEqual(return_value, res['member'])
|
||||
|
||||
def test_member_get(self):
|
||||
member_id = _uuid()
|
||||
@ -312,10 +312,10 @@ class LoadBalancerExtensionTestCase(base.ExtensionTestCase):
|
||||
|
||||
instance.get_member.assert_called_with(mock.ANY, member_id,
|
||||
fields=mock.ANY)
|
||||
self.assertEqual(res.status_int, exc.HTTPOk.code)
|
||||
self.assertEqual(exc.HTTPOk.code, res.status_int)
|
||||
res = self.deserialize(res)
|
||||
self.assertIn('member', res)
|
||||
self.assertEqual(res['member'], return_value)
|
||||
self.assertEqual(return_value, res['member'])
|
||||
|
||||
def test_member_delete(self):
|
||||
self._test_entity_delete('member')
|
||||
@ -342,10 +342,10 @@ class LoadBalancerExtensionTestCase(base.ExtensionTestCase):
|
||||
content_type='application/%s' % self.fmt)
|
||||
instance.create_health_monitor.assert_called_with(mock.ANY,
|
||||
health_monitor=data)
|
||||
self.assertEqual(res.status_int, exc.HTTPCreated.code)
|
||||
self.assertEqual(exc.HTTPCreated.code, res.status_int)
|
||||
res = self.deserialize(res)
|
||||
self.assertIn('health_monitor', res)
|
||||
self.assertEqual(res['health_monitor'], return_value)
|
||||
self.assertEqual(return_value, res['health_monitor'])
|
||||
|
||||
def test_health_monitor_create_with_timeout_negative(self):
|
||||
data = {'health_monitor': {'type': 'HTTP',
|
||||
@ -378,7 +378,7 @@ class LoadBalancerExtensionTestCase(base.ExtensionTestCase):
|
||||
|
||||
instance.get_health_monitors.assert_called_with(
|
||||
mock.ANY, fields=mock.ANY, filters=mock.ANY)
|
||||
self.assertEqual(res.status_int, exc.HTTPOk.code)
|
||||
self.assertEqual(exc.HTTPOk.code, res.status_int)
|
||||
|
||||
def test_health_monitor_update(self):
|
||||
health_monitor_id = _uuid()
|
||||
@ -399,10 +399,10 @@ class LoadBalancerExtensionTestCase(base.ExtensionTestCase):
|
||||
|
||||
instance.update_health_monitor.assert_called_with(
|
||||
mock.ANY, health_monitor_id, health_monitor=update_data)
|
||||
self.assertEqual(res.status_int, exc.HTTPOk.code)
|
||||
self.assertEqual(exc.HTTPOk.code, res.status_int)
|
||||
res = self.deserialize(res)
|
||||
self.assertIn('health_monitor', res)
|
||||
self.assertEqual(res['health_monitor'], return_value)
|
||||
self.assertEqual(return_value, res['health_monitor'])
|
||||
|
||||
def test_health_monitor_get(self):
|
||||
health_monitor_id = _uuid()
|
||||
@ -421,10 +421,10 @@ class LoadBalancerExtensionTestCase(base.ExtensionTestCase):
|
||||
|
||||
instance.get_health_monitor.assert_called_with(
|
||||
mock.ANY, health_monitor_id, fields=mock.ANY)
|
||||
self.assertEqual(res.status_int, exc.HTTPOk.code)
|
||||
self.assertEqual(exc.HTTPOk.code, res.status_int)
|
||||
res = self.deserialize(res)
|
||||
self.assertIn('health_monitor', res)
|
||||
self.assertEqual(res['health_monitor'], return_value)
|
||||
self.assertEqual(return_value, res['health_monitor'])
|
||||
|
||||
def test_health_monitor_delete(self):
|
||||
self._test_entity_delete('health_monitor')
|
||||
@ -442,10 +442,10 @@ class LoadBalancerExtensionTestCase(base.ExtensionTestCase):
|
||||
content_type='application/%s' % self.fmt)
|
||||
instance.create_pool_health_monitor.assert_called_with(
|
||||
mock.ANY, pool_id='id1', health_monitor=data)
|
||||
self.assertEqual(res.status_int, exc.HTTPCreated.code)
|
||||
self.assertEqual(exc.HTTPCreated.code, res.status_int)
|
||||
res = self.deserialize(res)
|
||||
self.assertIn('health_monitor', res)
|
||||
self.assertEqual(res['health_monitor'], return_value)
|
||||
self.assertEqual(return_value, res['health_monitor'])
|
||||
|
||||
def test_delete_pool_health_monitor(self):
|
||||
health_monitor_id = _uuid()
|
||||
@ -456,7 +456,7 @@ class LoadBalancerExtensionTestCase(base.ExtensionTestCase):
|
||||
instance = self.plugin.return_value
|
||||
instance.delete_pool_health_monitor.assert_called_with(
|
||||
mock.ANY, health_monitor_id, pool_id='id1')
|
||||
self.assertEqual(res.status_int, exc.HTTPNoContent.code)
|
||||
self.assertEqual(exc.HTTPNoContent.code, res.status_int)
|
||||
|
||||
|
||||
class LoadBalancerExtensionV2TestCase(base.ExtensionTestCase):
|
||||
@ -490,10 +490,10 @@ class LoadBalancerExtensionV2TestCase(base.ExtensionTestCase):
|
||||
instance.create_loadbalancer.assert_called_with(mock.ANY,
|
||||
loadbalancer=data)
|
||||
|
||||
self.assertEqual(res.status_int, exc.HTTPCreated.code)
|
||||
self.assertEqual(exc.HTTPCreated.code, res.status_int)
|
||||
res = self.deserialize(res)
|
||||
self.assertIn('loadbalancer', res)
|
||||
self.assertEqual(res['loadbalancer'], return_value)
|
||||
self.assertEqual(return_value, res['loadbalancer'])
|
||||
|
||||
def test_loadbalancer_list(self):
|
||||
lb_id = _uuid()
|
||||
@ -510,7 +510,7 @@ class LoadBalancerExtensionV2TestCase(base.ExtensionTestCase):
|
||||
instance.get_loadbalancers.assert_called_with(mock.ANY,
|
||||
fields=mock.ANY,
|
||||
filters=mock.ANY)
|
||||
self.assertEqual(res.status_int, exc.HTTPOk.code)
|
||||
self.assertEqual(exc.HTTPOk.code, res.status_int)
|
||||
|
||||
def test_loadbalancer_update(self):
|
||||
lb_id = _uuid()
|
||||
@ -530,10 +530,10 @@ class LoadBalancerExtensionV2TestCase(base.ExtensionTestCase):
|
||||
|
||||
instance.update_loadbalancer.assert_called_with(
|
||||
mock.ANY, lb_id, loadbalancer=update_data)
|
||||
self.assertEqual(res.status_int, exc.HTTPOk.code)
|
||||
self.assertEqual(exc.HTTPOk.code, res.status_int)
|
||||
res = self.deserialize(res)
|
||||
self.assertIn('loadbalancer', res)
|
||||
self.assertEqual(res['loadbalancer'], return_value)
|
||||
self.assertEqual(return_value, res['loadbalancer'])
|
||||
|
||||
def test_loadbalancer_get(self):
|
||||
lb_id = _uuid()
|
||||
@ -551,10 +551,10 @@ class LoadBalancerExtensionV2TestCase(base.ExtensionTestCase):
|
||||
|
||||
instance.get_loadbalancer.assert_called_with(mock.ANY, lb_id,
|
||||
fields=mock.ANY)
|
||||
self.assertEqual(res.status_int, exc.HTTPOk.code)
|
||||
self.assertEqual(exc.HTTPOk.code, res.status_int)
|
||||
res = self.deserialize(res)
|
||||
self.assertIn('loadbalancer', res)
|
||||
self.assertEqual(res['loadbalancer'], return_value)
|
||||
self.assertEqual(return_value, res['loadbalancer'])
|
||||
|
||||
def test_loadbalancer_delete(self):
|
||||
self._test_entity_delete('loadbalancer')
|
||||
@ -584,10 +584,10 @@ class LoadBalancerExtensionV2TestCase(base.ExtensionTestCase):
|
||||
instance.create_listener.assert_called_with(mock.ANY,
|
||||
listener=data)
|
||||
|
||||
self.assertEqual(res.status_int, exc.HTTPCreated.code)
|
||||
self.assertEqual(exc.HTTPCreated.code, res.status_int)
|
||||
res = self.deserialize(res)
|
||||
self.assertIn('listener', res)
|
||||
self.assertEqual(res['listener'], return_value)
|
||||
self.assertEqual(return_value, res['listener'])
|
||||
|
||||
def test_listener_list(self):
|
||||
listener_id = _uuid()
|
||||
@ -603,7 +603,7 @@ class LoadBalancerExtensionV2TestCase(base.ExtensionTestCase):
|
||||
instance.get_listeners.assert_called_with(mock.ANY,
|
||||
fields=mock.ANY,
|
||||
filters=mock.ANY)
|
||||
self.assertEqual(res.status_int, exc.HTTPOk.code)
|
||||
self.assertEqual(exc.HTTPOk.code, res.status_int)
|
||||
|
||||
def test_listener_update(self):
|
||||
listener_id = _uuid()
|
||||
@ -623,10 +623,10 @@ class LoadBalancerExtensionV2TestCase(base.ExtensionTestCase):
|
||||
|
||||
instance.update_listener.assert_called_with(
|
||||
mock.ANY, listener_id, listener=update_data)
|
||||
self.assertEqual(res.status_int, exc.HTTPOk.code)
|
||||
self.assertEqual(exc.HTTPOk.code, res.status_int)
|
||||
res = self.deserialize(res)
|
||||
self.assertIn('listener', res)
|
||||
self.assertEqual(res['listener'], return_value)
|
||||
self.assertEqual(return_value, res['listener'])
|
||||
|
||||
def test_listener_get(self):
|
||||
listener_id = _uuid()
|
||||
@ -644,10 +644,10 @@ class LoadBalancerExtensionV2TestCase(base.ExtensionTestCase):
|
||||
|
||||
instance.get_listener.assert_called_with(mock.ANY, listener_id,
|
||||
fields=mock.ANY)
|
||||
self.assertEqual(res.status_int, exc.HTTPOk.code)
|
||||
self.assertEqual(exc.HTTPOk.code, res.status_int)
|
||||
res = self.deserialize(res)
|
||||
self.assertIn('listener', res)
|
||||
self.assertEqual(res['listener'], return_value)
|
||||
self.assertEqual(return_value, res['listener'])
|
||||
|
||||
def test_listener_delete(self):
|
||||
self._test_entity_delete('listener')
|
||||
@ -672,10 +672,10 @@ class LoadBalancerExtensionV2TestCase(base.ExtensionTestCase):
|
||||
self.serialize(data),
|
||||
content_type='application/%s' % self.fmt)
|
||||
instance.create_pool.assert_called_with(mock.ANY, pool=data)
|
||||
self.assertEqual(res.status_int, exc.HTTPCreated.code)
|
||||
self.assertEqual(exc.HTTPCreated.code, res.status_int)
|
||||
res = self.deserialize(res)
|
||||
self.assertIn('pool', res)
|
||||
self.assertEqual(res['pool'], return_value)
|
||||
self.assertEqual(return_value, res['pool'])
|
||||
|
||||
def test_pool_list(self):
|
||||
pool_id = _uuid()
|
||||
@ -691,7 +691,7 @@ class LoadBalancerExtensionV2TestCase(base.ExtensionTestCase):
|
||||
|
||||
instance.get_pools.assert_called_with(mock.ANY, fields=mock.ANY,
|
||||
filters=mock.ANY)
|
||||
self.assertEqual(res.status_int, exc.HTTPOk.code)
|
||||
self.assertEqual(exc.HTTPOk.code, res.status_int)
|
||||
|
||||
def test_pool_update(self):
|
||||
pool_id = _uuid()
|
||||
@ -710,10 +710,10 @@ class LoadBalancerExtensionV2TestCase(base.ExtensionTestCase):
|
||||
|
||||
instance.update_pool.assert_called_with(mock.ANY, pool_id,
|
||||
pool=update_data)
|
||||
self.assertEqual(res.status_int, exc.HTTPOk.code)
|
||||
self.assertEqual(exc.HTTPOk.code, res.status_int)
|
||||
res = self.deserialize(res)
|
||||
self.assertIn('pool', res)
|
||||
self.assertEqual(res['pool'], return_value)
|
||||
self.assertEqual(return_value, res['pool'])
|
||||
|
||||
def test_pool_get(self):
|
||||
pool_id = _uuid()
|
||||
@ -730,10 +730,10 @@ class LoadBalancerExtensionV2TestCase(base.ExtensionTestCase):
|
||||
|
||||
instance.get_pool.assert_called_with(mock.ANY, pool_id,
|
||||
fields=mock.ANY)
|
||||
self.assertEqual(res.status_int, exc.HTTPOk.code)
|
||||
self.assertEqual(exc.HTTPOk.code, res.status_int)
|
||||
res = self.deserialize(res)
|
||||
self.assertIn('pool', res)
|
||||
self.assertEqual(res['pool'], return_value)
|
||||
self.assertEqual(return_value, res['pool'])
|
||||
|
||||
def test_pool_delete(self):
|
||||
self._test_entity_delete('pool')
|
||||
@ -760,10 +760,10 @@ class LoadBalancerExtensionV2TestCase(base.ExtensionTestCase):
|
||||
instance.create_pool_member.assert_called_with(mock.ANY,
|
||||
pool_id='pid1',
|
||||
member=data)
|
||||
self.assertEqual(res.status_int, exc.HTTPCreated.code)
|
||||
self.assertEqual(exc.HTTPCreated.code, res.status_int)
|
||||
res = self.deserialize(res)
|
||||
self.assertIn('member', res)
|
||||
self.assertEqual(res['member'], return_value)
|
||||
self.assertEqual(return_value, res['member'])
|
||||
|
||||
def test_pool_member_list(self):
|
||||
member_id = _uuid()
|
||||
@ -782,7 +782,7 @@ class LoadBalancerExtensionV2TestCase(base.ExtensionTestCase):
|
||||
fields=mock.ANY,
|
||||
filters=mock.ANY,
|
||||
pool_id='pid1')
|
||||
self.assertEqual(res.status_int, exc.HTTPOk.code)
|
||||
self.assertEqual(exc.HTTPOk.code, res.status_int)
|
||||
|
||||
def test_pool_member_update(self):
|
||||
member_id = _uuid()
|
||||
@ -802,10 +802,10 @@ class LoadBalancerExtensionV2TestCase(base.ExtensionTestCase):
|
||||
instance.update_pool_member.assert_called_with(
|
||||
mock.ANY, member_id, pool_id='pid1',
|
||||
member=update_data)
|
||||
self.assertEqual(res.status_int, exc.HTTPOk.code)
|
||||
self.assertEqual(exc.HTTPOk.code, res.status_int)
|
||||
res = self.deserialize(res)
|
||||
self.assertIn('member', res)
|
||||
self.assertEqual(res['member'], return_value)
|
||||
self.assertEqual(return_value, res['member'])
|
||||
|
||||
def test_pool_member_get(self):
|
||||
member_id = _uuid()
|
||||
@ -823,10 +823,10 @@ class LoadBalancerExtensionV2TestCase(base.ExtensionTestCase):
|
||||
member_id,
|
||||
fields=mock.ANY,
|
||||
pool_id='pid1')
|
||||
self.assertEqual(res.status_int, exc.HTTPOk.code)
|
||||
self.assertEqual(exc.HTTPOk.code, res.status_int)
|
||||
res = self.deserialize(res)
|
||||
self.assertIn('member', res)
|
||||
self.assertEqual(res['member'], return_value)
|
||||
self.assertEqual(return_value, res['member'])
|
||||
|
||||
def test_pool_member_delete(self):
|
||||
entity_id = _uuid()
|
||||
@ -837,7 +837,7 @@ class LoadBalancerExtensionV2TestCase(base.ExtensionTestCase):
|
||||
"delete_pool_member")
|
||||
delete_entity.assert_called_with(mock.ANY, entity_id,
|
||||
pool_id='pid1')
|
||||
self.assertEqual(res.status_int, exc.HTTPNoContent.code)
|
||||
self.assertEqual(exc.HTTPNoContent.code, res.status_int)
|
||||
|
||||
def test_health_monitor_create(self):
|
||||
health_monitor_id = _uuid()
|
||||
@ -863,10 +863,10 @@ class LoadBalancerExtensionV2TestCase(base.ExtensionTestCase):
|
||||
content_type='application/%s' % self.fmt)
|
||||
instance.create_healthmonitor.assert_called_with(
|
||||
mock.ANY, healthmonitor=data)
|
||||
self.assertEqual(res.status_int, exc.HTTPCreated.code)
|
||||
self.assertEqual(exc.HTTPCreated.code, res.status_int)
|
||||
res = self.deserialize(res)
|
||||
self.assertIn('healthmonitor', res)
|
||||
self.assertEqual(res['healthmonitor'], return_value)
|
||||
self.assertEqual(return_value, res['healthmonitor'])
|
||||
|
||||
def test_health_monitor_create_with_timeout_negative(self):
|
||||
data = {'healthmonitor': {'type': 'HTTP',
|
||||
@ -900,7 +900,7 @@ class LoadBalancerExtensionV2TestCase(base.ExtensionTestCase):
|
||||
|
||||
instance.get_healthmonitors.assert_called_with(
|
||||
mock.ANY, fields=mock.ANY, filters=mock.ANY)
|
||||
self.assertEqual(res.status_int, exc.HTTPOk.code)
|
||||
self.assertEqual(exc.HTTPOk.code, res.status_int)
|
||||
|
||||
def test_health_monitor_update(self):
|
||||
health_monitor_id = _uuid()
|
||||
@ -920,10 +920,10 @@ class LoadBalancerExtensionV2TestCase(base.ExtensionTestCase):
|
||||
|
||||
instance.update_healthmonitor.assert_called_with(
|
||||
mock.ANY, health_monitor_id, healthmonitor=update_data)
|
||||
self.assertEqual(res.status_int, exc.HTTPOk.code)
|
||||
self.assertEqual(exc.HTTPOk.code, res.status_int)
|
||||
res = self.deserialize(res)
|
||||
self.assertIn('healthmonitor', res)
|
||||
self.assertEqual(res['healthmonitor'], return_value)
|
||||
self.assertEqual(return_value, res['healthmonitor'])
|
||||
|
||||
def test_health_monitor_get(self):
|
||||
health_monitor_id = _uuid()
|
||||
@ -941,10 +941,10 @@ class LoadBalancerExtensionV2TestCase(base.ExtensionTestCase):
|
||||
|
||||
instance.get_healthmonitor.assert_called_with(
|
||||
mock.ANY, health_monitor_id, fields=mock.ANY)
|
||||
self.assertEqual(res.status_int, exc.HTTPOk.code)
|
||||
self.assertEqual(exc.HTTPOk.code, res.status_int)
|
||||
res = self.deserialize(res)
|
||||
self.assertIn('healthmonitor', res)
|
||||
self.assertEqual(res['healthmonitor'], return_value)
|
||||
self.assertEqual(return_value, res['healthmonitor'])
|
||||
|
||||
def test_health_monitor_delete(self):
|
||||
entity_id = _uuid()
|
||||
@ -954,7 +954,7 @@ class LoadBalancerExtensionV2TestCase(base.ExtensionTestCase):
|
||||
delete_entity = getattr(self.plugin.return_value,
|
||||
"delete_healthmonitor")
|
||||
delete_entity.assert_called_with(mock.ANY, entity_id)
|
||||
self.assertEqual(res.status_int, exc.HTTPNoContent.code)
|
||||
self.assertEqual(exc.HTTPNoContent.code, res.status_int)
|
||||
|
||||
def test_load_balancer_stats(self):
|
||||
load_balancer_id = _uuid()
|
||||
@ -968,10 +968,10 @@ class LoadBalancerExtensionV2TestCase(base.ExtensionTestCase):
|
||||
res = self.api.get(path)
|
||||
|
||||
instance.stats.assert_called_with(mock.ANY, load_balancer_id)
|
||||
self.assertEqual(res.status_int, exc.HTTPOk.code)
|
||||
self.assertEqual(exc.HTTPOk.code, res.status_int)
|
||||
res = self.deserialize(res)
|
||||
self.assertIn('stats', res)
|
||||
self.assertEqual(res['stats'], stats['stats'])
|
||||
self.assertEqual(stats['stats'], res['stats'])
|
||||
|
||||
def test_load_balancer_statuses(self):
|
||||
load_balancer_id = _uuid()
|
||||
@ -983,7 +983,7 @@ class LoadBalancerExtensionV2TestCase(base.ExtensionTestCase):
|
||||
action="statuses", fmt=self.fmt)
|
||||
res = self.api.get(path)
|
||||
instance.statuses.assert_called_with(mock.ANY, load_balancer_id)
|
||||
self.assertEqual(res.status_int, exc.HTTPOk.code)
|
||||
self.assertEqual(exc.HTTPOk.code, res.status_int)
|
||||
res = self.deserialize(res)
|
||||
self.assertIn('statuses', res)
|
||||
self.assertEqual(res['statuses'], statuses['statuses'])
|
||||
self.assertEqual(statuses['statuses'], res['statuses'])
|
||||
|
@ -137,8 +137,8 @@ class LBaaSAgentSchedulerTestCase(test_agent.AgentDBTestMixIn,
|
||||
lbaas_agent = self._get_lbaas_agent_hosting_loadbalancer(
|
||||
loadbalancer['loadbalancer']['id'])
|
||||
self.assertIsNotNone(lbaas_agent)
|
||||
self.assertEqual(lbaas_agent['agent']['agent_type'],
|
||||
lb_const.AGENT_TYPE_LOADBALANCERV2)
|
||||
self.assertEqual(lb_const.AGENT_TYPE_LOADBALANCERV2,
|
||||
lbaas_agent['agent']['agent_type'])
|
||||
loadbalancers = self._list_loadbalancers_hosted_by_agent(
|
||||
lbaas_agent['agent']['id'])
|
||||
self.assertEqual(1, len(loadbalancers['loadbalancers']))
|
||||
@ -219,8 +219,8 @@ class LBaaSAgentSchedulerTestCase(test_agent.AgentDBTestMixIn,
|
||||
lb_id = loadbalancer['loadbalancer']['id']
|
||||
lbaas_agent = self._get_lbaas_agent_hosting_loadbalancer(lb_id)
|
||||
self.assertIsNotNone(lbaas_agent)
|
||||
self.assertEqual(lbaas_agent['agent']['agent_type'],
|
||||
lb_const.AGENT_TYPE_LOADBALANCERV2)
|
||||
self.assertEqual(lb_const.AGENT_TYPE_LOADBALANCERV2,
|
||||
lbaas_agent['agent']['agent_type'])
|
||||
loadbalancers = self._list_loadbalancers_hosted_by_agent(
|
||||
lbaas_agent['agent']['id'])
|
||||
self.assertEqual(1, len(loadbalancers['loadbalancers']))
|
||||
@ -233,7 +233,7 @@ class LBaaSAgentSchedulerTestCase(test_agent.AgentDBTestMixIn,
|
||||
|
||||
req = self.new_delete_request('loadbalancers', lb_id)
|
||||
res = req.get_response(self.ext_api)
|
||||
self.assertEqual(res.status_int, exc.HTTPNoContent.code)
|
||||
self.assertEqual(exc.HTTPNoContent.code, res.status_int)
|
||||
loadbalancers = self._list_loadbalancers_hosted_by_agent(
|
||||
lbaas_agent['agent']['id'])
|
||||
self.assertEqual(0, len(loadbalancers['loadbalancers']))
|
||||
|
Loading…
Reference in New Issue
Block a user