Fix removes date_time items from dictionaries

Some functional tests fail because they assert dictionaries
with date/time items. For example, test_environment_template_create
checks that dictionary env_template exists in env_template_list
dicrionary list. All mentioned dictionaries have date/time items
with keys 'Created' and 'Updated'. If the system, where functional
tests are executed will be quite slow - time in these dictionaries
could differ. This behavior will result corresponding test to fail
even if all tasks will be executed successfully because time in
dictionaries for 'Created' and 'Updated' keys will differ and
assert will fail

Removing the date/time items from dictionaries will help to
successfully pass functional tests

Related-Bug: #1626733

Change-Id: Ibb85992e8b3869ae2b7adf58f8b4f9b134d07139
This commit is contained in:
Ilya Popov 2016-11-13 01:13:13 +03:00
parent 8e0aba70b5
commit 8007de89b1
1 changed files with 12 additions and 0 deletions

View File

@ -167,6 +167,12 @@ class EnvironmentMuranoSanityClientTest(utils.CLIUtilsTestBase):
'TestMuranoSanityEnv')
env_list = self.listing('environment-list')
# Deleting dates from dictionaries to skip it in assert
map(lambda x: x.pop('Updated', None),
env_list + [environment])
map(lambda x: x.pop('Created', None),
env_list + [environment])
self.assertIn(environment, env_list)
def test_environment_delete(self):
@ -198,6 +204,12 @@ class EnvironmentMuranoSanityClientTest(utils.CLIUtilsTestBase):
self.addCleanup(self.delete_murano_object, 'environment', renamed_env)
new_env_list = self.listing('environment-list')
# Deleting dates from dictionaries to skip it in assert
map(lambda x: x.pop('Updated', None),
new_env_list + [environment] + [renamed_env])
map(lambda x: x.pop('Created', None),
new_env_list + [environment] + [renamed_env])
self.assertIn(renamed_env, new_env_list)
self.assertNotIn(environment, new_env_list)