Fix a race in the allocation API tests

We expect the newly created allocation not to change instantly, but
the allocation process is usually pretty fast. Only compare fields
we care about.

Change-Id: Ifb2c9ebb4ab35c350001635dea1c41c8a0e5cfdd
This commit is contained in:
Dmitry Tantsur 2019-03-01 17:04:12 +01:00
parent c34f9b7372
commit bbba29725a
1 changed files with 4 additions and 1 deletions

View File

@ -133,7 +133,10 @@ class TestAllocations(base.BaseBaremetalTest):
_, body = self.client.create_allocation(self.resource_class,
name='banana')
_, loaded_body = self.client.show_allocation('banana')
self._assertExpected(body, loaded_body)
# The allocation will likely have been processed by this time, so do
# not compare the whole body.
for field in ('name', 'uuid', 'resource_class'):
self.assertEqual(body[field], loaded_body[field])
@decorators.idempotent_id('4ca123c4-160d-4d8d-a3f7-15feda812263')
def test_list_allocations(self):