routemaster-drain 3.0.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  engines:
3
3
  bundler-audit:
4
- enabled: true
4
+ enabled: false
5
5
  duplication:
6
6
  enabled: true
7
7
  config:
@@ -13,7 +13,6 @@ engines:
13
13
  enabled: true
14
14
  ratings:
15
15
  paths:
16
- - Gemfile.lock
17
16
  - "**.rb"
18
17
  exclude_paths:
19
18
  - spec/
data/.gitignore CHANGED
@@ -9,3 +9,5 @@ tags
9
9
  *.swo
10
10
  coverage/
11
11
  .byebug_history
12
+ /Gemfile.lock
13
+ /gemfiles/*.lock
@@ -1 +1 @@
1
- 2.4.0
1
+ 2.4.1
@@ -1,3 +1,9 @@
1
+ ### 3.0.3 (2017-09-21)
2
+
3
+ Bug fixes:
4
+
5
+ - Fixes a regression introduced in 3.0.1 where the APIClient auth data would not be populated under some conditions. (#65)
6
+
1
7
  ### 3.0.2 (2017-09-05)
2
8
 
3
9
  Bug fixes:
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # routemaster-drain [![Version](https://badge.fury.io/rb/routemaster-drain.svg)](https://rubygems.org/gems/routemaster-drain) [![Build](https://travis-ci.org/deliveroo/routemaster-drain.svg?branch=master)](https://travis-ci.org/deliveroo/routemaster-drain) [![Code Climate](https://codeclimate.com/github/deliveroo/routemaster-drain/badges/gpa.svg)](https://codeclimate.com/github/deliveroo/routemaster-drain) [![codecov](https://codecov.io/gh/deliveroo/routemaster-drain/branch/master/graph/badge.svg)](https://codecov.io/gh/deliveroo/routemaster-drain) [![Docs](http://img.shields.io/badge/API%20docs-rubydoc.info-blue.svg)](http://rubydoc.info/github/deliveroo/routemaster-drain)
1
+ # routemaster-drain [![Version](https://badge.fury.io/rb/routemaster-drain.svg)](https://rubygems.org/gems/routemaster-drain) [![Build](https://circleci.com/gh/deliveroo/routemaster-drain.svg?style=shield&circle-token=7c256c63e5683bc25f0b4c3db0170446c91d36c8)](https://circleci.com/gh/deliveroo/routemaster-drain) [![Code Climate](https://codeclimate.com/github/deliveroo/routemaster-drain/badges/gpa.svg)](https://codeclimate.com/github/deliveroo/routemaster-drain) [![codecov](https://codecov.io/gh/deliveroo/routemaster-drain/branch/master/graph/badge.svg)](https://codecov.io/gh/deliveroo/routemaster-drain) [![Docs](http://img.shields.io/badge/API%20docs-rubydoc.info-blue.svg)](http://rubydoc.info/github/deliveroo/routemaster-drain)
2
2
 
3
3
  A Rack-based event receiver for the
4
4
  [Routemaster](https://github.com/deliveroo/routemaster) event bus.
@@ -54,7 +54,7 @@ module Routemaster
54
54
  end
55
55
 
56
56
  def cache_auth
57
- @cache_auth ||= Hashie::Rash.new.tap do |result|
57
+ Hashie::Rash.new.tap do |result|
58
58
  ENV.fetch('ROUTEMASTER_CACHE_AUTH', '').split(',').each do |entry|
59
59
  host, username, password = entry.split(':')
60
60
  result[Regexp.new(host)] = [username, password]
@@ -1,5 +1,5 @@
1
1
  module Routemaster
2
2
  module Drain
3
- VERSION = '3.0.2'.freeze
3
+ VERSION = '3.0.3'.freeze
4
4
  end
5
5
  end
@@ -0,0 +1,17 @@
1
+ require 'core_ext/forwardable'
2
+
3
+ describe Forwardable do
4
+ class Foo
5
+ extend Forwardable
6
+
7
+ def initialize
8
+ @bar = :bar
9
+ end
10
+
11
+ def_delegator :@bar, :to_s, :qux
12
+ end
13
+
14
+ it 'expect delegation to work' do
15
+ expect(Foo.new.qux).to eq 'bar'
16
+ end
17
+ end
@@ -18,7 +18,7 @@ describe Routemaster::APIClient do
18
18
  uses_redis
19
19
  uses_webmock
20
20
 
21
- let(:port) { 8000 }
21
+ let(:port) { 8080 }
22
22
  let(:service) do
23
23
  TestServer.new(port) do |server|
24
24
  [400, 401, 403, 404, 409, 412, 413, 429, 500].each do |status_code|
@@ -42,7 +42,7 @@ describe Routemaster::APIClient do
42
42
  server.mount_proc "/discover" do |req, res|
43
43
  res['Content-Type'] = 'application/json'
44
44
  res.status = 200
45
- res.body = { _links: { resources: { href: "http://localhost:#{port}/resources" } } }.to_json
45
+ res.body = { _links: { resources: { href: "http://127.0.0.1:#{port}/resources" } } }.to_json
46
46
  end
47
47
 
48
48
  server.mount_proc "/resources" do |req, res|
@@ -53,20 +53,20 @@ describe Routemaster::APIClient do
53
53
  res.body = {
54
54
  _links: {
55
55
  self: {
56
- href: "http://localhost:#{port}/resourcess?first_name=roo&page=1&per_page=2"
56
+ href: "http://127.0.0.1:#{port}/resourcess?first_name=roo&page=1&per_page=2"
57
57
  },
58
58
  first: {
59
- href: "http://localhost:#{port}/resources?first_name=roo&page=1&per_page=2"
59
+ href: "http://127.0.0.1:#{port}/resources?first_name=roo&page=1&per_page=2"
60
60
  },
61
61
  last: {
62
- href: "http://localhost:#{port}/resources?first_name=roo&page=3&per_page=2"
62
+ href: "http://127.0.0.1:#{port}/resources?first_name=roo&page=3&per_page=2"
63
63
  },
64
64
  next: {
65
- href: "http://localhost:#{port}/resources?first_name=roo&page=2&per_page=2"
65
+ href: "http://127.0.0.1:#{port}/resources?first_name=roo&page=2&per_page=2"
66
66
  },
67
67
  resources: [
68
- { href: "http://localhost:#{port}/resources/1" },
69
- { href: "http://localhost:#{port}/resources/1" }
68
+ { href: "http://127.0.0.1:#{port}/resources/1" },
69
+ { href: "http://127.0.0.1:#{port}/resources/1" }
70
70
  ]
71
71
  }
72
72
  }.to_json
@@ -74,20 +74,20 @@ describe Routemaster::APIClient do
74
74
  res.body = {
75
75
  _links: {
76
76
  self: {
77
- href: "http://localhost:#{port}/resourcess?first_name=roo&page=2&per_page=2"
77
+ href: "http://127.0.0.1:#{port}/resourcess?first_name=roo&page=2&per_page=2"
78
78
  },
79
79
  first: {
80
- href: "http://localhost:#{port}/resources?first_name=roo&page=1&per_page=2"
80
+ href: "http://127.0.0.1:#{port}/resources?first_name=roo&page=1&per_page=2"
81
81
  },
82
82
  last: {
83
- href: "http://localhost:#{port}/resources?first_name=roo&page=3&per_page=2"
83
+ href: "http://127.0.0.1:#{port}/resources?first_name=roo&page=3&per_page=2"
84
84
  },
85
85
  next: {
86
- href: "http://localhost:#{port}/resources?first_name=roo&page=3&per_page=2"
86
+ href: "http://127.0.0.1:#{port}/resources?first_name=roo&page=3&per_page=2"
87
87
  },
88
88
  resources: [
89
- { href: "http://localhost:#{port}/resources/1" },
90
- { href: "http://localhost:#{port}/resources/1" }
89
+ { href: "http://127.0.0.1:#{port}/resources/1" },
90
+ { href: "http://127.0.0.1:#{port}/resources/1" }
91
91
  ]
92
92
  }
93
93
  }.to_json
@@ -95,16 +95,16 @@ describe Routemaster::APIClient do
95
95
  res.body = {
96
96
  _links: {
97
97
  self: {
98
- href: "http://localhost:#{port}/resourcess?first_name=roo&page=3&per_page=2"
98
+ href: "http://127.0.0.1:#{port}/resourcess?first_name=roo&page=3&per_page=2"
99
99
  },
100
100
  first: {
101
- href: "http://localhost:#{port}/resources?first_name=roo&page=1&per_page=2"
101
+ href: "http://127.0.0.1:#{port}/resources?first_name=roo&page=1&per_page=2"
102
102
  },
103
103
  last: {
104
- href: "http://localhost:#{port}/resources?first_name=roo&page=3&per_page=2"
104
+ href: "http://127.0.0.1:#{port}/resources?first_name=roo&page=3&per_page=2"
105
105
  },
106
106
  resources: [
107
- { href: "http://localhost:#{port}/resources/1" }
107
+ { href: "http://127.0.0.1:#{port}/resources/1" }
108
108
  ]
109
109
  }
110
110
  }.to_json
@@ -118,7 +118,7 @@ describe Routemaster::APIClient do
118
118
 
119
119
  before { WebMock.disable_net_connect!(allow_localhost: true) }
120
120
 
121
- let(:host) { "http://localhost:#{port}" }
121
+ let(:host) { "http://127.0.0.1:#{port}" }
122
122
 
123
123
  describe 'error handling' do
124
124
 
@@ -290,7 +290,7 @@ describe Routemaster::APIClient do
290
290
  end
291
291
 
292
292
  describe 'INDEX request' do
293
- let(:url) { "http://localhost:#{port}/discover" }
293
+ let(:url) { "http://127.0.0.1:#{port}/discover" }
294
294
 
295
295
  subject do
296
296
  Routemaster::APIClient.new(response_class: Routemaster::Responses::HateoasResponse)
@@ -305,13 +305,13 @@ describe Routemaster::APIClient do
305
305
  it 'does not make any http requests to fetch individual resources if just the index method is called' do
306
306
  res = subject.discover(url)
307
307
 
308
- expect(subject).not_to receive(:get).with("http://localhost:#{port}/resources/#{anything}", anything)
308
+ expect(subject).not_to receive(:get).with("http://127.0.0.1:#{port}/resources/#{anything}", anything)
309
309
  res.resources.index
310
310
  end
311
311
  end
312
312
 
313
313
  describe 'DISCOVER request' do
314
- let(:url) { "http://localhost:#{port}/discover" }
314
+ let(:url) { "http://127.0.0.1:#{port}/discover" }
315
315
 
316
316
  subject do
317
317
  Routemaster::APIClient.new(response_class: Routemaster::Responses::HateoasResponse)
@@ -365,21 +365,21 @@ describe Routemaster::APIClient do
365
365
  it 'sends request metrics' do
366
366
  subject.get(url)
367
367
  expect(metrics_client).to have_received(:increment).with(
368
- 'api_client.request.count', tags: %w[source:test_service destination:localhost verb:get]
368
+ 'api_client.request.count', tags: %w[source:test_service destination:127.0.0.1 verb:get]
369
369
  )
370
370
  end
371
371
 
372
372
  it 'sends response metrics' do
373
373
  subject.get(url)
374
374
  expect(metrics_client).to have_received(:increment).with(
375
- 'api_client.response.count', tags: %w[source:test_service destination:localhost status:200]
375
+ 'api_client.response.count', tags: %w[source:test_service destination:127.0.0.1 status:200]
376
376
  )
377
377
  end
378
378
 
379
379
  it 'sends timing metrics' do
380
380
  subject.get(url)
381
381
  expect(metrics_client).to have_received(:time).with(
382
- 'api_client.latency', tags: %w[source:test_service destination:localhost verb:get]
382
+ 'api_client.latency', tags: %w[source:test_service destination:127.0.0.1 verb:get]
383
383
  )
384
384
  end
385
385
  end
@@ -35,8 +35,9 @@ class TestServer
35
35
  Timeout.timeout(5) do
36
36
  loop do
37
37
  begin
38
- TCPSocket.new('localhost', '8000')
38
+ TCPSocket.new('127.0.0.1', @port)
39
39
  rescue Errno::ECONNREFUSED
40
+ sleep 0.1
40
41
  next
41
42
  end
42
43
  break
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: routemaster-drain
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julien Letessier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-05 00:00:00.000000000 Z
11
+ date: 2017-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -143,6 +143,8 @@ executables: []
143
143
  extensions: []
144
144
  extra_rdoc_files: []
145
145
  files:
146
+ - ".circleci/config.yml"
147
+ - ".circleci/config.yml.erb"
146
148
  - ".codeclimate.yml"
147
149
  - ".codecov.yml"
148
150
  - ".env.test"
@@ -151,23 +153,18 @@ files:
151
153
  - ".rspec"
152
154
  - ".rubocop.yml"
153
155
  - ".ruby-version"
154
- - ".travis.yml"
155
156
  - ".yardopts"
156
157
  - Appraisals
157
158
  - CHANGELOG.md
158
159
  - Gemfile
159
- - Gemfile.lock
160
160
  - Guardfile
161
161
  - LICENSE.txt
162
162
  - README.md
163
163
  - Rakefile
164
164
  - appraise
165
165
  - gemfiles/rails_3.gemfile
166
- - gemfiles/rails_3.gemfile.lock
167
166
  - gemfiles/rails_4.gemfile
168
- - gemfiles/rails_4.gemfile.lock
169
167
  - gemfiles/rails_5.gemfile
170
- - gemfiles/rails_5.gemfile.lock
171
168
  - lib/core_ext/forwardable.rb
172
169
  - lib/routemaster/api_client.rb
173
170
  - lib/routemaster/cache.rb
@@ -211,6 +208,7 @@ files:
211
208
  - lib/routemaster/responses/response_promise.rb
212
209
  - lib/routemaster/tasks/fix_cache_ttl.rb
213
210
  - routemaster-drain.gemspec
211
+ - spec/core_ext/forwardable_spec.rb
214
212
  - spec/routemaster/api_client_spec.rb
215
213
  - spec/routemaster/cache_spec.rb
216
214
  - spec/routemaster/config_spec.rb
@@ -272,11 +270,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
272
270
  version: '0'
273
271
  requirements: []
274
272
  rubyforge_project:
275
- rubygems_version: 2.6.11
273
+ rubygems_version: 2.6.13
276
274
  signing_key:
277
275
  specification_version: 4
278
276
  summary: Event receiver for the Routemaster bus
279
277
  test_files:
278
+ - spec/core_ext/forwardable_spec.rb
280
279
  - spec/routemaster/api_client_spec.rb
281
280
  - spec/routemaster/cache_spec.rb
282
281
  - spec/routemaster/config_spec.rb
@@ -318,3 +317,4 @@ test_files:
318
317
  - spec/support/uses_dotenv.rb
319
318
  - spec/support/uses_redis.rb
320
319
  - spec/support/uses_webmock.rb
320
+ has_rdoc:
@@ -1,20 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
- services:
4
- - redis-server
5
- rvm:
6
- - 2.2.6
7
- - 2.3.3
8
- - 2.4.0
9
- - ruby-head
10
- gemfile:
11
- - gemfiles/rails_3.gemfile
12
- - gemfiles/rails_4.gemfile
13
- - gemfiles/rails_5.gemfile
14
- script:
15
- - bundle exec rspec
16
- matrix:
17
- allow_failures:
18
- - rvm: ruby-head
19
- - rvm: 2.4.0
20
- gemfile: gemfiles/rails_3.gemfile
@@ -1,171 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- routemaster-drain (3.0.2)
5
- addressable
6
- concurrent-ruby
7
- faraday (>= 0.9.0)
8
- faraday_middleware
9
- hashie
10
- rack (>= 1.4.5)
11
- redis-namespace
12
- typhoeus (~> 1.1)
13
- wisper (~> 1.6.1)
14
-
15
- GEM
16
- remote: https://rubygems.org/
17
- specs:
18
- addressable (2.5.0)
19
- public_suffix (~> 2.0, >= 2.0.2)
20
- appraisal (2.1.0)
21
- bundler
22
- rake
23
- thor (>= 0.14.0)
24
- byebug (9.0.6)
25
- codecov (0.1.9)
26
- json
27
- simplecov
28
- url
29
- coderay (1.1.1)
30
- concurrent-ruby (1.0.5)
31
- connection_pool (2.2.1)
32
- crack (0.4.3)
33
- safe_yaml (~> 1.0.0)
34
- diff-lcs (1.2.5)
35
- docile (1.1.5)
36
- dogstatsd (2.0.0)
37
- dotenv (2.1.1)
38
- ethon (0.10.1)
39
- ffi (>= 1.3.0)
40
- faraday (0.12.2)
41
- multipart-post (>= 1.2, < 3)
42
- faraday_middleware (0.12.2)
43
- faraday (>= 0.7.4, < 1.0)
44
- ffi (1.9.17)
45
- fork (1.0.1)
46
- fork_break (0.1.4)
47
- fork (= 1.0.1)
48
- formatador (0.2.5)
49
- guard (2.14.0)
50
- formatador (>= 0.2.4)
51
- listen (>= 2.7, < 4.0)
52
- lumberjack (~> 1.0)
53
- nenv (~> 0.1)
54
- notiffany (~> 0.0)
55
- pry (>= 0.9.12)
56
- shellany (~> 0.0)
57
- thor (>= 0.18.1)
58
- guard-compat (1.2.1)
59
- guard-rspec (4.7.3)
60
- guard (~> 2.1)
61
- guard-compat (~> 1.1)
62
- rspec (>= 2.99.0, < 4.0)
63
- hashdiff (0.3.2)
64
- hashie (3.5.6)
65
- json (2.0.3)
66
- listen (3.1.5)
67
- rb-fsevent (~> 0.9, >= 0.9.4)
68
- rb-inotify (~> 0.9, >= 0.9.7)
69
- ruby_dep (~> 1.2)
70
- lumberjack (1.0.10)
71
- method_source (0.8.2)
72
- mono_logger (1.1.0)
73
- multi_json (1.12.1)
74
- multipart-post (2.0.0)
75
- nenv (0.3.0)
76
- notiffany (0.1.1)
77
- nenv (~> 0.1)
78
- shellany (~> 0.0)
79
- pry (0.10.4)
80
- coderay (~> 1.1.0)
81
- method_source (~> 0.8.1)
82
- slop (~> 3.4)
83
- psych (2.2.1)
84
- public_suffix (2.0.5)
85
- rack (1.6.5)
86
- rack-protection (1.5.3)
87
- rack
88
- rack-test (0.6.3)
89
- rack (>= 1.0)
90
- rake (12.0.0)
91
- rb-fsevent (0.9.8)
92
- rb-inotify (0.9.7)
93
- ffi (>= 0.5.0)
94
- redis (3.3.2)
95
- redis-namespace (1.5.2)
96
- redis (~> 3.0, >= 3.0.4)
97
- resque (1.26.0)
98
- mono_logger (~> 1.0)
99
- multi_json (~> 1.0)
100
- redis-namespace (~> 1.3)
101
- sinatra (>= 0.9.2)
102
- vegas (~> 0.1.2)
103
- rspec (3.5.0)
104
- rspec-core (~> 3.5.0)
105
- rspec-expectations (~> 3.5.0)
106
- rspec-mocks (~> 3.5.0)
107
- rspec-core (3.5.4)
108
- rspec-support (~> 3.5.0)
109
- rspec-expectations (3.5.0)
110
- diff-lcs (>= 1.2.0, < 2.0)
111
- rspec-support (~> 3.5.0)
112
- rspec-mocks (3.5.0)
113
- diff-lcs (>= 1.2.0, < 2.0)
114
- rspec-support (~> 3.5.0)
115
- rspec-support (3.5.0)
116
- ruby_dep (1.5.0)
117
- safe_yaml (1.0.4)
118
- shellany (0.0.1)
119
- sidekiq (4.2.7)
120
- concurrent-ruby (~> 1.0)
121
- connection_pool (~> 2.2, >= 2.2.0)
122
- rack-protection (>= 1.5.0)
123
- redis (~> 3.2, >= 3.2.1)
124
- simplecov (0.13.0)
125
- docile (~> 1.1.0)
126
- json (>= 1.8, < 3)
127
- simplecov-html (~> 0.10.0)
128
- simplecov-html (0.10.0)
129
- sinatra (1.4.6)
130
- rack (~> 1.4)
131
- rack-protection (~> 1.4)
132
- tilt (>= 1.3, < 3)
133
- slop (3.6.0)
134
- thor (0.19.4)
135
- tilt (2.0.5)
136
- typhoeus (1.3.0)
137
- ethon (>= 0.9.0)
138
- url (0.3.2)
139
- vegas (0.1.11)
140
- rack (>= 1.0.0)
141
- webmock (2.3.2)
142
- addressable (>= 2.3.6)
143
- crack (>= 0.3.2)
144
- hashdiff
145
- wisper (1.6.1)
146
-
147
- PLATFORMS
148
- ruby
149
-
150
- DEPENDENCIES
151
- appraisal
152
- bundler
153
- byebug
154
- codecov
155
- dogstatsd
156
- dotenv
157
- fork_break
158
- guard-rspec
159
- pry
160
- psych
161
- rack-test
162
- rake
163
- resque
164
- routemaster-drain!
165
- rspec
166
- sidekiq
167
- simplecov
168
- webmock
169
-
170
- BUNDLED WITH
171
- 1.15.4