kazoo-ruby 0.5.6 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/kazoo/partition.rb +6 -1
- data/lib/kazoo/version.rb +1 -1
- data/test/partition_test.rb +11 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cddff6bb622ee9d1db1980bda5a00eef2c6f1359
|
4
|
+
data.tar.gz: 5ac18d330d8f2da8136dab9b583e60fb40dda1e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4656dd463c13c37dc92da902e77c7ed275d3a3aa1a9a934c03c54a0cd176ea2a4e0061fad18fc2552ad8296fb374d1dce385e6cced19a80acf2a24035948300
|
7
|
+
data.tar.gz: 4ff31ca4aa664b76fe5af430e2a0a041d6d74f13b14251004c4511bdb945349cc49361c66a22e7d1c74499afa6d31459a5a61f7cf7366ab650a5b9ab7ad99f97
|
data/lib/kazoo/partition.rb
CHANGED
@@ -98,7 +98,12 @@ module Kazoo
|
|
98
98
|
json = JSON.parse(json_payload)
|
99
99
|
raise Kazoo::VersionNotSupported unless json.fetch('version') == 1
|
100
100
|
|
101
|
-
|
101
|
+
begin
|
102
|
+
@leader = cluster.brokers.fetch(json.fetch('leader'))
|
103
|
+
rescue KeyError
|
104
|
+
raise Kazoo::Error, "Topic #{topic.name}:#{id} has unknown leader! Brokers: '#{cluster.brokers.keys.join(',')}'; 'Payload: '#{json_payload.inspect}'"
|
105
|
+
end
|
106
|
+
|
102
107
|
@isr = json.fetch('isr').map do |r|
|
103
108
|
begin
|
104
109
|
cluster.brokers.fetch(r)
|
data/lib/kazoo/version.rb
CHANGED
data/test/partition_test.rb
CHANGED
@@ -55,4 +55,15 @@ class PartitionTest < Minitest::Test
|
|
55
55
|
|
56
56
|
assert_raises(Kazoo::Error) { partition.under_replicated? }
|
57
57
|
end
|
58
|
+
|
59
|
+
def test_raises_unknown_leader
|
60
|
+
partition = @cluster.topics['test.1'].partitions[0]
|
61
|
+
partition.unstub(:leader)
|
62
|
+
partition.unstub(:isr)
|
63
|
+
|
64
|
+
json_payload = '{"controller_epoch":90,"leader":-1,"version":1,"leader_epoch":135,"isr":[2,1,0]}'
|
65
|
+
@cluster.zk.expects(:get).with(path: "/brokers/topics/test.1/partitions/0/state").returns(data: json_payload, rc: 0)
|
66
|
+
|
67
|
+
assert_raises(Kazoo::Error) { partition.under_replicated? }
|
68
|
+
end
|
58
69
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kazoo-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Willem van Bergen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|