Merge "improve UT coverage for nicira_db operations"
This commit is contained in:
commit
7929b6e2b9
@ -67,6 +67,10 @@ def add_neutron_nsx_port_mapping(session, neutron_id,
|
||||
LOG.debug(_("Port mapping for %s already available"), neutron_id)
|
||||
else:
|
||||
raise
|
||||
except d_exc.DBError:
|
||||
# rollback for any other db error
|
||||
session.rollback()
|
||||
raise
|
||||
return mapping
|
||||
|
||||
|
||||
|
@ -77,3 +77,12 @@ class NiciraDBTestCase(base.BaseTestCase):
|
||||
nicira_db.add_neutron_nsx_port_mapping,
|
||||
self.ctx.session, neutron_port_id,
|
||||
nsx_switch_id, nsx_port_id_2)
|
||||
|
||||
def test_add_neutron_nsx_port_mapping_raise_integrity_constraint(self):
|
||||
neutron_port_id = 'foo_neutron_port_id'
|
||||
nsx_port_id = 'foo_nsx_port_id'
|
||||
nsx_switch_id = 'foo_nsx_switch_id'
|
||||
self.assertRaises(d_exc.DBError,
|
||||
nicira_db.add_neutron_nsx_port_mapping,
|
||||
self.ctx.session, neutron_port_id,
|
||||
nsx_switch_id, nsx_port_id)
|
||||
|
Loading…
Reference in New Issue
Block a user