deimos-ruby 1.8.7 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c12e06b13f4b1910a93d955ddca456bdfaa0d8c5ee1a925cc1aea5c2d0f4df3
4
- data.tar.gz: b4ef92834678153a746b585a0c6c5ff36cb32fc65cd3fc94accc8a35e7fd6feb
3
+ metadata.gz: 754a19c6aef123b6505a28e4f2f6209a237c02a28b3d7c797b531ead05732c35
4
+ data.tar.gz: bef461f0a501cf3e838135c34c33b746f424ecbfacc99c277e5b16e3d5df74af
5
5
  SHA512:
6
- metadata.gz: 4c3eaf327c4483302847733e1a5134b2f559f4e0ed2e7b090d893292d0cde80ad7f9677c54b0f3b415d3933e377013c286fc133399705803419f0df6cb446f75
7
- data.tar.gz: a3bb3aa32da8ed98ee4bb763cd5c123f1289042219e85b219629c9e6b4a3ddd75870e0c7d9ea74b0e7d24a6edc707c5d0af39b3e6847de3da3d271679113040f
6
+ metadata.gz: e2496c1de094594c1d1a634f0cfbe14ac755000b748a4010f00705d47f0750411ee0b49e84b87b107419f8df788e5a3a77d09b6467a6d710c1f73538514e6025
7
+ data.tar.gz: 41e6b26586b82b649e5fd8a5b49d52efde0127838e6cda70e81664d9630a16e790e3d5971db4a31273d94030aab5630e5d485af082c08168deb36c659543a81b
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## UNRELEASED
9
9
 
10
+ ## 1.9.0 - 2021-01-28
11
+
12
+ - ### Roadmap :car:
13
+
14
+ - Bumped the version of ruby-kafka to latest
15
+
16
+ - ### Fixes :wrench:
17
+
18
+ - Prevents DB Poller from reconnecting to DB if there is an open transaction
19
+ - Replaces `before` by `prepend_before` for more consistent test setups.
20
+ - Adds validation in the `kafka_producers` method (fixes [#90](https://github.com/flipp-oss/deimos/issues/90))
21
+
10
22
  ## 1.8.7 - 2021-01-14
11
23
 
12
24
  - ### Roadmap :car:
@@ -4,7 +4,7 @@ PATH
4
4
  deimos-ruby (1.8.7)
5
5
  avro_turf (~> 0.11)
6
6
  phobos (>= 1.9, < 3.0)
7
- ruby-kafka (~> 0.7)
7
+ ruby-kafka (< 2)
8
8
  sigurd (= 0.0.1)
9
9
 
10
10
  GEM
@@ -71,7 +71,7 @@ GEM
71
71
  minitest (>= 5.1)
72
72
  tzinfo (~> 2.0)
73
73
  zeitwerk (~> 2.3)
74
- ast (2.4.1)
74
+ ast (2.4.2)
75
75
  avro (1.9.2)
76
76
  multi_json
77
77
  avro_turf (0.11.0)
@@ -79,21 +79,21 @@ GEM
79
79
  excon (~> 0.45)
80
80
  builder (3.2.4)
81
81
  coderay (1.1.3)
82
- concurrent-ruby (1.1.7)
83
- concurrent-ruby-ext (1.1.7)
84
- concurrent-ruby (= 1.1.7)
82
+ concurrent-ruby (1.1.8)
83
+ concurrent-ruby-ext (1.1.8)
84
+ concurrent-ruby (= 1.1.8)
85
85
  crass (1.0.6)
86
86
  database_cleaner (1.8.5)
87
- ddtrace (0.37.0)
87
+ ddtrace (0.45.0)
88
88
  msgpack
89
89
  diff-lcs (1.4.4)
90
90
  digest-crc (0.6.3)
91
91
  rake (>= 12.0.0, < 14.0.0)
92
- dogstatsd-ruby (4.8.1)
92
+ dogstatsd-ruby (4.8.2)
93
93
  erubi (1.10.0)
94
94
  excon (0.78.1)
95
95
  exponential-backoff (0.0.4)
96
- ffi (1.13.1)
96
+ ffi (1.14.2)
97
97
  formatador (0.2.5)
98
98
  globalid (0.4.2)
99
99
  activesupport (>= 4.2.0)
@@ -111,22 +111,22 @@ GEM
111
111
  guard (~> 2.1)
112
112
  guard-compat (~> 1.1)
113
113
  rspec (>= 2.99.0, < 4.0)
114
- guard-rubocop (1.3.0)
114
+ guard-rubocop (1.4.0)
115
115
  guard (~> 2.0)
116
- rubocop (~> 0.20)
116
+ rubocop (< 2.0)
117
117
  i18n (1.8.7)
118
118
  concurrent-ruby (~> 1.0)
119
- listen (3.2.1)
119
+ listen (3.4.1)
120
120
  rb-fsevent (~> 0.10, >= 0.10.3)
121
121
  rb-inotify (~> 0.9, >= 0.9.10)
122
122
  little-plugger (1.1.4)
123
123
  logging (2.3.0)
124
124
  little-plugger (~> 1.1)
125
125
  multi_json (~> 1.14)
126
- loofah (2.8.0)
126
+ loofah (2.9.0)
127
127
  crass (~> 1.0.2)
128
128
  nokogiri (>= 1.5.9)
129
- lumberjack (1.2.6)
129
+ lumberjack (1.2.8)
130
130
  mail (2.7.1)
131
131
  mini_mime (>= 0.1.1)
132
132
  marcel (0.3.3)
@@ -136,7 +136,7 @@ GEM
136
136
  mini_mime (1.0.2)
137
137
  mini_portile2 (2.5.0)
138
138
  minitest (5.14.3)
139
- msgpack (1.3.3)
139
+ msgpack (1.4.1)
140
140
  multi_json (1.15.0)
141
141
  mysql2 (0.5.3)
142
142
  nenv (0.3.0)
@@ -147,11 +147,11 @@ GEM
147
147
  notiffany (0.1.3)
148
148
  nenv (~> 0.1)
149
149
  shellany (~> 0.0)
150
- parallel (1.19.2)
151
- parser (2.7.1.4)
150
+ parallel (1.20.1)
151
+ parser (3.0.0.0)
152
152
  ast (~> 2.4.1)
153
153
  pg (1.2.3)
154
- phobos (2.0.1)
154
+ phobos (2.0.2)
155
155
  activesupport (>= 3.0.0)
156
156
  concurrent-ruby (>= 1.0.2)
157
157
  concurrent-ruby-ext (>= 1.0.2)
@@ -197,29 +197,29 @@ GEM
197
197
  rb-fsevent (0.10.4)
198
198
  rb-inotify (0.10.1)
199
199
  ffi (~> 1.0)
200
- regexp_parser (1.7.1)
200
+ regexp_parser (2.0.3)
201
201
  rexml (3.2.4)
202
- rspec (3.9.0)
203
- rspec-core (~> 3.9.0)
204
- rspec-expectations (~> 3.9.0)
205
- rspec-mocks (~> 3.9.0)
206
- rspec-core (3.9.2)
207
- rspec-support (~> 3.9.3)
208
- rspec-expectations (3.9.2)
202
+ rspec (3.10.0)
203
+ rspec-core (~> 3.10.0)
204
+ rspec-expectations (~> 3.10.0)
205
+ rspec-mocks (~> 3.10.0)
206
+ rspec-core (3.10.1)
207
+ rspec-support (~> 3.10.0)
208
+ rspec-expectations (3.10.1)
209
209
  diff-lcs (>= 1.2.0, < 2.0)
210
- rspec-support (~> 3.9.0)
211
- rspec-mocks (3.9.1)
210
+ rspec-support (~> 3.10.0)
211
+ rspec-mocks (3.10.1)
212
212
  diff-lcs (>= 1.2.0, < 2.0)
213
- rspec-support (~> 3.9.0)
214
- rspec-rails (4.0.1)
213
+ rspec-support (~> 3.10.0)
214
+ rspec-rails (4.0.2)
215
215
  actionpack (>= 4.2)
216
216
  activesupport (>= 4.2)
217
217
  railties (>= 4.2)
218
- rspec-core (~> 3.9)
219
- rspec-expectations (~> 3.9)
220
- rspec-mocks (~> 3.9)
221
- rspec-support (~> 3.9)
222
- rspec-support (3.9.3)
218
+ rspec-core (~> 3.10)
219
+ rspec-expectations (~> 3.10)
220
+ rspec-mocks (~> 3.10)
221
+ rspec-support (~> 3.10)
222
+ rspec-support (3.10.1)
223
223
  rspec_junit_formatter (0.4.1)
224
224
  rspec-core (>= 2, < 4, != 2.12.0)
225
225
  rubocop (0.88.0)
@@ -231,13 +231,13 @@ GEM
231
231
  rubocop-ast (>= 0.1.0, < 1.0)
232
232
  ruby-progressbar (~> 1.7)
233
233
  unicode-display_width (>= 1.4.0, < 2.0)
234
- rubocop-ast (0.2.0)
235
- parser (>= 2.7.0.1)
234
+ rubocop-ast (0.8.0)
235
+ parser (>= 2.7.1.5)
236
236
  rubocop-rspec (1.42.0)
237
237
  rubocop (>= 0.87.0)
238
- ruby-kafka (0.7.10)
238
+ ruby-kafka (1.3.0)
239
239
  digest-crc
240
- ruby-progressbar (1.10.1)
240
+ ruby-progressbar (1.11.0)
241
241
  shellany (0.0.1)
242
242
  sigurd (0.0.1)
243
243
  concurrent-ruby (~> 1)
@@ -250,7 +250,7 @@ GEM
250
250
  activesupport (>= 4.0)
251
251
  sprockets (>= 3.0.0)
252
252
  sqlite3 (1.4.2)
253
- thor (1.0.1)
253
+ thor (1.1.0)
254
254
  tzinfo (2.0.4)
255
255
  concurrent-ruby (~> 1.0)
256
256
  unicode-display_width (1.7.0)
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_runtime_dependency('avro_turf', '~> 0.11')
22
22
  spec.add_runtime_dependency('phobos', '>= 1.9', '< 3.0')
23
- spec.add_runtime_dependency('ruby-kafka', '~> 0.7')
23
+ spec.add_runtime_dependency('ruby-kafka', '< 2')
24
24
  spec.add_runtime_dependency('sigurd', '0.0.1')
25
25
 
26
26
  spec.add_development_dependency('activerecord-import')
@@ -6,6 +6,9 @@ module Deimos
6
6
  module KafkaSource
7
7
  extend ActiveSupport::Concern
8
8
 
9
+ DEPRECATION_WARNING = 'The kafka_producer interface will be deprecated ' \
10
+ 'in future releases. Please use kafka_producers instead.'
11
+
9
12
  included do
10
13
  after_create(:send_kafka_event_on_create)
11
14
  after_update(:send_kafka_event_on_update)
@@ -64,19 +67,12 @@ module Deimos
64
67
 
65
68
  # @return [Array<Deimos::ActiveRecordProducer>] the producers to run.
66
69
  def kafka_producers
67
- raise NotImplementedError if self.method(:kafka_producer).
68
- owner == Deimos::KafkaSource
69
-
70
- [self.kafka_producer]
71
- end
72
-
73
- # Deprecated - use #kafka_producers instead.
74
- # @return [Deimos::ActiveRecordProducer] the producer to use.
75
- def kafka_producer
76
- raise NotImplementedError if self.method(:kafka_producers).
77
- owner == Deimos::KafkaSource
70
+ if self.respond_to?(:kafka_producer)
71
+ Deimos.config.logger.warn(message: DEPRECATION_WARNING)
72
+ return [self.kafka_producer]
73
+ end
78
74
 
79
- self.kafka_producers.first
75
+ raise NotImplementedError
80
76
  end
81
77
 
82
78
  # This is an internal method, part of the activerecord_import gem. It's
@@ -34,7 +34,7 @@ module Deimos
34
34
  end
35
35
  end
36
36
 
37
- config.before(:each) do
37
+ config.prepend_before(:each) do
38
38
  client = double('client').as_null_object
39
39
  allow(client).to receive(:time) do |*_args, &block|
40
40
  block.call
@@ -68,7 +68,7 @@ module Deimos
68
68
 
69
69
  # Grab the PollInfo or create if it doesn't exist.
70
70
  def retrieve_poll_info
71
- ActiveRecord::Base.connection.reconnect!
71
+ ActiveRecord::Base.connection.reconnect! unless ActiveRecord::Base.connection.open_transactions.positive?
72
72
  new_time = @config.start_from_beginning ? Time.new(0) : Time.zone.now
73
73
  @info = Deimos::PollInfo.find_by_producer(@config.producer_class) ||
74
74
  Deimos::PollInfo.create!(producer: @config.producer_class,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Deimos
4
- VERSION = '1.8.7'
4
+ VERSION = '1.9.0'
5
5
  end
@@ -308,5 +308,74 @@ module KafkaSourceSpec
308
308
  }, widgets[1].id)
309
309
  end
310
310
  end
311
+
312
+ context 'with AR models that implement the kafka_producer interface' do
313
+ before(:each) do
314
+ # Dummy class we can include the mixin in. Has a backing table created
315
+ # earlier and has the import hook disabled
316
+ deprecated_class = Class.new(ActiveRecord::Base) do
317
+ include Deimos::KafkaSource
318
+ self.table_name = 'widgets'
319
+
320
+ # :nodoc:
321
+ def self.kafka_config
322
+ {
323
+ update: true,
324
+ delete: true,
325
+ import: false,
326
+ create: true
327
+ }
328
+ end
329
+
330
+ # :nodoc:
331
+ def self.kafka_producer
332
+ WidgetProducer
333
+ end
334
+ end
335
+ stub_const('WidgetDeprecated', deprecated_class)
336
+ WidgetDeprecated.reset_column_information
337
+ end
338
+
339
+ it 'logs a warning and sends the message as usual' do
340
+ expect(Deimos.config.logger).to receive(:warn).with({ message: WidgetDeprecated::DEPRECATION_WARNING })
341
+ widget = WidgetDeprecated.create(widget_id: 1, name: 'Widget 1')
342
+ expect('my-topic').to have_sent({
343
+ widget_id: 1,
344
+ name: 'Widget 1',
345
+ id: widget.id,
346
+ created_at: anything,
347
+ updated_at: anything
348
+ }, widget.id)
349
+ end
350
+ end
351
+
352
+ context 'with AR models that do not implement any producer interface' do
353
+ before(:each) do
354
+ # Dummy class we can include the mixin in. Has a backing table created
355
+ # earlier and has the import hook disabled
356
+ buggy_class = Class.new(ActiveRecord::Base) do
357
+ include Deimos::KafkaSource
358
+ self.table_name = 'widgets'
359
+
360
+ # :nodoc:
361
+ def self.kafka_config
362
+ {
363
+ update: true,
364
+ delete: true,
365
+ import: false,
366
+ create: true
367
+ }
368
+ end
369
+ end
370
+ stub_const('WidgetBuggy', buggy_class)
371
+ WidgetBuggy.reset_column_information
372
+ end
373
+
374
+ it 'raises a NotImplementedError exception' do
375
+ expect {
376
+ WidgetBuggy.create(widget_id: 1, name: 'Widget 1')
377
+ }.to raise_error(NotImplementedError)
378
+ end
379
+ end
311
380
  end
312
381
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deimos-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.7
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Orner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-14 00:00:00.000000000 Z
11
+ date: 2021-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avro_turf
@@ -48,16 +48,16 @@ dependencies:
48
48
  name: ruby-kafka
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - "~>"
51
+ - - "<"
52
52
  - !ruby/object:Gem::Version
53
- version: '0.7'
53
+ version: '2'
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - "~>"
58
+ - - "<"
59
59
  - !ruby/object:Gem::Version
60
- version: '0.7'
60
+ version: '2'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: sigurd
63
63
  requirement: !ruby/object:Gem::Requirement