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
(cherry picked from commit 54d2d2cf18
)
This commit is contained in:
parent
ae4402f9c6
commit
3cce8991b8
@ -79,7 +79,7 @@ class Service(service.RPCService):
|
||||
|
||||
self._partitioner = coordination.Partitioner(
|
||||
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()
|
||||
|
@ -15,13 +15,26 @@
|
||||
# under the License.
|
||||
from oslo_log import log as logging
|
||||
|
||||
from designate import objects
|
||||
from designate.tests import TestCase
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ProducerServiceTest(TestCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.producer_service = self.start_service('producer')
|
||||
|
||||
def test_stop(self):
|
||||
# Test stopping the service
|
||||
service = self.start_service("producer")
|
||||
service.stop()
|
||||
self.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