Skip to content

Commit 6649872

Browse files
Zuulopenstack-gerrit
Zuul
authored andcommitted
Merge "Fix Producer shard range ignoring the last shard" into stable/wallaby
2 parents bee3e26 + 60e0445 commit 6649872

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

designate/producer/service.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def start(self):
7979

8080
self._partitioner = coordination.Partitioner(
8181
self.coordination.coordinator, self.service_name,
82-
self.coordination.coordination_id.encode(), range(0, 4095)
82+
self.coordination.coordination_id.encode(), range(0, 4096)
8383
)
8484

8585
self._partitioner.start()

designate/tests/test_producer/test_service.py

+16-3
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,26 @@
1515
# under the License.
1616
from oslo_log import log as logging
1717

18+
from designate import objects
1819
from designate.tests import TestCase
1920

21+
2022
LOG = logging.getLogger(__name__)
2123

2224

2325
class ProducerServiceTest(TestCase):
26+
def setUp(self):
27+
super().setUp()
28+
self.producer_service = self.start_service('producer')
29+
2430
def test_stop(self):
25-
# Test stopping the service
26-
service = self.start_service("producer")
27-
service.stop()
31+
self.producer_service.stop()
32+
33+
def test_validate_partition_range(self):
34+
self.producer_service.start()
35+
36+
min_partition = objects.Zone.fields['shard'].min
37+
max_partition = objects.Zone.fields['shard'].max
38+
39+
self.assertIn(min_partition, self.producer_service.partition_range)
40+
self.assertIn(max_partition, self.producer_service.partition_range)

0 commit comments

Comments
 (0)