Don't register placement opts mutiple times in a test

The test_local_delete_removes_allocations_after_compute_restart test
was trying to register placement config opts 3 times when only once
is necessary, and if there are CLI opts being registered, only once is
allowed. With change I4cd3d637878eb5bb798b78fd73f5be99e141da9d in
placement, those opts gained some CLI opts, causing this test to
fail.

The depends-on is to a change in the placement-side PlacementFixture
to make it possible to not register opts when calling the fixture,
allowing the safe reuse of the already registered config.

Depends-On: I360a306b5d05ada75274733038b73ec2f2bdc4d4
Change-Id: I042e41ac8c41c0e5f0389904eb548e0e97d54c60
Closes-Bug: #1821092
This commit is contained in:
Chris Dent 2019-03-20 22:23:27 +00:00
parent 59f1f187e5
commit 0dfbcd7464
1 changed files with 4 additions and 2 deletions

View File

@ -71,7 +71,8 @@ class TestLocalDeleteAllocations(test.TestCase,
set_config=True))
# Get allocations, make sure they are 0.
with func_fixtures.PlacementFixture(
conf_fixture=placement_config, db=False) as placement:
conf_fixture=placement_config, db=False,
register_opts=False) as placement:
compute = self.start_service('compute')
placement_api = placement.api
resp = placement_api.get('/resource_providers')
@ -103,7 +104,8 @@ class TestLocalDeleteAllocations(test.TestCase,
self._wait_until_deleted(server)
with func_fixtures.PlacementFixture(
conf_fixture=placement_config, db=False) as placement:
conf_fixture=placement_config, db=False,
register_opts=False) as placement:
placement_api = placement.api
# Assert usages are still non-zero.
usages_during = self._get_usages(placement_api, rp_uuid)