Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use PlacementFixture in functional tests
Change the functional tests to use the PlacementFixture instead of devstack as the source of a placement API. This speeds up the tests considerably and lowers the number of dependencies. There are four primary changes: * For each test a PlacementFixture is instantiated, using the usual in-RAM db and in-process placement. * Because of some exceedingly confusing optimizations in osc_lib and python-openstackclient, done to improve start up time, a session to placement was caching the service url. This meant that after a first test succeeded, every subsequent one would not because it was trying to talk to a fake hostname that was no longer being intercepted. The workaround for this was to monkeypatch the method in the ClientCache class which provides access to a client (per service-type). The replacement method makes a new client every time. * The previous tests would subprocess out to a real call of the openstack command and then interpret the results. Now, a run() method on OpenStackShell is called instead. This accepts arguments in the same way, but we need to a) capture stderr and stdout, b) make a try/except for SystemExit to get some error responses (mostly from the argparse lib which has a tendency to exit for you instead of politely telling you it wants to), c) deal with errors from commands ourself rather than using exceptions from the subprocess module. Switching to this form means that logging becomes in-process and more visible. To accomodate this the Capture fixture from placement is used. This was chosen because we are already pulling in the PlacementFixture. If this seems icky, I can fix it with a local one. This was the shorter path. * The legacy dsvm jobs have been removed in favor of "standard" functional jobs for 2.7 and 3.6 that require openstack/placement. The playbooks associated with the legacy jobs are removed. tox.ini is adjusted to reflect this new setup. Because tox-siblings functional is being used, we don't want to share tox envs with the unit tests. The 3.5 functional job is removed because we no longer target that. After running these for a while it became clear that there were intermittent failures being caused by subunit attachments being too large. This was eventually traced back to logging from all packages being set to DEBUG even when something else was requested. That was traced back to a poor interaction between the way that osc does logging and the way oslo_logging does logging (used by placement and thus the placement fixture). The workaround, embodied in the RESET_LOGGING list in osc_placement/tests/functional/base.py, is to get and reset the log level for a subset of the packages that are used. Change-Id: I7deda200b372ff6a7ba67b0c4fa0e53c4fa16ffc Story: 2005411 Task: 30428
- Loading branch information
Showing
13 changed files
with
167 additions
and
425 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.