synapse 0.13.7 → 0.13.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZDAyZjEyZDU5ZGUwMmMwOTFkNjgyMmUwMmU2NGRlYTBmMWQ5MmE3YQ==
5
+ data.tar.gz: !binary |-
6
+ YzNjYjQ2NWJkNDAyYzllZmE0ZGJjNWFmZmQ5YTdmMWU2NjlhYjQ4Mg==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NGE5ZjEwYmM0MmE2MjgyYjY5YTQzN2Q3YjY0YzliMjFjNmYwNWUwMDAyN2M5
10
+ ZTg2MmQ0ZWNlNTM2OTQyZjk4MWMzN2EzMGNiNjM1ZGE4MjE2OGQ3OTRiZjMx
11
+ M2U2NmNmZDkyODQxMDI4NjYwNmI3NmYzY2M2ZGM1NzFhMmVkZTQ=
12
+ data.tar.gz: !binary |-
13
+ MzAxZGIyYTRiNDdlYjYwYzY1NzM0ZDlhMTllNmNkYjdiYzQzODFlOGFmYmJi
14
+ NTQ1MmIzOTI3Y2IxZmQyZTYwYzNiMDRiMTM3ZGZmOTc1OTAzMmQyZWEzYTY5
15
+ MmE1NDQ3NDUxZGI3MGE3NGVhZDdiODE1NzA2NTk5ZjFlNmI0NGY=
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- synapse (0.13.7)
4
+ synapse (0.13.8)
5
5
  aws-sdk (~> 1.39)
6
6
  docker-api (~> 1.7)
7
7
  logging (~> 1.8)
@@ -36,6 +36,7 @@ GEM
36
36
  hashdiff (0.2.3)
37
37
  i18n (0.7.0)
38
38
  json (1.8.3)
39
+ json (1.8.3-java)
39
40
  little-plugger (1.1.3)
40
41
  logging (1.8.2)
41
42
  little-plugger (>= 1.1.3)
@@ -46,6 +47,7 @@ GEM
46
47
  multi_json (1.11.2)
47
48
  nokogiri (1.6.7.2)
48
49
  mini_portile2 (~> 2.0.0.rc2)
50
+ nokogiri (1.6.7.2-java)
49
51
  pry (0.10.3)
50
52
  coderay (~> 1.1.0)
51
53
  method_source (~> 0.8.1)
@@ -72,9 +74,12 @@ GEM
72
74
  rspec-support (3.1.2)
73
75
  safe_yaml (1.0.4)
74
76
  slop (3.6.0)
77
+ slyphon-log4j (1.2.15)
78
+ slyphon-zookeeper_jar (3.3.5-java)
75
79
  spoon (0.0.4)
76
80
  ffi
77
81
  thread_safe (0.3.5)
82
+ thread_safe (0.3.5-java)
78
83
  timecop (0.8.1)
79
84
  tzinfo (1.2.2)
80
85
  thread_safe (~> 0.1)
@@ -85,6 +90,9 @@ GEM
85
90
  zk (1.9.6)
86
91
  zookeeper (~> 1.4.0)
87
92
  zookeeper (1.4.11)
93
+ zookeeper (1.4.11-java)
94
+ slyphon-log4j (= 1.2.15)
95
+ slyphon-zookeeper_jar (= 3.3.5)
88
96
 
89
97
  PLATFORMS
90
98
  java
@@ -127,7 +127,15 @@ class Synapse::ServiceWatcher
127
127
 
128
128
  new_backends = []
129
129
  @zk.children(@discovery['path'], :watch => true).each do |id|
130
- node = @zk.get("#{@discovery['path']}/#{id}")
130
+ begin
131
+ node = @zk.get("#{@discovery['path']}/#{id}")
132
+ rescue ZK::Exceptions::NoNode => e
133
+ # This can happen when the registry unregisters a service node between
134
+ # the call to @zk.children and @zk.get(path). ZK does not guarantee
135
+ # a read to ``get`` of a child returned by ``children`` will succeed
136
+ log.error("synapse: #{@discovery['path']}/#{id} disappeared before it could be read: #{e}")
137
+ next
138
+ end
131
139
 
132
140
  begin
133
141
  # TODO: Do less munging, or refactor out this processing
@@ -1,3 +1,3 @@
1
1
  module Synapse
2
- VERSION = "0.13.7"
2
+ VERSION = "0.13.8"
3
3
  end
@@ -29,11 +29,42 @@ describe Synapse::ServiceWatcher::ZookeeperWatcher do
29
29
  }
30
30
 
31
31
  context 'ZookeeperWatcher' do
32
- let(:discovery) { { 'method' => 'zookeeper', 'hosts' => 'somehost','path' => 'some/path' } }
32
+ let(:discovery) { { 'method' => 'zookeeper', 'hosts' => 'somehost', 'path' => 'some/path' } }
33
+ let(:mock_zk) { double(ZK) }
34
+ let(:mock_node) do
35
+ node_double = double()
36
+ allow(node_double).to receive(:first).and_return(service_data_string)
37
+ node_double
38
+ end
39
+
33
40
  subject { Synapse::ServiceWatcher::ZookeeperWatcher.new(config, mock_synapse) }
34
41
  it 'decodes data correctly' do
35
42
  expect(subject.send(:deserialize_service_instance, service_data_string)).to eql(deserialized_service_data)
36
43
  end
44
+
45
+ it 'reacts to zk push events' do
46
+ expect(subject).to receive(:watch)
47
+ expect(subject).to receive(:discover).and_call_original
48
+ expect(mock_zk).to receive(:children).with('some/path', {:watch=>true}).and_return(
49
+ ["test_child_1"]
50
+ )
51
+ expect(mock_zk).to receive(:get).with('some/path/test_child_1').and_return(mock_node)
52
+ subject.instance_variable_set('@zk', mock_zk)
53
+ expect(subject).to receive(:set_backends).with([service_data.merge({'id' => 1})])
54
+ subject.send(:watcher_callback).call
55
+ end
56
+
57
+ it 'handles zk consistency issues' do
58
+ expect(subject).to receive(:watch)
59
+ expect(subject).to receive(:discover).and_call_original
60
+ expect(mock_zk).to receive(:children).with('some/path', {:watch=>true}).and_return(
61
+ ["test_child_1"]
62
+ )
63
+ expect(mock_zk).to receive(:get).with('some/path/test_child_1').and_raise(ZK::Exceptions::NoNode)
64
+ subject.instance_variable_set('@zk', mock_zk)
65
+ expect(subject).to receive(:set_backends).with([])
66
+ subject.send(:watcher_callback).call
67
+ end
37
68
  end
38
69
 
39
70
  context 'ZookeeperDnsWatcher' do
data/synapse.gemspec CHANGED
@@ -6,11 +6,16 @@ require 'synapse/version'
6
6
  Gem::Specification.new do |gem|
7
7
  gem.name = "synapse"
8
8
  gem.version = Synapse::VERSION
9
- gem.authors = ["Martin Rhoads"]
10
- gem.email = ["martin.rhoads@airbnb.com"]
11
- gem.description = %q{: Write a gem description}
12
- gem.summary = %q{: Write a gem summary}
13
- gem.homepage = ""
9
+ gem.authors = ["Martin Rhoads", "Igor Serebryany", "Joseph Lynch"]
10
+ gem.email = ["martin.rhoads@airbnb.com", "igor.serebryany@airbnb.com", "jlynch@yelp.com"]
11
+ gem.description = "Synapse is a daemon used to dynamically configure and "\
12
+ "manage local instances of HAProxy as well as local files "\
13
+ "in reaction to changes in a service registry such as "\
14
+ "zookeeper. Synapse is half of SmartStack, and is designed "\
15
+ "to be operated along with Nerve or another system that "\
16
+ "registers services such as Aurora."
17
+ gem.summary = %q{Dynamic HAProxy configuration daemon}
18
+ gem.homepage = "https://github.com/airbnb/synapse"
14
19
 
15
20
  gem.files = `git ls-files`.split($/)
16
21
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
metadata CHANGED
@@ -1,20 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: synapse
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.7
5
- prerelease:
4
+ version: 0.13.8
6
5
  platform: ruby
7
6
  authors:
8
7
  - Martin Rhoads
8
+ - Igor Serebryany
9
+ - Joseph Lynch
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2016-07-18 00:00:00.000000000 Z
13
+ date: 2016-09-01 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: aws-sdk
16
17
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
@@ -22,7 +22,6 @@ dependencies:
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
25
  requirements:
27
26
  - - ~>
28
27
  - !ruby/object:Gem::Version
@@ -30,7 +29,6 @@ dependencies:
30
29
  - !ruby/object:Gem::Dependency
31
30
  name: docker-api
32
31
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
32
  requirements:
35
33
  - - ~>
36
34
  - !ruby/object:Gem::Version
@@ -38,7 +36,6 @@ dependencies:
38
36
  type: :runtime
39
37
  prerelease: false
40
38
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
39
  requirements:
43
40
  - - ~>
44
41
  - !ruby/object:Gem::Version
@@ -46,7 +43,6 @@ dependencies:
46
43
  - !ruby/object:Gem::Dependency
47
44
  name: zk
48
45
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
46
  requirements:
51
47
  - - ~>
52
48
  - !ruby/object:Gem::Version
@@ -54,7 +50,6 @@ dependencies:
54
50
  type: :runtime
55
51
  prerelease: false
56
52
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
53
  requirements:
59
54
  - - ~>
60
55
  - !ruby/object:Gem::Version
@@ -62,7 +57,6 @@ dependencies:
62
57
  - !ruby/object:Gem::Dependency
63
58
  name: logging
64
59
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
60
  requirements:
67
61
  - - ~>
68
62
  - !ruby/object:Gem::Version
@@ -70,7 +64,6 @@ dependencies:
70
64
  type: :runtime
71
65
  prerelease: false
72
66
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
67
  requirements:
75
68
  - - ~>
76
69
  - !ruby/object:Gem::Version
@@ -78,7 +71,6 @@ dependencies:
78
71
  - !ruby/object:Gem::Dependency
79
72
  name: rake
80
73
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
74
  requirements:
83
75
  - - ! '>='
84
76
  - !ruby/object:Gem::Version
@@ -86,7 +78,6 @@ dependencies:
86
78
  type: :development
87
79
  prerelease: false
88
80
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
81
  requirements:
91
82
  - - ! '>='
92
83
  - !ruby/object:Gem::Version
@@ -94,7 +85,6 @@ dependencies:
94
85
  - !ruby/object:Gem::Dependency
95
86
  name: rspec
96
87
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
88
  requirements:
99
89
  - - ~>
100
90
  - !ruby/object:Gem::Version
@@ -102,7 +92,6 @@ dependencies:
102
92
  type: :development
103
93
  prerelease: false
104
94
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
95
  requirements:
107
96
  - - ~>
108
97
  - !ruby/object:Gem::Version
@@ -110,7 +99,6 @@ dependencies:
110
99
  - !ruby/object:Gem::Dependency
111
100
  name: factory_girl
112
101
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
102
  requirements:
115
103
  - - ! '>='
116
104
  - !ruby/object:Gem::Version
@@ -118,7 +106,6 @@ dependencies:
118
106
  type: :development
119
107
  prerelease: false
120
108
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
109
  requirements:
123
110
  - - ! '>='
124
111
  - !ruby/object:Gem::Version
@@ -126,7 +113,6 @@ dependencies:
126
113
  - !ruby/object:Gem::Dependency
127
114
  name: pry
128
115
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
116
  requirements:
131
117
  - - ! '>='
132
118
  - !ruby/object:Gem::Version
@@ -134,7 +120,6 @@ dependencies:
134
120
  type: :development
135
121
  prerelease: false
136
122
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
123
  requirements:
139
124
  - - ! '>='
140
125
  - !ruby/object:Gem::Version
@@ -142,7 +127,6 @@ dependencies:
142
127
  - !ruby/object:Gem::Dependency
143
128
  name: pry-nav
144
129
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
130
  requirements:
147
131
  - - ! '>='
148
132
  - !ruby/object:Gem::Version
@@ -150,7 +134,6 @@ dependencies:
150
134
  type: :development
151
135
  prerelease: false
152
136
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
137
  requirements:
155
138
  - - ! '>='
156
139
  - !ruby/object:Gem::Version
@@ -158,7 +141,6 @@ dependencies:
158
141
  - !ruby/object:Gem::Dependency
159
142
  name: webmock
160
143
  requirement: !ruby/object:Gem::Requirement
161
- none: false
162
144
  requirements:
163
145
  - - ! '>='
164
146
  - !ruby/object:Gem::Version
@@ -166,7 +148,6 @@ dependencies:
166
148
  type: :development
167
149
  prerelease: false
168
150
  version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
151
  requirements:
171
152
  - - ! '>='
172
153
  - !ruby/object:Gem::Version
@@ -174,7 +155,6 @@ dependencies:
174
155
  - !ruby/object:Gem::Dependency
175
156
  name: timecop
176
157
  requirement: !ruby/object:Gem::Requirement
177
- none: false
178
158
  requirements:
179
159
  - - ! '>='
180
160
  - !ruby/object:Gem::Version
@@ -182,14 +162,18 @@ dependencies:
182
162
  type: :development
183
163
  prerelease: false
184
164
  version_requirements: !ruby/object:Gem::Requirement
185
- none: false
186
165
  requirements:
187
166
  - - ! '>='
188
167
  - !ruby/object:Gem::Version
189
168
  version: '0'
190
- description: ': Write a gem description'
169
+ description: Synapse is a daemon used to dynamically configure and manage local instances
170
+ of HAProxy as well as local files in reaction to changes in a service registry such
171
+ as zookeeper. Synapse is half of SmartStack, and is designed to be operated along
172
+ with Nerve or another system that registers services such as Aurora.
191
173
  email:
192
174
  - martin.rhoads@airbnb.com
175
+ - igor.serebryany@airbnb.com
176
+ - jlynch@yelp.com
193
177
  executables:
194
178
  - synapse
195
179
  extensions: []
@@ -239,30 +223,29 @@ files:
239
223
  - spec/support/configuration.rb
240
224
  - spec/support/minimum.conf.yaml
241
225
  - synapse.gemspec
242
- homepage: ''
226
+ homepage: https://github.com/airbnb/synapse
243
227
  licenses: []
228
+ metadata: {}
244
229
  post_install_message:
245
230
  rdoc_options: []
246
231
  require_paths:
247
232
  - lib
248
233
  required_ruby_version: !ruby/object:Gem::Requirement
249
- none: false
250
234
  requirements:
251
235
  - - ! '>='
252
236
  - !ruby/object:Gem::Version
253
237
  version: '0'
254
238
  required_rubygems_version: !ruby/object:Gem::Requirement
255
- none: false
256
239
  requirements:
257
240
  - - ! '>='
258
241
  - !ruby/object:Gem::Version
259
242
  version: '0'
260
243
  requirements: []
261
244
  rubyforge_project:
262
- rubygems_version: 1.8.23.2
245
+ rubygems_version: 2.5.1
263
246
  signing_key:
264
- specification_version: 3
265
- summary: ': Write a gem summary'
247
+ specification_version: 4
248
+ summary: Dynamic HAProxy configuration daemon
266
249
  test_files:
267
250
  - spec/factories/backend.rb
268
251
  - spec/lib/synapse/file_output_spec.rb