logstash-input-redis 3.6.0 → 3.6.1

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: b4d501b78f7ec2abde6e571ccdf2886fd9aac601b10aaf079d2fa0d541de0b9b
4
- data.tar.gz: 37938fcb8edd96ca724d228caf2f84bca4c030d903a49a584de59296bbba9be7
3
+ metadata.gz: 63317e087d685718d569e6dde70a5e007d0d988abcac587f55f8f439ca354c87
4
+ data.tar.gz: 39410717e0a0a8fdcb3fd2a61553846bee7e82b3417a111ac36e1b222ccc782e
5
5
  SHA512:
6
- metadata.gz: 01f5b168dce3082a72efc309b6561d70ed0a4dd51339753afc0757aa02991110ca71d2151fcd30feb3b467585e37e09724de7e4ae6b11b2212da5955df09e0f6
7
- data.tar.gz: 2d2050789b33466f7baf063f1d227f9e3295d802ba515791b19662168abb37fcc8d96ea90c0f967215037e30f4a4cae9fc498c96ace81b11c377b59f2943207c
6
+ metadata.gz: e3612cb6febfe05864710e56a02b4eb2c899e75fbd1e9f25a4b9bbca4e62114c13846f05fe9c73f92b45ad2e8301baf6d9d5ab7719d576bd9ec13a2026894f9a
7
+ data.tar.gz: c10673819296c367d1ca7de3c795fd2c212099fc505c6bbe0b6a169f2ca87801afc70dc521d8a5db4a3f53e77c3a476bfef9e4d5f7cdc3fcfae414f9f832a5d2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 3.6.1
2
+ - Fix: resolve crash when commands_map is set [#86](https://github.com/logstash-plugins/logstash-input-redis/pull/86)
3
+
1
4
  ## 3.6.0
2
5
  - Remove ruby pipeline dependency. Starting from Logstash 8, Ruby execution engine is not available. All pipelines should use Java pipeline [#84](https://github.com/logstash-plugins/logstash-input-redis/pull/84)
3
6
 
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Logstash Plugin
2
2
 
3
3
  Travis Build
4
- [![Travis Build Status](https://travis-ci.org/logstash-plugins/logstash-input-redis.svg)](https://travis-ci.org/logstash-plugins/logstash-input-redis)
4
+ [![Travis Build Status](https://travis-ci.com/logstash-plugins/logstash-input-redis.svg)](https://travis-ci.com/logstash-plugins/logstash-input-redis)
5
5
 
6
6
  This is a plugin for [Logstash](https://github.com/elastic/logstash).
7
7
 
@@ -61,28 +61,10 @@ module LogStash module Inputs class Redis < LogStash::Inputs::Threadable
61
61
  config :command_map, :validate => :hash, :default => {}
62
62
 
63
63
  public
64
- # public API
65
- # use to store a proc that can provide a Redis instance or mock
66
- def add_external_redis_builder(builder) #callable
67
- @redis_builder = builder
68
- self
69
- end
70
-
71
- # use to apply an instance directly and bypass the builder
72
- def use_redis(instance)
73
- @redis = instance
74
- self
75
- end
76
-
77
- def new_redis_instance
78
- @redis_builder.call
79
- end
80
64
 
81
65
  def register
82
66
  @redis_url = @path.nil? ? "redis://#{@password}@#{@host}:#{@port}/#{@db}" : "#{@password}@#{@path}/#{@db}"
83
67
 
84
- @redis_builder ||= method(:internal_redis_builder)
85
-
86
68
  # just switch on data_type once
87
69
  if @data_type == 'list' || @data_type == 'dummy'
88
70
  @run_method = method(:list_runner)
@@ -147,8 +129,7 @@ module LogStash module Inputs class Redis < LogStash::Inputs::Threadable
147
129
  return connectionParams.merge(baseParams)
148
130
  end
149
131
 
150
- # private
151
- def internal_redis_builder
132
+ def new_redis_instance
152
133
  ::Redis.new(redis_params)
153
134
  end
154
135
 
@@ -157,14 +138,12 @@ module LogStash module Inputs class Redis < LogStash::Inputs::Threadable
157
138
  redis = new_redis_instance
158
139
 
159
140
  # register any renamed Redis commands
160
- if @command_map.any?
161
- client_command_map = redis.client.command_map
162
- @command_map.each do |name, renamed|
163
- client_command_map[name.to_sym] = renamed.to_sym
164
- end
141
+ @command_map.each do |name, renamed|
142
+ redis._client.command_map[name.to_sym] = renamed.to_sym
165
143
  end
166
144
 
167
145
  load_batch_script(redis) if batched? && is_list_type?
146
+
168
147
  redis
169
148
  end # def connect
170
149
 
@@ -208,7 +187,9 @@ EOF
208
187
  @redis ||= connect
209
188
  @list_method.call(@redis, output_queue)
210
189
  rescue ::Redis::BaseError => e
211
- @logger.warn("Redis connection problem", :exception => e)
190
+ info = { message: e.message, exception: e.class }
191
+ info[:backtrace] = e.backtrace if @logger.debug?
192
+ @logger.warn("Redis connection problem", info)
212
193
  # Reset the redis variable to trigger reconnect
213
194
  @redis = nil
214
195
  # this sleep does not need to be stoppable as its
@@ -270,14 +251,14 @@ EOF
270
251
  return if @redis.nil? || !@redis.connected?
271
252
  # if its a SubscribedClient then:
272
253
  # it does not have a disconnect method (yet)
273
- if @redis.client.is_a?(::Redis::SubscribedClient)
254
+ if @redis.subscribed?
274
255
  if @data_type == 'pattern_channel'
275
- @redis.client.punsubscribe
256
+ @redis.punsubscribe
276
257
  else
277
- @redis.client.unsubscribe
258
+ @redis.unsubscribe
278
259
  end
279
260
  else
280
- @redis.client.disconnect
261
+ @redis.disconnect!
281
262
  end
282
263
  @redis = nil
283
264
  end
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-input-redis'
4
- s.version = '3.6.0'
4
+ s.version = '3.6.1'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Reads events from a Redis instance"
7
7
  s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
23
23
  s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"
24
24
 
25
25
  s.add_runtime_dependency 'logstash-codec-json'
26
- s.add_runtime_dependency 'redis', '~> 4'
26
+ s.add_runtime_dependency 'redis', '>= 4.0.1', '< 5'
27
27
 
28
28
  s.add_development_dependency 'logstash-devutils'
29
29
  end
@@ -1,12 +1,12 @@
1
1
  require "logstash/devutils/rspec/spec_helper"
2
2
  require "logstash/devutils/rspec/shared_examples"
3
- require "redis"
4
- require "stud/try"
5
3
  require 'logstash/inputs/redis'
6
4
  require 'securerandom'
7
5
 
8
6
  def populate(key, event_count)
9
7
  require "logstash/event"
8
+ require "redis"
9
+ require "stud/try"
10
10
  redis = Redis.new(:host => "localhost")
11
11
  event_count.times do |value|
12
12
  event = LogStash::Event.new("sequence" => value)
@@ -65,153 +65,138 @@ describe "inputs/redis", :redis => true do
65
65
  end
66
66
  end
67
67
 
68
- # unit tests ---------------------
69
-
70
68
  describe LogStash::Inputs::Redis do
71
- let(:redis) { double('redis') }
72
- let(:builder) { ->{ redis } }
73
- let(:connection) { double('redis_connection') }
74
- let(:connected) { [true] }
69
+ let(:queue) { Queue.new }
70
+
75
71
  let(:data_type) { 'list' }
76
72
  let(:batch_count) { 1 }
77
- let(:cfg) { {'key' => 'foo', 'data_type' => data_type, 'batch_count' => batch_count} }
73
+ let(:config) { {'key' => 'foo', 'data_type' => data_type, 'batch_count' => batch_count} }
78
74
  let(:quit_calls) { [:quit] }
79
- let(:accumulator) { [] }
80
- let(:command_map) { {} }
81
75
 
82
76
  subject do
83
- LogStash::Plugin.lookup("input", "redis")
84
- .new(cfg).add_external_redis_builder(builder)
77
+ LogStash::Inputs::Redis.new(config)
85
78
  end
86
79
 
87
80
  context 'construction' do
88
81
  it 'registers the input' do
89
- expect {subject.register}.not_to raise_error
82
+ expect { subject.register }.not_to raise_error
90
83
  end
91
84
  end
92
85
 
93
86
  context 'renamed redis commands' do
94
- let(:cfg) {
95
- {'key' => 'foo',
96
- 'data_type' => data_type,
97
- 'command_map' =>
98
- {
99
- 'blpop' => 'testblpop',
100
- 'evalsha' => 'testevalsha',
101
- 'lrange' => 'testlrange',
102
- 'ltrim' => 'testltrim',
103
- 'script' => 'testscript',
104
- 'subscribe' => 'testsubscribe',
105
- 'psubscribe' => 'testpsubscribe',
106
- },
107
- 'batch_count' => 2
87
+ let(:config) do
88
+ {
89
+ 'key' => 'foo',
90
+ 'data_type' => data_type,
91
+ 'command_map' => {
92
+ 'blpop' => 'testblpop',
93
+ 'evalsha' => 'testevalsha',
94
+ 'lrange' => 'testlrange',
95
+ 'ltrim' => 'testltrim',
96
+ 'script' => 'testscript',
97
+ 'subscribe' => 'testsubscribe',
98
+ 'psubscribe' => 'testpsubscribe',
99
+ },
100
+ 'batch_count' => 2
108
101
  }
109
- }
110
-
111
- before do
112
- subject.register
113
- allow(redis).to receive(:connected?)
114
- allow(redis).to receive(:client).and_return(connection)
115
- allow(connection).to receive(:command_map).and_return(command_map)
116
102
  end
117
103
 
118
104
  it 'sets the renamed commands in the command map' do
119
- allow(redis).to receive(:script)
120
- allow(redis).to receive(:evalsha).and_return([])
121
-
122
- tt = Thread.new do
123
- sleep 0.01
124
- subject.do_stop
105
+ allow_any_instance_of( Redis::Client ).to receive(:call) do |_, command|
106
+ expect(command[0]).to eql :script
107
+ expect(command[1]).to eql 'load'
125
108
  end
126
109
 
127
- subject.run(accumulator)
128
- tt.join
110
+ subject.register
111
+ redis = subject.send :connect
112
+
113
+ command_map = redis._client.command_map
129
114
 
130
- expect(command_map[:blpop]).to eq cfg['command_map']['blpop'].to_sym
131
- expect(command_map[:evalsha]).to eq cfg['command_map']['evalsha'].to_sym
132
- expect(command_map[:lrange]).to eq cfg['command_map']['lrange'].to_sym
133
- expect(command_map[:ltrim]).to eq cfg['command_map']['ltrim'].to_sym
134
- expect(command_map[:script]).to eq cfg['command_map']['script'].to_sym
135
- expect(command_map[:subscribe]).to eq cfg['command_map']['subscribe'].to_sym
136
- expect(command_map[:psubscribe]).to eq cfg['command_map']['psubscribe'].to_sym
115
+ expect(command_map[:blpop]).to eq config['command_map']['blpop'].to_sym
116
+ expect(command_map[:evalsha]).to eq config['command_map']['evalsha'].to_sym
117
+ expect(command_map[:lrange]).to eq config['command_map']['lrange'].to_sym
118
+ expect(command_map[:ltrim]).to eq config['command_map']['ltrim'].to_sym
119
+ expect(command_map[:script]).to eq config['command_map']['script'].to_sym
120
+ expect(command_map[:subscribe]).to eq config['command_map']['subscribe'].to_sym
121
+ expect(command_map[:psubscribe]).to eq config['command_map']['psubscribe'].to_sym
137
122
  end
138
123
 
139
124
  it 'loads the batch script with the renamed command' do
140
- capture = nil
141
- allow(redis).to receive(:script) { |load, lua_script| capture = lua_script }
142
- allow(redis).to receive(:evalsha).and_return([])
125
+ expect_any_instance_of( Redis::Client ).to receive(:call) do |_, command|
126
+ expect(command[0]).to eql :script
127
+ expect(command[1]).to eql 'load'
143
128
 
144
- tt = Thread.new do
145
- sleep 0.01
146
- subject.do_stop
129
+ script = command[2]
130
+ expect(script).to include "redis.call('#{config['command_map']['lrange']}', KEYS[1], 0, batchsize)"
131
+ expect(script).to include "redis.call('#{config['command_map']['ltrim']}', KEYS[1], batchsize + 1, -1)"
147
132
  end
148
133
 
149
- subject.run(accumulator)
150
- tt.join
151
-
152
- expect(capture).to include "redis.call('#{cfg['command_map']['lrange']}', KEYS[1], 0, batchsize)"
153
- expect(capture).to include "redis.call('#{cfg['command_map']['ltrim']}', KEYS[1], batchsize + 1, -1)"
134
+ subject.register
135
+ subject.send :connect
154
136
  end
155
137
  end
156
138
 
157
-
158
139
  context 'runtime for list data_type' do
140
+
159
141
  before do
160
142
  subject.register
143
+ allow_any_instance_of( Redis::Client ).to receive(:connected?).and_return true
144
+ allow_any_instance_of( Redis::Client ).to receive(:disconnect)
145
+ allow_any_instance_of( Redis ).to receive(:quit)
146
+ end
147
+
148
+ after do
149
+ subject.stop
161
150
  end
162
151
 
163
152
  context 'close when redis is unset' do
164
- let(:quit_calls) { [:quit, :unsubscribe, :punsubscribe, :connection, :disconnect!] }
165
153
 
166
154
  it 'does not attempt to quit' do
167
- allow(redis).to receive(:nil?).and_return(true)
168
- quit_calls.each do |call|
169
- expect(redis).not_to receive(call)
170
- end
171
- expect {subject.do_stop}.not_to raise_error
155
+ expect_any_instance_of( Redis::Client ).to_not receive(:call)
156
+ expect_any_instance_of( Redis::Client ).to_not receive(:disconnect)
157
+
158
+ expect { subject.do_stop }.not_to raise_error
172
159
  end
173
160
  end
174
161
 
175
162
  it 'calling the run method, adds events to the queue' do
176
- expect(redis).to receive(:blpop).at_least(:once).and_return(['foo', 'l1'])
177
-
178
- allow(redis).to receive(:connected?).and_return(connected.last)
179
- allow(redis).to receive(:quit)
163
+ allow_any_instance_of( Redis::Client ).to receive(:call_with_timeout) do |_, command, timeout, &block|
164
+ expect(command[0]).to eql :blpop
165
+ expect(command[1]).to eql ['foo', 0]
166
+ expect(command[2]).to eql 1
167
+ end.and_return ['foo', "{\"foo1\":\"bar\""], nil
180
168
 
181
169
  tt = Thread.new do
182
- sleep 0.01
170
+ sleep 0.25
183
171
  subject.do_stop
184
172
  end
185
173
 
186
- subject.run(accumulator)
174
+ subject.run(queue)
187
175
 
188
176
  tt.join
189
177
 
190
- expect(accumulator.size).to be > 0
178
+ expect( queue.size ).to be > 0
191
179
  end
192
180
 
193
181
  context "when the batch size is greater than 1" do
194
182
  let(:batch_count) { 10 }
195
- let(:rates) { [] }
196
-
197
- before do
198
- allow(redis).to receive(:connected?).and_return(connected.last)
199
- allow(redis).to receive(:script)
200
- allow(redis).to receive(:quit)
201
- end
202
183
 
203
184
  it 'calling the run method, adds events to the queue' do
204
- expect(redis).to receive(:evalsha).at_least(:once).and_return(['a', 'b'])
185
+ allow_any_instance_of( Redis ).to receive(:script)
186
+ allow_any_instance_of( Redis::Client ).to receive(:call) do |_, command|
187
+ expect(command[0]).to eql :evalsha
188
+ end.and_return ['{"a": 1}', '{"b":'], []
205
189
 
206
190
  tt = Thread.new do
207
- sleep 0.01
191
+ sleep 0.25
208
192
  subject.do_stop
209
193
  end
210
194
 
211
- subject.run(accumulator)
195
+ subject.run(queue)
212
196
 
213
197
  tt.join
214
- expect(accumulator.size).to be > 0
198
+
199
+ expect( queue.size ).to be > 0
215
200
  end
216
201
  end
217
202
 
@@ -220,20 +205,18 @@ describe LogStash::Inputs::Redis do
220
205
  let(:rates) { [] }
221
206
 
222
207
  it 'will throttle the loop' do
223
- allow(redis).to receive(:evalsha) do
208
+ allow_any_instance_of( Redis ).to receive(:script)
209
+ allow_any_instance_of( Redis::Client ).to receive(:call) do |_, command|
210
+ expect(command[0]).to eql :evalsha
224
211
  rates.unshift Time.now.to_f
225
- []
226
- end
227
- allow(redis).to receive(:connected?).and_return(connected.last)
228
- allow(redis).to receive(:script)
229
- allow(redis).to receive(:quit)
212
+ end.and_return []
230
213
 
231
214
  tt = Thread.new do
232
- sleep 1
215
+ sleep 0.25
233
216
  subject.do_stop
234
217
  end
235
218
 
236
- subject.run(accumulator)
219
+ subject.run(queue)
237
220
 
238
221
  tt.join
239
222
 
@@ -242,7 +225,7 @@ describe LogStash::Inputs::Redis do
242
225
  inters << x - y
243
226
  end
244
227
 
245
- expect(accumulator.size).to eq(0)
228
+ expect( queue.size ).to eq(0)
246
229
  inters.each do |delta|
247
230
  expect(delta).to be_within(0.01).of(LogStash::Inputs::Redis::BATCH_EMPTY_SLEEP)
248
231
  end
@@ -250,16 +233,17 @@ describe LogStash::Inputs::Redis do
250
233
  end
251
234
 
252
235
  it 'multiple close calls, calls to redis once' do
253
- subject.use_redis(redis)
254
- allow(redis).to receive(:blpop).and_return(['foo', 'l1'])
255
- expect(redis).to receive(:connected?).and_return(connected.last)
236
+ # subject.use_redis(redis)
237
+ # allow(redis).to receive(:blpop).and_return(['foo', 'l1'])
238
+ # expect(redis).to receive(:connected?).and_return(connected.last)
239
+ allow_any_instance_of( Redis::Client ).to receive(:connected?).and_return true, false
240
+ # allow_any_instance_of( Redis::Client ).to receive(:disconnect)
256
241
  quit_calls.each do |call|
257
- expect(redis).to receive(call).at_most(:once)
242
+ allow_any_instance_of( Redis ).to receive(call).at_most(:once)
258
243
  end
259
244
 
260
245
  subject.do_stop
261
- connected.push(false) #can't use let block here so push to array
262
- expect {subject.do_stop}.not_to raise_error
246
+ expect { subject.do_stop }.not_to raise_error
263
247
  subject.do_stop
264
248
  end
265
249
  end
@@ -267,7 +251,7 @@ describe LogStash::Inputs::Redis do
267
251
  context 'for the subscribe data_types' do
268
252
  def run_it_thread(inst)
269
253
  Thread.new(inst) do |subj|
270
- subj.run(accumulator)
254
+ subj.run(queue)
271
255
  end
272
256
  end
273
257
 
@@ -283,35 +267,21 @@ describe LogStash::Inputs::Redis do
283
267
  def close_thread(inst, rt)
284
268
  Thread.new(inst, rt) do |subj, runner|
285
269
  # block for the messages
286
- e1 = accumulator.pop
287
- e2 = accumulator.pop
270
+ e1 = queue.pop
271
+ e2 = queue.pop
288
272
  # put em back for the tests
289
- accumulator.push(e1)
290
- accumulator.push(e2)
273
+ queue.push(e1)
274
+ queue.push(e2)
291
275
  runner.raise(LogStash::ShutdownSignal)
292
276
  subj.close
293
277
  end
294
278
  end
295
279
 
296
- let(:accumulator) { Queue.new }
297
-
298
- let(:instance) do
299
- inst = described_class.new(cfg)
300
- inst.register
301
- inst
302
- end
303
-
304
280
  before(:example, type: :mocked) do
305
281
  subject.register
306
- subject.use_redis(redis)
307
- allow(connection).to receive(:is_a?).and_return(true)
308
- allow(redis).to receive(:client).and_return(connection)
309
- expect(redis).to receive(:connected?).and_return(connected.last)
310
- allow(connection).to receive(:unsubscribe)
311
- allow(connection).to receive(:punsubscribe)
312
-
282
+ allow_any_instance_of( Redis::Client ).to receive(:connected?).and_return true, false
313
283
  quit_calls.each do |call|
314
- expect(redis).to receive(call).at_most(:once)
284
+ allow_any_instance_of( Redis ).to receive(call).at_most(:once)
315
285
  end
316
286
  end
317
287
 
@@ -322,8 +292,7 @@ describe LogStash::Inputs::Redis do
322
292
  context 'mocked redis' do
323
293
  it 'multiple stop calls, calls to redis once', type: :mocked do
324
294
  subject.do_stop
325
- connected.push(false) #can't use let block here so push to array
326
- expect {subject.do_stop}.not_to raise_error
295
+ expect { subject.do_stop }.not_to raise_error
327
296
  subject.do_stop
328
297
  end
329
298
  end
@@ -331,23 +300,23 @@ describe LogStash::Inputs::Redis do
331
300
  context 'real redis', :redis => true do
332
301
  it 'calling the run method, adds events to the queue' do
333
302
  #simulate the input thread
334
- rt = run_it_thread(instance)
303
+ rt = run_it_thread(subject)
335
304
  #simulate the other system thread
336
- publish_thread(instance.new_redis_instance, 'c').join
305
+ publish_thread(subject.send(:new_redis_instance), 'c').join
337
306
  #simulate the pipeline thread
338
- close_thread(instance, rt).join
307
+ close_thread(subject, rt).join
339
308
 
340
- expect(accumulator.size).to eq(2)
309
+ expect(queue.size).to eq(2)
341
310
  end
342
311
  it 'events had redis_channel' do
343
312
  #simulate the input thread
344
- rt = run_it_thread(instance)
313
+ rt = run_it_thread(subject)
345
314
  #simulate the other system thread
346
- publish_thread(instance.new_redis_instance, 'c').join
315
+ publish_thread(subject.send(:new_redis_instance), 'c').join
347
316
  #simulate the pipeline thread
348
- close_thread(instance, rt).join
349
- e1 = accumulator.pop
350
- e2 = accumulator.pop
317
+ close_thread(subject, rt).join
318
+ e1 = queue.pop
319
+ e2 = queue.pop
351
320
  expect(e1.get('[@metadata][redis_channel]')).to eq('foo')
352
321
  expect(e2.get('[@metadata][redis_channel]')).to eq('foo')
353
322
  end
@@ -361,8 +330,7 @@ describe LogStash::Inputs::Redis do
361
330
  context 'mocked redis' do
362
331
  it 'multiple stop calls, calls to redis once', type: :mocked do
363
332
  subject.do_stop
364
- connected.push(false) #can't use let block here so push to array
365
- expect {subject.do_stop}.not_to raise_error
333
+ expect { subject.do_stop }.not_to raise_error
366
334
  subject.do_stop
367
335
  end
368
336
  end
@@ -370,23 +338,24 @@ describe LogStash::Inputs::Redis do
370
338
  context 'real redis', :redis => true do
371
339
  it 'calling the run method, adds events to the queue' do
372
340
  #simulate the input thread
373
- rt = run_it_thread(instance)
341
+ rt = run_it_thread(subject)
374
342
  #simulate the other system thread
375
- publish_thread(instance.new_redis_instance, 'pc').join
343
+ publish_thread(subject.send(:new_redis_instance), 'pc').join
376
344
  #simulate the pipeline thread
377
- close_thread(instance, rt).join
345
+ close_thread(subject, rt).join
378
346
 
379
- expect(accumulator.size).to eq(2)
347
+ expect(queue.size).to eq(2)
380
348
  end
349
+
381
350
  it 'events had redis_channel' do
382
351
  #simulate the input thread
383
- rt = run_it_thread(instance)
352
+ rt = run_it_thread(subject)
384
353
  #simulate the other system thread
385
- publish_thread(instance.new_redis_instance, 'pc').join
354
+ publish_thread(subject.send(:new_redis_instance), 'pc').join
386
355
  #simulate the pipeline thread
387
- close_thread(instance, rt).join
388
- e1 = accumulator.pop
389
- e2 = accumulator.pop
356
+ close_thread(subject, rt).join
357
+ e1 = queue.pop
358
+ e2 = queue.pop
390
359
  expect(e1.get('[@metadata][redis_channel]')).to eq('foo')
391
360
  expect(e2.get('[@metadata][redis_channel]')).to eq('foo')
392
361
  end
@@ -394,15 +363,15 @@ describe LogStash::Inputs::Redis do
394
363
  end
395
364
  end
396
365
 
397
- describe LogStash::Inputs::Redis do
398
- context "when using data type" do
399
- ["list", "channel", "pattern_channel"].each do |data_type|
400
- context data_type do
401
- it_behaves_like "an interruptible input plugin" do
402
- let(:config) { {'key' => 'foo', 'data_type' => data_type } }
403
- end
366
+ context "when using data type" do
367
+
368
+ ["list", "channel", "pattern_channel"].each do |data_type|
369
+ context data_type do
370
+ it_behaves_like "an interruptible input plugin", :redis => true do
371
+ let(:config) { { 'key' => 'foo', 'data_type' => data_type } }
404
372
  end
405
373
  end
406
374
  end
375
+
407
376
  end
408
377
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-redis
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.0
4
+ version: 3.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-22 00:00:00.000000000 Z
11
+ date: 2021-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -47,17 +47,23 @@ dependencies:
47
47
  - !ruby/object:Gem::Dependency
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  requirements:
50
- - - "~>"
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 4.0.1
53
+ - - "<"
51
54
  - !ruby/object:Gem::Version
52
- version: '4'
55
+ version: '5'
53
56
  name: redis
54
57
  prerelease: false
55
58
  type: :runtime
56
59
  version_requirements: !ruby/object:Gem::Requirement
57
60
  requirements:
58
- - - "~>"
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: 4.0.1
64
+ - - "<"
59
65
  - !ruby/object:Gem::Version
60
- version: '4'
66
+ version: '5'
61
67
  - !ruby/object:Gem::Dependency
62
68
  requirement: !ruby/object:Gem::Requirement
63
69
  requirements: