Stop using PlacementDirect

PlacementDirect was integrated into a functional test suite when it was
first created as a way to prove that it worked [1] and demonstrate how
to use it.

However, it was a pain then, because the interceptor needs to be created
every time you want to use it; and since extracted placement started
diverging from in-tree placement, other problems started cropping up
(see the associated bug).

So this commit removes the use of PlacementDirect from nova. Details:

- test_report_client now uses PlacementFixture. So all the `with
  interceptor` context management is gone. This accounts for the vast
  majority of the apparent change, which is just outdenting those
  contexts.
- SchedulerReportClientTestBase, which was doing some hocus pocus to
  wrap the SchedulerReportClient such that we could do some microversion
  checks, is removed. The test suite simply instantiates the
  microversion-checking wrapper class directly as the client used by the
  test cases.
- We were taking advantage of a PlacementDirect feature allowing us to
  default to the latest microversion if not explicitly specified in the
  request. Without this, we had to add the `version` kwarg to some of
  the calls we were making to SchedulerReportClient primitives
  (get/put/post/delete).
- A piece of test_update_from_provider_tree was using a
  deliberately-broken interceptor to prove that the code in question
  wasn't hitting the API. We replace this with a non-callable mock on
  the Adapter's request method.
- test_global_request_id was taking advantage of the interceptor to
  validate that the global request ID was making it to the "other side"
  of the API boundary. This was fun, but overkill. We now simply assert
  that the correct HTTP header is making it into the ksa Adapter's
  request method.
- Functional test suite test_resource_tracker.IronicResourceTrackerTest
  was inheriting from the SchedulerReportClientTestBase class, but not
  using the interceptor anywhere. Can't tell you why that was done. So
  now it just uses the plain old test.TestCase like everyone else.

[1] This commit does remove all of nova's testing of PlacementDirect.
However, it is still tested in the placement repository itself:
69b9659a45/placement/tests/functional/test_direct.py

Change-Id: Icb889c09a69e7c5cbf9330e5d9917d6ab3ac3dc5
Related-Bug: #1818560
This commit is contained in:
Eric Fried 2019-03-04 16:08:39 -06:00
parent 19cbbbebdd
commit f2d088b04e
2 changed files with 953 additions and 1027 deletions

View File

@ -22,9 +22,9 @@ from nova.compute import vm_states
from nova import conf
from nova import context
from nova import objects
from nova import test
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.functional import test_report_client as test_base
from nova.virt import driver as virt_driver
@ -35,7 +35,7 @@ DISK_GB = orc.DISK_GB
COMPUTE_HOST = 'compute-host'
class IronicResourceTrackerTest(test_base.SchedulerReportClientTestBase):
class IronicResourceTrackerTest(test.TestCase):
"""Tests the behaviour of the resource tracker with regards to the
transitional period between adding support for custom resource classes in
the placement API and integrating inventory and allocation records for

File diff suppressed because it is too large Load Diff