Move migration to proper dir and fix objects tests

This is an alternative to revert patch:
https://review.opendev.org/#/c/691710/

Change-Id: I72082226e6b3930efb537cab9d979e5770211f72
Closes-Bug: #1849976
This commit is contained in:
Oleg Bondarev 2019-10-31 11:36:59 +04:00 committed by Rodolfo Alonso Hernandez
parent 38c06ff3d0
commit 0a3c53e411
3 changed files with 6 additions and 5 deletions

View File

@ -22,7 +22,7 @@ import sqlalchemy as sa
"""Add binding index to NetworkDhcpAgentBindings
Revision ID: c3e9d13c4367
Revises: 63fd95af7dcd
Revises: c613d0b82681
Create Date: 2019-08-20 18:42:39.647676
"""
@ -38,7 +38,7 @@ NETWORK_DHCP_AGENT_BINDING = 'networkdhcpagentbindings'
def upgrade():
op.add_column(NETWORK_DHCP_AGENT_BINDING,
sa.Column('binding_index', sa.Integer(), nullable=False,
server_default='1', autoincrement=True))
server_default='1'))
bindings_table = sa.Table(
NETWORK_DHCP_AGENT_BINDING,

View File

@ -39,5 +39,4 @@ class NetworkDhcpAgentBinding(model_base.BASEV2):
ondelete='CASCADE'),
primary_key=True)
binding_index = sa.Column(sa.Integer, nullable=False,
server_default=str(LOWEST_BINDING_INDEX),
autoincrement=True)
server_default=str(LOWEST_BINDING_INDEX))

View File

@ -93,9 +93,11 @@ class NetworkDhcpAgentBindingDbObjectTestCase(
super(NetworkDhcpAgentBindingDbObjectTestCase, self).setUp()
self._network = self._create_test_network()
index = iter(range(1, len(self.objs) + 2))
self.update_obj_fields(
{'network_id': self._network.id,
'dhcp_agent_id': lambda: self._create_test_agent_id()})
'dhcp_agent_id': lambda: self._create_test_agent_id(),
'binding_index': lambda: next(index)})
class NetworkPortSecurityIfaceObjTestCase(