Merge "Add public property from storage to flowdetail.meta"

This commit is contained in:
Jenkins 2016-01-20 20:22:50 +00:00 committed by Gerrit Code Review
commit b3f6aa51ca
2 changed files with 8 additions and 1 deletions

View File

@ -423,6 +423,11 @@ class Storage(object):
# This never changes (so no read locking needed). # This never changes (so no read locking needed).
return self._flowdetail.uuid return self._flowdetail.uuid
@property
def flow_meta(self):
"""The flow detail metadata this storage unit is associated with."""
return self._flowdetail.meta
@property @property
def backend(self): def backend(self):
"""The backend this storage unit is associated with.""" """The backend this storage unit is associated with."""

View File

@ -60,11 +60,13 @@ class StorageTestMixin(object):
s.ensure_atom(test_utils.NoopTask('my_task')) s.ensure_atom(test_utils.NoopTask('my_task'))
self.assertTrue(uuidutils.is_uuid_like(s.get_atom_uuid('my_task'))) self.assertTrue(uuidutils.is_uuid_like(s.get_atom_uuid('my_task')))
def test_flow_name_and_uuid(self): def test_flow_name_uuid_and_meta(self):
flow_detail = models.FlowDetail(name='test-fd', uuid='aaaa') flow_detail = models.FlowDetail(name='test-fd', uuid='aaaa')
flow_detail.meta = {'a': 1}
s = self._get_storage(flow_detail) s = self._get_storage(flow_detail)
self.assertEqual('test-fd', s.flow_name) self.assertEqual('test-fd', s.flow_name)
self.assertEqual('aaaa', s.flow_uuid) self.assertEqual('aaaa', s.flow_uuid)
self.assertEqual({'a': 1}, s.flow_meta)
def test_ensure_task(self): def test_ensure_task(self):
s = self._get_storage() s = self._get_storage()