Merge "Byte encoding of member Id" into stable/stein

This commit is contained in:
Zuul 2019-09-02 15:05:36 +00:00 committed by Gerrit Code Review
commit 43e3b39a64
2 changed files with 8 additions and 1 deletions

View File

@ -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:

View File

@ -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)]