Fix Producer shard range ignoring the last shard
We define the shard range like this in objects > 'shard': fields.IntegerFields(nullable=True, minimum=0, maximum=4095), The problem is that in code we handle it using range(0, 4095), but that range does not include the final shard value of 4095. Closes-bug: #2044278 Change-Id: I71b0b1b237b5d5f12209f431db19cda1b44a1112
This commit is contained in:
parent
21b266b070
commit
54d2d2cf18
@ -64,7 +64,7 @@ class Service(service.RPCService):
|
|||||||
|
|
||||||
self._partitioner = coordination.Partitioner(
|
self._partitioner = coordination.Partitioner(
|
||||||
self.coordination.coordinator, self.service_name,
|
self.coordination.coordinator, self.service_name,
|
||||||
self.coordination.coordination_id.encode(), range(0, 4095)
|
self.coordination.coordination_id.encode(), range(0, 4096)
|
||||||
)
|
)
|
||||||
|
|
||||||
self._partitioner.start()
|
self._partitioner.start()
|
||||||
|
@ -15,13 +15,26 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
|
||||||
|
from designate import objects
|
||||||
from designate.tests import TestCase
|
from designate.tests import TestCase
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class ProducerServiceTest(TestCase):
|
class ProducerServiceTest(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
super().setUp()
|
||||||
|
self.producer_service = self.start_service('producer')
|
||||||
|
|
||||||
def test_stop(self):
|
def test_stop(self):
|
||||||
# Test stopping the service
|
self.producer_service.stop()
|
||||||
service = self.start_service("producer")
|
|
||||||
service.stop()
|
def test_validate_partition_range(self):
|
||||||
|
self.producer_service.start()
|
||||||
|
|
||||||
|
min_partition = objects.Zone.fields['shard'].min
|
||||||
|
max_partition = objects.Zone.fields['shard'].max
|
||||||
|
|
||||||
|
self.assertIn(min_partition, self.producer_service.partition_range)
|
||||||
|
self.assertIn(max_partition, self.producer_service.partition_range)
|
||||||
|
Loading…
Reference in New Issue
Block a user