Comment 7 for bug 1818560

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to nova (master)

Reviewed: https://review.opendev.org/640887
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=f2d088b04e6e6896f0df04f03e92b32a539b6917
Submitter: Zuul
Branch: master

commit f2d088b04e6e6896f0df04f03e92b32a539b6917
Author: Eric Fried <email address hidden>
Date: Mon Mar 4 16:08:39 2019 -0600

    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:
    https://github.com/openstack/placement/blob/69b9659a457b6d715ed47e6bd6d3b923d548c620/placement/tests/functional/test_direct.py

    Change-Id: Icb889c09a69e7c5cbf9330e5d9917d6ab3ac3dc5
    Related-Bug: #1818560