alephant-sequencer 3.1.1 → 3.2.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
  SHA1:
3
- metadata.gz: e18b0c6e698768dce4f614890d9ce4bef61f0cb7
4
- data.tar.gz: c644ddf1987bef172626151badd5834c2d0af925
3
+ metadata.gz: 1b2c61c50eec14f883e1e41e4c9aa0400c933692
4
+ data.tar.gz: 80da5a3eb098c7c7313fe1e39e3d670011c77503
5
5
  SHA512:
6
- metadata.gz: 7972baac0d4095ab9e5add8bee3ead2ccbc733003d179cf1246a72efe622e436c8f3aafb5ee71a886e3ac46f69f94de1741e1386b63cdc24ca3a1efbfbdc6c8f
7
- data.tar.gz: 3531b8a5734af6f6d49cce71c401e28168537359383e76901ec08d31ddf1394c3c7094d07e6e15766a30c9623c4720a3cffd842ba28682b26af7695f0a95c1d1
6
+ metadata.gz: 0fd622b775ff450bed1d556d2203351a4d08ee105f4e9a0f8703eddb140e3f725c8d59cfaaf1528429ee9ab6ed1f690f35235030d320cb85d2f94edfb68af957
7
+ data.tar.gz: af672d1682a7e6d89396c6fc6f6d97341fb9ad616eb551c2efac798249ce0595d5d63338f050dbe682450659019bb15eb77b666227781b93cdfccff139673c67
@@ -35,5 +35,5 @@ Gem::Specification.new do |spec|
35
35
  spec.add_runtime_dependency "alephant-logger"
36
36
  spec.add_runtime_dependency "alephant-support"
37
37
  spec.add_runtime_dependency "jsonpath"
38
- spec.add_runtime_dependency "dalli-elasticache"
38
+ spec.add_runtime_dependency "dalli"
39
39
  end
@@ -1,4 +1,4 @@
1
- require 'dalli-elasticache'
1
+ require 'dalli'
2
2
  require 'alephant/logger'
3
3
 
4
4
  module Alephant
@@ -18,8 +18,7 @@ module Alephant
18
18
  logger.metric 'NoConfigEndpoint'
19
19
  @client = NullClient.new
20
20
  else
21
- @elasticache ||= ::Dalli::ElastiCache.new(config_endpoint, expires_in: ttl)
22
- @client ||= @elasticache.client
21
+ @client ||= ::Dalli::Client.new(config_endpoint, expires_in: ttl)
23
22
  end
24
23
  end
25
24
 
@@ -1,5 +1,5 @@
1
1
  module Alephant
2
2
  module Sequencer
3
- VERSION = '3.1.1'.freeze
3
+ VERSION = '3.2.0'.freeze
4
4
  end
5
5
  end
@@ -7,6 +7,7 @@ describe Alephant::Sequencer do
7
7
  let(:keep_all) { true }
8
8
  let(:config) { { 'elasticache_config_endpoint' => '/foo' } }
9
9
  let(:cache) { Alephant::Sequencer::SequenceCache.new(config) }
10
+ let(:cache_client) { Dalli::Client.new }
10
11
  let(:opts) do
11
12
  {
12
13
  id: ident,
@@ -15,12 +16,13 @@ describe Alephant::Sequencer do
15
16
  cache: cache
16
17
  }
17
18
  end
19
+
20
+ before do
21
+ allow(Dalli::Client).to receive(:new).and_return(cache_client)
22
+ end
18
23
 
19
24
  describe '.create' do
20
25
  it 'should return a Sequencer' do
21
- expect_any_instance_of(Dalli::ElastiCache).to receive(:initialize)
22
- expect_any_instance_of(Dalli::ElastiCache).to receive(:client).and_return(Dalli::Client.new)
23
-
24
26
  expect_any_instance_of(Alephant::Sequencer::SequenceTable).to receive(:initialize)
25
27
  expect_any_instance_of(Alephant::Sequencer::SequenceTable).to receive(:sequence_exists)
26
28
 
@@ -63,9 +65,6 @@ describe Alephant::Sequencer do
63
65
  it 'sets @jsonpath, @ident' do
64
66
  expect(sequence_table).to receive(:sequence_exists)
65
67
 
66
- expect_any_instance_of(Dalli::ElastiCache).to receive(:initialize)
67
- expect_any_instance_of(Dalli::ElastiCache).to receive(:client).and_return(Dalli::Client.new)
68
-
69
68
  expect(instance.jsonpath).to eq(jsonpath)
70
69
  expect(instance.ident).to eq(ident)
71
70
  expect(instance.keep_all).to eq(true)
@@ -105,11 +104,8 @@ describe Alephant::Sequencer do
105
104
  expect(sequence_table).to receive(:sequence_exists)
106
105
  expect(sequence_table).to receive(:sequence_for).with(ident)
107
106
 
108
- expect_any_instance_of(Dalli::ElastiCache).to receive(:initialize)
109
- expect_any_instance_of(Dalli::ElastiCache).to receive(:client).and_return(Dalli::Client.new)
110
-
111
- expect_any_instance_of(Dalli::Client).to receive(:get).twice
112
- expect_any_instance_of(Dalli::Client).to receive(:set).twice
107
+ expect(cache_client).to receive(:get).twice
108
+ expect(cache_client).to receive(:set).twice
113
109
 
114
110
  expect(message).to receive(:body)
115
111
 
@@ -122,11 +118,8 @@ describe Alephant::Sequencer do
122
118
 
123
119
  expect(described_class).to receive(:sequence_id_from).and_return(stubbed_seen_high)
124
120
 
125
- expect_any_instance_of(Dalli::ElastiCache).to receive(:initialize)
126
- expect_any_instance_of(Dalli::ElastiCache).to receive(:client).and_return(Dalli::Client.new)
127
-
128
- expect_any_instance_of(Dalli::Client).to receive(:get)
129
- expect_any_instance_of(Dalli::Client).to receive(:set)
121
+ expect(cache_client).to receive(:get)
122
+ expect(cache_client).to receive(:set)
130
123
  end
131
124
 
132
125
  it 'should not call set_last_seen' do
@@ -144,11 +137,8 @@ describe Alephant::Sequencer do
144
137
 
145
138
  expect(described_class).to receive(:sequence_id_from).and_return(stubbed_last_seen)
146
139
 
147
- expect_any_instance_of(Dalli::ElastiCache).to receive(:initialize)
148
- expect_any_instance_of(Dalli::ElastiCache).to receive(:client).and_return(Dalli::Client.new)
149
-
150
- expect_any_instance_of(Dalli::Client).to receive(:get)
151
- expect_any_instance_of(Dalli::Client).to receive(:set)
140
+ expect(cache_client).to receive(:get)
141
+ expect(cache_client).to receive(:set)
152
142
  end
153
143
 
154
144
  it 'should not call set_last_seen(msg, last_seen_id)' do
@@ -166,11 +156,8 @@ describe Alephant::Sequencer do
166
156
 
167
157
  expect(described_class).to receive(:sequence_id_from).and_return(stubbed_seen_low)
168
158
 
169
- expect_any_instance_of(Dalli::ElastiCache).to receive(:initialize)
170
- expect_any_instance_of(Dalli::ElastiCache).to receive(:client).and_return(Dalli::Client.new)
171
-
172
- expect_any_instance_of(Dalli::Client).to receive(:get)
173
- expect_any_instance_of(Dalli::Client).to receive(:set)
159
+ expect(cache_client).to receive(:get)
160
+ expect(cache_client).to receive(:set)
174
161
  end
175
162
 
176
163
  it 'should not call set_last_seen' do
@@ -206,11 +193,8 @@ describe Alephant::Sequencer do
206
193
 
207
194
  expect(described_class).to receive(:sequence_id_from).and_return(stubbed_seen_high)
208
195
 
209
- expect_any_instance_of(Dalli::ElastiCache).to receive(:initialize)
210
- expect_any_instance_of(Dalli::ElastiCache).to receive(:client).and_return(Dalli::Client.new)
211
-
212
- expect_any_instance_of(Dalli::Client).to receive(:get)
213
- expect_any_instance_of(Dalli::Client).to receive(:set)
196
+ expect(cache_client).to receive(:get)
197
+ expect(cache_client).to receive(:set)
214
198
  end
215
199
 
216
200
  it 'should call set_last_seen(msg, last_seen_id)' do
@@ -226,11 +210,8 @@ describe Alephant::Sequencer do
226
210
  before(:each) do
227
211
  expect(message).to receive(:body).and_return('sequence_id' => 5)
228
212
 
229
- expect_any_instance_of(Dalli::ElastiCache).to receive(:initialize)
230
- expect_any_instance_of(Dalli::ElastiCache).to receive(:client).and_return(Dalli::Client.new)
231
-
232
- expect_any_instance_of(Dalli::Client).to receive(:get).twice.with('ident').and_return(stubbed_last_seen)
233
- expect_any_instance_of(Dalli::Client).to_not receive(:set)
213
+ expect(cache_client).to receive(:get).twice.with('ident').and_return(stubbed_last_seen)
214
+ expect(cache_client).to_not receive(:set)
234
215
  end
235
216
 
236
217
  it 'should read values from cache and not database' do
@@ -250,11 +231,8 @@ describe Alephant::Sequencer do
250
231
  end
251
232
 
252
233
  it 'returns sequence_table.sequence_for(ident)' do
253
- expect_any_instance_of(Dalli::ElastiCache).to receive(:initialize)
254
- expect_any_instance_of(Dalli::ElastiCache).to receive(:client).and_return(Dalli::Client.new)
255
-
256
- expect_any_instance_of(Dalli::Client).to receive(:get).twice
257
- expect_any_instance_of(Dalli::Client).to receive(:set).twice
234
+ expect(cache_client).to receive(:get).twice
235
+ expect(cache_client).to receive(:set).twice
258
236
 
259
237
  expect(sequence_table).to receive(:sequence_exists)
260
238
 
@@ -270,11 +248,8 @@ describe Alephant::Sequencer do
270
248
  before(:each) do
271
249
  expect(described_class).to receive(:sequence_id_from).and_return(last_seen)
272
250
 
273
- expect_any_instance_of(Dalli::ElastiCache).to receive(:initialize)
274
- expect_any_instance_of(Dalli::ElastiCache).to receive(:client).and_return(Dalli::Client.new)
275
-
276
- expect_any_instance_of(Dalli::Client).to receive(:get).twice
277
- expect_any_instance_of(Dalli::Client).to receive(:set).twice
251
+ expect(cache_client).to receive(:get).twice
252
+ expect(cache_client).to receive(:set).twice
278
253
  end
279
254
 
280
255
  subject (:instance) do
@@ -308,11 +283,8 @@ describe Alephant::Sequencer do
308
283
 
309
284
  expect(sequence_table).to receive(:sequence_exists)
310
285
 
311
- expect_any_instance_of(Dalli::ElastiCache).to receive(:initialize)
312
- expect_any_instance_of(Dalli::ElastiCache).to receive(:client).and_return(Dalli::Client.new)
313
-
314
- expect_any_instance_of(Dalli::Client).to receive(:get)
315
- expect_any_instance_of(Dalli::Client).to receive(:set)
286
+ expect(cache_client).to receive(:get)
287
+ expect(cache_client).to receive(:set)
316
288
  end
317
289
 
318
290
  subject (:instance) do
@@ -366,9 +338,6 @@ describe Alephant::Sequencer do
366
338
  end
367
339
 
368
340
  it 'verify SequenceTable#truncate!' do
369
- expect_any_instance_of(Dalli::ElastiCache).to receive(:initialize)
370
- expect_any_instance_of(Dalli::ElastiCache).to receive(:client).and_return(Dalli::Client.new)
371
-
372
341
  expect(sequence_table).to receive(:sequence_exists)
373
342
  expect(sequence_table).to receive(:truncate!)
374
343
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alephant-sequencer
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - BBC News
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-04 00:00:00.000000000 Z
11
+ date: 2018-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -221,7 +221,7 @@ dependencies:
221
221
  - !ruby/object:Gem::Version
222
222
  version: '0'
223
223
  - !ruby/object:Gem::Dependency
224
- name: dalli-elasticache
224
+ name: dalli
225
225
  requirement: !ruby/object:Gem::Requirement
226
226
  requirements:
227
227
  - - ">="
@@ -277,7 +277,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
277
277
  version: '0'
278
278
  requirements: []
279
279
  rubyforge_project:
280
- rubygems_version: 2.6.12
280
+ rubygems_version: 2.6.14
281
281
  signing_key:
282
282
  specification_version: 4
283
283
  summary: Adds sequencing functionality to Alephant.