Update template for ModelMigrationSync test
Add some more useful details in template and update contribute.rst with link for template. Related-bug: #1470678 Change-Id: I8785129ba85236220650b2ba7ec0bc605847b1b7
This commit is contained in:
@@ -452,7 +452,7 @@ DB Model/Migration Testing
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Here is a `template functional test
|
||||
<https://bugs.launchpad.net/neutron/+bug/1470678>`_ (TODO:Ann) third-party
|
||||
<http://docs.openstack.org/developer/neutron/devref/template_model_sync_test.html>`_ third-party
|
||||
maintainers can use to develop tests for model-vs-migration sync in their
|
||||
repos. It is recommended that each third-party CI sets up such a test, and runs
|
||||
it regularly against Neutron master.
|
||||
|
@@ -86,6 +86,11 @@ names, which were moved out of Neutron: ::
|
||||
+ REPO_ARISTA_TABLES + REPO_CISCO_TABLES)
|
||||
|
||||
|
||||
Also the test uses **VERSION_TABLE**, it is the name of table in database which
|
||||
contains revision id of head migration. It is preferred to keep this variable in
|
||||
``networking_foo/db/migration/alembic_migrations/__init__.py`` so it will be easy
|
||||
to use in test.
|
||||
|
||||
Create a module ``networking_foo/tests/functional/db/test_migrations.py``
|
||||
with the following content: ::
|
||||
|
||||
@@ -96,7 +101,7 @@ with the following content: ::
|
||||
from neutron.tests.common import base
|
||||
from neutron.tests.functional.db import test_migrations
|
||||
|
||||
from networking_foo.db.migration.alembic_migrations import env
|
||||
from networking_foo.db.migration import alembic_migrations
|
||||
from networking_foo.db.models import head
|
||||
|
||||
# EXTERNAL_TABLES should contain all names of tables that are not related to
|
||||
@@ -118,7 +123,7 @@ with the following content: ::
|
||||
|
||||
def include_object(self, object_, name, type_, reflected, compare_to):
|
||||
if type_ == 'table' and (name == 'alembic' or
|
||||
name == env.VERSION_TABLE or
|
||||
name == alembic_migrations.VERSION_TABLE or
|
||||
name in EXTERNAL_TABLES):
|
||||
return False
|
||||
else:
|
||||
|
Reference in New Issue
Block a user