Merge "Fix test_migration import"

This commit is contained in:
Jenkins 2016-10-04 07:46:01 +00:00 committed by Gerrit Code Review
commit ba03d6c9a4
8 changed files with 80 additions and 9 deletions

View File

@ -9,6 +9,8 @@ fixtures>=3.0.0 # Apache-2.0/BSD
mock>=2.0 # BSD
python-subunit>=0.0.18 # Apache-2.0/BSD
sphinx!=1.3b1,<1.4,>=1.2.1 # BSD
psycopg2>=2.5 # LGPL/ZPL
PyMySQL!=0.7.7,>=0.6.2 # MIT License
oslosphinx>=4.7.0 # Apache-2.0
oslotest>=1.10.0 # Apache-2.0
testrepository>=0.0.18 # Apache-2.0/BSD

View File

@ -58,6 +58,9 @@ sitepackages = True
[testenv:releasenotes]
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
[testenv:py27]
setenv = OS_FAIL_ON_MISSING_DEPS=1
[testenv:pep8]
basepython = python2.7
deps =

View File

@ -18,6 +18,7 @@ from oslo_utils import uuidutils
import sqlalchemy as sa
from sqlalchemy import orm
from sqlalchemy.orm import exc
from sqlalchemy import sql
from neutron.api.v2 import attributes
from neutron.common import utils as n_utils
@ -41,7 +42,8 @@ class NsxExtendedSecurityGroupProperties(model_base.BASEV2):
ondelete="CASCADE"),
primary_key=True)
logging = sa.Column(sa.Boolean, default=False, nullable=False)
provider = sa.Column(sa.Boolean, default=False, nullable=False)
provider = sa.Column(sa.Boolean, default=False, server_default=sql.false(),
nullable=False)
security_group = orm.relationship(
securitygroups_db.SecurityGroup,
backref=orm.backref('ext_properties', lazy='joined',

View File

@ -46,6 +46,6 @@ def upgrade():
def change_pk_constraint(table_name, columns):
inspector = reflection.Inspector.from_engine(op.get_bind())
pk_constraint = inspector.get_pk_constraint(table_name)
op.drop_constraint(pk_constraint, table_name, type_='primary')
op.drop_constraint(pk_constraint.get('name'), table_name, type_='primary')
op.drop_column(table_name, 'listener_id')
op.create_primary_key(None, table_name, columns)

View File

@ -14,6 +14,8 @@
from neutron.db.migration.models import head
from vmware_nsx.db import extended_security_group # noqa
from vmware_nsx.db import extended_security_group_rule # noqa
from vmware_nsx.db import nsx_models # noqa
from vmware_nsx.db import nsxv_models # noqa
from vmware_nsx.db import vcns_models # noqa

View File

@ -16,8 +16,6 @@
import os
from networking_l2gw.db.l2gateway import l2gateway_models # noqa
from vmware_nsx.api_client import client as nsx_client
from vmware_nsx.api_client import eventlet_client
from vmware_nsx import extensions

View File

@ -22,11 +22,74 @@ from neutron.tests.functional.db import test_migrations
from neutron.tests.unit import testlib_api
from vmware_nsx.db.migration import alembic_migrations
from vmware_nsx.db.models import head
from vmware_nsx.db.migration.models import head
#TODO(abhiraut): Remove this list from here once *aaS repos forms its
# own list.
# Add *aaS tables to EXTERNAL_TABLES since they should not be
# tested.
LBAAS_TABLES = {
'nsxv_edge_monitor_mappings',
'nsxv_edge_pool_mappings',
'nsxv_edge_vip_mappings',
# LBaaS v2 tables
'lbaas_healthmonitors',
'lbaas_l7policies',
'lbaas_l7rules',
'lbaas_listeners',
'lbaas_loadbalancer_statistics',
'lbaas_loadbalanceragentbindings',
'lbaas_loadbalancers',
'lbaas_members',
'lbaas_pools',
'lbaas_sessionpersistences',
'lbaas_sni',
}
L2GW_TABLES = {
'l2gw_alembic_version',
'physical_locators',
'physical_switches',
'physical_ports',
'logical_switches',
'ucast_macs_locals',
'ucast_macs_remotes',
'vlan_bindings',
'l2gatewayconnections',
'l2gatewayinterfaces',
'l2gatewaydevices',
'l2gateways',
'pending_ucast_macs_remotes'
}
SFC_TABLES = {
'sfc_flow_classifier_l7_parameters',
'sfc_flow_classifiers',
'sfc_port_chain_parameters',
'sfc_service_function_params',
'sfc_port_pair_group_params',
'sfc_chain_classifier_associations',
'sfc_port_pairs',
'sfc_chain_group_associations',
'sfc_port_pair_groups',
'sfc_port_chains',
'sfc_uuid_intid_associations',
'sfc_path_port_associations',
'sfc_portpair_details',
'sfc_path_nodes',
}
TAAS_TABLES = {
'tap_services',
'tap_flows',
'tap_id_associations',
}
# EXTERNAL_TABLES should contain all names of tables that are not related to
# current repo.
EXTERNAL_TABLES = set(external.TABLES) - set(external.REPO_VMWARE_TABLES)
EXTERNAL_TABLES = (set(external.TABLES) | LBAAS_TABLES |
L2GW_TABLES | SFC_TABLES | TAAS_TABLES)
class _TestModelsMigrationsFoo(test_migrations._TestModelsMigrations):
@ -42,12 +105,13 @@ class _TestModelsMigrationsFoo(test_migrations._TestModelsMigrations):
return head.get_metadata()
def include_object(self, object_, name, type_, reflected, compare_to):
if type_ == 'table' and (name == 'alembic' or
if type_ == 'table' and (name.startswith('alembic') or
name == alembic_migrations.VERSION_TABLE or
name in EXTERNAL_TABLES):
return False
else:
return True
if type_ == 'index' and reflected and name.startswith("idx_autoinc_"):
return False
return True
class TestModelsMigrationsMysql(testlib_api.MySQLTestCaseMixin,