placement/placement/db
Chris Dent 2c72b94719 Adapt placement fixtures for external use
This change makes it easier to use the PlacementFixture from external
systems (mostly nova) that would like to run functional tests with a
stubbed in placement service, including a database.

A 'set_config' boolean flag is added to the Database fixture to allow
the caller to indicate they have not themselves set a connection string
in the placement_database group and want the fixture to do so.

That fixture attempts to register the group and opt but allows that to
fail if it has already been done. This provides some resiliency in the
face of nova currently having the group and option but not having it
later.

Because both nova and placement use global config, we need to avoid
registering and processing all of placement's config options anywhere
during the use of the fixture (from nova), otherwise errors will
happen. Therefore, we cannot use migration.upgrade in the Database
fixture, as env.py currently pulls in and processes a global config.
Instead we use a create_schema method. Migrations continue to be
tested by the migration specific tests.

The necessary functionality of syncing traits and resources classes is
handled by the fixture itself, rather than things that call it, allowing
some cleanups in other fixtures. This centralizes database handling in
one place, which is probalby how it should have been all along, but as
with all evolving things, it meandered.

The PlacementFixture is updated to use the Database fixture
automatically, unless a db keyword arg is set to False.

Change-Id: I7d4099c1da425bb4ea115ac51c82f5748203f2d3
2018-11-20 15:00:58 +00:00
..
sqlalchemy Adapt placement fixtures for external use 2018-11-20 15:00:58 +00:00
__init__.py Empty __init__.py files that should be empty 2018-09-04 10:31:26 -05:00
constants.py Rename the 'nova' directories to 'placement' 2018-09-04 10:31:22 -05:00