test: fix race condition in update testing

The archive policy used to test the update mechanism was the "low" one,
which is used by a lot of different test in parallel. So modifying it
might make these tests fail. Create a temporary archive policy for this
test.

Change-Id: I28bb882855a04526faab1710519f613c5f194de3
This commit is contained in:
Julien Danjou 2016-07-28 14:48:44 +02:00
parent 24bb8f9c8e
commit 9170d7b2c1
1 changed files with 17 additions and 14 deletions

View File

@ -69,13 +69,16 @@ class TestIndexerDriver(tests_base.TestCase):
points=12),
archive_policy.ArchivePolicyItem(granularity=5,
points=6)])
apname = str(uuid.uuid4())
self.index.create_archive_policy(archive_policy.ArchivePolicy(
apname, 0, [(12, 300), (24, 3600), (30, 86400)]))
ap = self.index.update_archive_policy(
"low", [archive_policy.ArchivePolicyItem(granularity=300,
points=6),
archive_policy.ArchivePolicyItem(granularity=3600,
points=24),
archive_policy.ArchivePolicyItem(granularity=86400,
points=30)])
apname, [archive_policy.ArchivePolicyItem(granularity=300,
points=6),
archive_policy.ArchivePolicyItem(granularity=3600,
points=24),
archive_policy.ArchivePolicyItem(granularity=86400,
points=30)])
self.assertEqual({
'back_window': 0,
'aggregation_methods':
@ -84,14 +87,14 @@ class TestIndexerDriver(tests_base.TestCase):
{u'granularity': 300, u'points': 6, u'timespan': 1800},
{u'granularity': 3600, u'points': 24, u'timespan': 86400},
{u'granularity': 86400, u'points': 30, u'timespan': 2592000}],
'name': u'low'}, dict(ap))
'name': apname}, dict(ap))
ap = self.index.update_archive_policy(
"low", [archive_policy.ArchivePolicyItem(granularity=300,
points=12),
archive_policy.ArchivePolicyItem(granularity=3600,
points=24),
archive_policy.ArchivePolicyItem(granularity=86400,
points=30)])
apname, [archive_policy.ArchivePolicyItem(granularity=300,
points=12),
archive_policy.ArchivePolicyItem(granularity=3600,
points=24),
archive_policy.ArchivePolicyItem(granularity=86400,
points=30)])
self.assertEqual({
'back_window': 0,
'aggregation_methods':
@ -100,7 +103,7 @@ class TestIndexerDriver(tests_base.TestCase):
{u'granularity': 300, u'points': 12, u'timespan': 3600},
{u'granularity': 3600, u'points': 24, u'timespan': 86400},
{u'granularity': 86400, u'points': 30, u'timespan': 2592000}],
'name': u'low'}, dict(ap))
'name': apname}, dict(ap))
def test_delete_archive_policy(self):
name = str(uuid.uuid4())