Merge "Fix nits from change Id609789ef6b4a4c745550cde80dd49cabe03869a"

This commit is contained in:
Zuul 2018-06-20 20:41:42 +00:00 committed by Gerrit Code Review
commit f194363357
3 changed files with 12 additions and 10 deletions

View File

@ -51,17 +51,17 @@ is determined.
help="""
Early API microversions (<1.8) allowed creating allocations and not specifying
a project or user identifier for the consumer. In cleaning up the data
modeling, we no longer allow missing project and user information. if an older
modeling, we no longer allow missing project and user information. If an older
client makes an allocation, we'll use this in place of the information it
doesn't provide.
"""),
cfg.StrOpt(
cfg.StrOpt(
'incomplete_consumer_user_id',
default=DEFAULT_CONSUMER_MISSING_ID,
help="""
Early API microversions (<1.8) allowed creating allocations and not specifying
a project or user identifier for the consumer. In cleaning up the data
modeling, we no longer allow missing project and user information. if an older
modeling, we no longer allow missing project and user information. If an older
client makes an allocation, we'll use this in place of the information it
doesn't provide.
"""),

View File

@ -107,20 +107,21 @@ class CreateIncompleteConsumersTestCase(test.NoDBTestCase):
@db_api.placement_context_manager.reader
def _check_incomplete_consumers(self, ctx):
incomplete_external_id = CONF.placement.incomplete_consumer_project_id
incomplete_project_id = CONF.placement.incomplete_consumer_project_id
# Verify we have a record in projects for the missing sentinel
sel = PROJECT_TBL.select(
PROJECT_TBL.c.external_id == incomplete_external_id)
PROJECT_TBL.c.external_id == incomplete_project_id)
rec = ctx.session.execute(sel).first()
self.assertEqual(incomplete_external_id, rec['external_id'])
self.assertEqual(incomplete_project_id, rec['external_id'])
incomplete_proj_id = rec['id']
# Verify we have a record in users for the missing sentinel
incomplete_user_id = CONF.placement.incomplete_consumer_user_id
sel = user_obj.USER_TBL.select(
USER_TBL.c.external_id == incomplete_external_id)
USER_TBL.c.external_id == incomplete_user_id)
rec = ctx.session.execute(sel).first()
self.assertEqual(incomplete_external_id, rec['external_id'])
self.assertEqual(incomplete_user_id, rec['external_id'])
incomplete_user_id = rec['id']
# Verify there are records in the consumers table for our old

View File

@ -1,5 +1,6 @@
# Tests of the ensure consumer behaviour for versions of the API from <1.7 to
# 1.8-1.26 and finally 1.27+
# Tests of the ensure consumer behaviour for versions of the API before 1.8;
# starting with 1.8, project_id and user_id are required by the
# PUT: /allocations/{consumer_uuid} API.
fixtures:
- AllocationFixture