Merge "Byte encoding of member Id"
This commit is contained in:
commit
f64d58a348
@ -18,6 +18,7 @@ import struct
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
from oslo_utils import encodeutils
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
import tenacity
|
||||
@ -114,7 +115,8 @@ class PartitionCoordinator(object):
|
||||
self.backend_url = self.conf.coordination.backend_url
|
||||
self._coordinator = None
|
||||
self._groups = set()
|
||||
self._my_id = my_id or uuidutils.generate_uuid()
|
||||
self._my_id = my_id or \
|
||||
encodeutils.safe_encode(uuidutils.generate_uuid())
|
||||
|
||||
def start(self):
|
||||
if self.backend_url:
|
||||
|
@ -193,6 +193,11 @@ class TestPartitioning(base.BaseTestCase):
|
||||
self.assertEqual(['group1', 'group2'],
|
||||
sorted(self.shared_storage.keys()))
|
||||
|
||||
def test_member_id(self):
|
||||
agent = 'agent'.encode('ascii')
|
||||
coord = self._get_new_started_coordinator({}, agent)
|
||||
self.assertEqual(agent, coord._my_id)
|
||||
|
||||
def test_partitioning(self):
|
||||
all_resources = ['resource_%s' % i for i in range(1000)]
|
||||
agents = ['agent_%s' % i for i in range(10)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user