fake_sqs 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/fake_sqs/actions/change_message_visibility.rb +5 -3
- data/lib/fake_sqs/actions/change_message_visibility_batch.rb +9 -9
- data/lib/fake_sqs/actions/delete_message.rb +2 -2
- data/lib/fake_sqs/actions/delete_message_batch.rb +5 -7
- data/lib/fake_sqs/actions/delete_queue.rb +2 -2
- data/lib/fake_sqs/actions/list_dead_letter_source_queues.rb +2 -2
- data/lib/fake_sqs/actions/purge_queue.rb +2 -2
- data/lib/fake_sqs/actions/receive_message.rb +3 -3
- data/lib/fake_sqs/actions/send_message.rb +2 -2
- data/lib/fake_sqs/actions/send_message_batch.rb +2 -3
- data/lib/fake_sqs/api.rb +1 -1
- data/lib/fake_sqs/databases/file.rb +1 -0
- data/lib/fake_sqs/helper.rb +12 -0
- data/lib/fake_sqs/message.rb +5 -0
- data/lib/fake_sqs/queue.rb +18 -18
- data/lib/fake_sqs/test_integration.rb +1 -1
- data/lib/fake_sqs/version.rb +1 -1
- data/lib/fake_sqs/web_interface.rb +5 -4
- data/spec/acceptance/message_actions_spec.rb +38 -45
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94412f4b22bef545ab170adea1e4a11221474592
|
4
|
+
data.tar.gz: d76a7b7b49a90681f18620fcbed7732062e9a226
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04e8d176460c83384dfb43c1f5aa669dfedbd68a8168adbe14d7516108271ae736ae1db352fa48bd23d02ced0686f4fa5f4a96a6b8205471af68d0b3ff111486
|
7
|
+
data.tar.gz: b3e49559fadd19e3977e5261b5ba724182ed2f2db5e7576cc66cb62d4731221cc7ba796c3d75a53b46801e9cb1d1be46f08ac0dca803df4f01b29ed529732891
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Fake SQS [![Build Status](https://
|
1
|
+
# Fake SQS [![Build Status](https://api.travis-ci.org/iain/fake_sqs.svg?branch=master)](http://travis-ci.org/iain/fake_sqs) [![Gem Version](https://badge.fury.io/rb/fake_sqs.svg)](https://badge.fury.io/rb/fake_sqs)
|
2
2
|
|
3
3
|
Fake SQS is a lightweight server that mocks the Amazon SQS API.
|
4
4
|
|
@@ -11,13 +11,13 @@ Many features are supported and if you miss something, open a pull.
|
|
11
11
|
## Installation
|
12
12
|
|
13
13
|
```
|
14
|
-
gem install
|
14
|
+
gem install fake_sqs
|
15
15
|
```
|
16
16
|
|
17
17
|
## Running
|
18
18
|
|
19
19
|
```
|
20
|
-
|
20
|
+
fake_sqs --database /path/to/database.yml
|
21
21
|
```
|
22
22
|
|
23
23
|
## Development
|
@@ -7,14 +7,16 @@ module FakeSQS
|
|
7
7
|
@responder = options.fetch(:responder)
|
8
8
|
end
|
9
9
|
|
10
|
-
def call(
|
10
|
+
def call(queue_name, params)
|
11
|
+
queue = @queues.get(queue_name)
|
11
12
|
visibility = params.fetch("VisibilityTimeout")
|
12
13
|
receipt = params.fetch("ReceiptHandle")
|
13
14
|
|
14
|
-
|
15
|
+
queue.change_message_visibility(receipt, visibility.to_i)
|
16
|
+
|
15
17
|
@responder.call :ChangeMessageVisibility
|
16
18
|
end
|
17
19
|
|
18
20
|
end
|
19
21
|
end
|
20
|
-
end
|
22
|
+
end
|
@@ -7,7 +7,9 @@ module FakeSQS
|
|
7
7
|
@responder = options.fetch(:responder)
|
8
8
|
end
|
9
9
|
|
10
|
-
def call(
|
10
|
+
def call(queue_name, params)
|
11
|
+
queue = @queues.get(queue_name)
|
12
|
+
|
11
13
|
keys = params.keys.map do |key|
|
12
14
|
case key
|
13
15
|
when /^ChangeMessageVisibilityBatchRequestEntry\.(\w+)\.Id$/
|
@@ -15,19 +17,17 @@ module FakeSQS
|
|
15
17
|
end
|
16
18
|
end.compact
|
17
19
|
|
18
|
-
|
20
|
+
ids = keys.map do |key|
|
19
21
|
receipt = params.fetch("ChangeMessageVisibilityBatchRequestEntry.#{key}.ReceiptHandle")
|
20
22
|
timeout = params.fetch("ChangeMessageVisibilityBatchRequestEntry.#{key}.VisibilityTimeout").to_i
|
21
|
-
|
23
|
+
queue.change_message_visibility(receipt, timeout)
|
22
24
|
params.fetch("ChangeMessageVisibilityBatchRequestEntry.#{key}.Id")
|
23
25
|
end
|
24
26
|
|
25
27
|
@responder.call :ChangeMessageVisibilityBatch do |xml|
|
26
|
-
|
27
|
-
|
28
|
-
xml.
|
29
|
-
xml.Id message
|
30
|
-
end
|
28
|
+
ids.each do |id|
|
29
|
+
xml.ChangeMessageVisibilityBatchResultEntry do
|
30
|
+
xml.Id id
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -35,4 +35,4 @@ module FakeSQS
|
|
35
35
|
|
36
36
|
end
|
37
37
|
end
|
38
|
-
end
|
38
|
+
end
|
@@ -8,8 +8,8 @@ module FakeSQS
|
|
8
8
|
@responder = options.fetch(:responder)
|
9
9
|
end
|
10
10
|
|
11
|
-
def call(
|
12
|
-
queue = @queues.get(
|
11
|
+
def call(queue_name, params)
|
12
|
+
queue = @queues.get(queue_name)
|
13
13
|
|
14
14
|
receipt = params.fetch("ReceiptHandle")
|
15
15
|
queue.delete_message(receipt)
|
@@ -8,16 +8,14 @@ module FakeSQS
|
|
8
8
|
@responder = options.fetch(:responder)
|
9
9
|
end
|
10
10
|
|
11
|
-
def call(
|
12
|
-
queue = @queues.get(
|
11
|
+
def call(queue_name, params)
|
12
|
+
queue = @queues.get(queue_name)
|
13
13
|
receipts = params.select { |k,v| k =~ /DeleteMessageBatchRequestEntry\.\d+\.ReceiptHandle/ }
|
14
14
|
|
15
|
-
deleted =
|
16
|
-
|
17
|
-
receipts.each do |key, value|
|
15
|
+
deleted = receipts.each do |key, value|
|
18
16
|
id = key.split('.')[1]
|
19
|
-
queue.delete_message(value)
|
20
|
-
|
17
|
+
queue.delete_message(value) # Broken, can only delete in-flight messages
|
18
|
+
params.fetch("DeleteMessageBatchRequestEntry.#{id}.Id")
|
21
19
|
end
|
22
20
|
|
23
21
|
@responder.call :DeleteMessageBatch do |xml|
|
@@ -8,8 +8,8 @@ module FakeSQS
|
|
8
8
|
@responder = options.fetch(:responder)
|
9
9
|
end
|
10
10
|
|
11
|
-
def call(
|
12
|
-
queue_arn = @queues.get(
|
11
|
+
def call(queue_name, params)
|
12
|
+
queue_arn = @queues.get(queue_name).arn
|
13
13
|
queue_urls = @queues.list.select do |queue|
|
14
14
|
redrive_policy = queue.attributes.fetch("RedrivePolicy", nil)
|
15
15
|
redrive_policy && redrive_policy =~ /deadLetterTargetArn\":\"#{queue_arn}/
|
@@ -8,8 +8,8 @@ module FakeSQS
|
|
8
8
|
@responder = options.fetch(:responder)
|
9
9
|
end
|
10
10
|
|
11
|
-
def call(
|
12
|
-
queue = @queues.get(
|
11
|
+
def call(queue_name, params)
|
12
|
+
queue = @queues.get(queue_name)
|
13
13
|
filtered_attribute_names = []
|
14
14
|
params.select{|k,v | k =~ /AttributeName\.\d+/}.each do |key, value|
|
15
15
|
filtered_attribute_names << value
|
@@ -36,4 +36,4 @@ module FakeSQS
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
39
|
-
end
|
39
|
+
end
|
@@ -8,8 +8,8 @@ module FakeSQS
|
|
8
8
|
@responder = options.fetch(:responder)
|
9
9
|
end
|
10
10
|
|
11
|
-
def call(
|
12
|
-
queue = @queues.get(
|
11
|
+
def call(queue_name, params)
|
12
|
+
queue = @queues.get(queue_name)
|
13
13
|
message = queue.send_message(params)
|
14
14
|
@responder.call :SendMessage do |xml|
|
15
15
|
xml.MD5OfMessageBody message.md5
|
@@ -8,9 +8,8 @@ module FakeSQS
|
|
8
8
|
@responder = options.fetch(:responder)
|
9
9
|
end
|
10
10
|
|
11
|
-
def call(
|
12
|
-
queue = @queues.get(
|
13
|
-
|
11
|
+
def call(queue_name, params)
|
12
|
+
queue = @queues.get(queue_name)
|
14
13
|
messages = params.select { |k,v| k =~ /SendMessageBatchRequestEntry\.\d+\.MessageBody/ }
|
15
14
|
|
16
15
|
results = {}
|
data/lib/fake_sqs/api.rb
CHANGED
data/lib/fake_sqs/message.rb
CHANGED
data/lib/fake_sqs/queue.rb
CHANGED
@@ -2,6 +2,7 @@ require 'monitor'
|
|
2
2
|
require 'securerandom'
|
3
3
|
require 'fake_sqs/collection_view'
|
4
4
|
require 'json'
|
5
|
+
|
5
6
|
module FakeSQS
|
6
7
|
|
7
8
|
MessageNotInflight = Class.new(RuntimeError)
|
@@ -47,7 +48,9 @@ module FakeSQS
|
|
47
48
|
def send_message(options = {})
|
48
49
|
with_lock do
|
49
50
|
message = options.fetch(:message){ message_factory.new(options) }
|
50
|
-
|
51
|
+
if message
|
52
|
+
@messages[message.receipt] = message
|
53
|
+
end
|
51
54
|
message
|
52
55
|
end
|
53
56
|
end
|
@@ -64,17 +67,16 @@ module FakeSQS
|
|
64
67
|
|
65
68
|
with_lock do
|
66
69
|
actual_amount = amount > published_size ? published_size : amount
|
67
|
-
published_messages = @messages.select { |m| m.published? }
|
70
|
+
published_messages = @messages.values.select { |m| m.published? }
|
68
71
|
|
69
72
|
actual_amount.times do
|
70
73
|
message = published_messages.delete_at(rand(published_size))
|
71
|
-
@messages.delete(message)
|
74
|
+
@messages.delete(message.receipt)
|
72
75
|
unless check_message_for_dlq(message, options)
|
73
76
|
message.expire_at(visibility_timeout)
|
74
77
|
message.receive!
|
75
|
-
receipt =
|
76
|
-
|
77
|
-
result[receipt] = message
|
78
|
+
@messages_in_flight[message.receipt] = message
|
79
|
+
result[message.receipt] = message
|
78
80
|
end
|
79
81
|
end
|
80
82
|
end
|
@@ -100,8 +102,8 @@ module FakeSQS
|
|
100
102
|
end
|
101
103
|
expired.each do |receipt,message|
|
102
104
|
message.expire!
|
103
|
-
@messages
|
104
|
-
|
105
|
+
@messages[receipt] = message
|
106
|
+
@messages_in_flight.delete(receipt)
|
105
107
|
end
|
106
108
|
end
|
107
109
|
end
|
@@ -113,8 +115,8 @@ module FakeSQS
|
|
113
115
|
|
114
116
|
if visibility == 0
|
115
117
|
message.expire!
|
116
|
-
@messages
|
117
|
-
|
118
|
+
@messages[receipt] = message
|
119
|
+
@messages_in_flight.delete(receipt)
|
118
120
|
else
|
119
121
|
message.expire_at(visibility)
|
120
122
|
end
|
@@ -134,13 +136,14 @@ module FakeSQS
|
|
134
136
|
|
135
137
|
def delete_message(receipt)
|
136
138
|
with_lock do
|
139
|
+
@messages.delete(receipt)
|
137
140
|
@messages_in_flight.delete(receipt)
|
138
141
|
end
|
139
142
|
end
|
140
143
|
|
141
144
|
def reset
|
142
145
|
with_lock do
|
143
|
-
@messages =
|
146
|
+
@messages = {}
|
144
147
|
@messages_view = FakeSQS::CollectionView.new(@messages)
|
145
148
|
reset_messages_in_flight
|
146
149
|
end
|
@@ -148,7 +151,8 @@ module FakeSQS
|
|
148
151
|
|
149
152
|
def expire
|
150
153
|
with_lock do
|
151
|
-
@messages
|
154
|
+
@messages.merge!(@messages_in_flight)
|
155
|
+
@messages_in_flight.clear()
|
152
156
|
reset_messages_in_flight
|
153
157
|
end
|
154
158
|
end
|
@@ -169,15 +173,11 @@ module FakeSQS
|
|
169
173
|
end
|
170
174
|
|
171
175
|
def size
|
172
|
-
messages.size
|
176
|
+
@messages.size
|
173
177
|
end
|
174
178
|
|
175
179
|
def published_size
|
176
|
-
messages.select { |m| m.published? }.size
|
177
|
-
end
|
178
|
-
|
179
|
-
def generate_receipt
|
180
|
-
SecureRandom.hex
|
180
|
+
@messages.values.select { |m| m.published? }.size
|
181
181
|
end
|
182
182
|
|
183
183
|
def with_lock
|
data/lib/fake_sqs/version.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'sinatra/base'
|
2
|
+
require 'fake_sqs/helper'
|
2
3
|
require 'fake_sqs/catch_errors'
|
3
4
|
require 'fake_sqs/error_response'
|
4
5
|
|
@@ -37,15 +38,15 @@ module FakeSQS
|
|
37
38
|
|
38
39
|
handle "/", [:get, :post] do
|
39
40
|
if params['QueueUrl']
|
40
|
-
|
41
|
-
return settings.api.call(action, request,
|
41
|
+
queue_name = Helper::queue_from_url(params['QueueUrl'])
|
42
|
+
return settings.api.call(action, request, queue_name, params) unless queue_name.empty?
|
42
43
|
end
|
43
44
|
|
44
45
|
settings.api.call(action, request, params)
|
45
46
|
end
|
46
47
|
|
47
|
-
handle "/:
|
48
|
-
settings.api.call(action, request,
|
48
|
+
handle "/:queue_name", [:get, :post] do |queue_name|
|
49
|
+
settings.api.call(action, request, queue_name, params)
|
49
50
|
end
|
50
51
|
end
|
51
52
|
end
|
@@ -11,7 +11,6 @@ RSpec.describe "Actions for Messages", :sqs do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
let(:sqs) { Aws::SQS::Client.new }
|
14
|
-
|
15
14
|
let(:queue_url) { sqs.get_queue_url(queue_name: QUEUE_NAME).queue_url }
|
16
15
|
|
17
16
|
specify "SendMessage" do
|
@@ -94,13 +93,13 @@ RSpec.describe "Actions for Messages", :sqs do
|
|
94
93
|
queue_url: queue_url,
|
95
94
|
).messages.first
|
96
95
|
|
96
|
+
let_messages_in_flight_expire
|
97
|
+
|
97
98
|
sqs.delete_message(
|
98
99
|
queue_url: queue_url,
|
99
100
|
receipt_handle: message1.receipt_handle,
|
100
101
|
)
|
101
102
|
|
102
|
-
let_messages_in_flight_expire
|
103
|
-
|
104
103
|
response = sqs.receive_message(
|
105
104
|
queue_url: queue_url,
|
106
105
|
)
|
@@ -121,25 +120,26 @@ RSpec.describe "Actions for Messages", :sqs do
|
|
121
120
|
queue_url: queue_url,
|
122
121
|
max_number_of_messages: 2,
|
123
122
|
)
|
123
|
+
expect(messages_response.messages.size).to eq 2
|
124
124
|
|
125
|
-
|
126
|
-
{
|
127
|
-
id: SecureRandom.uuid,
|
128
|
-
receipt_handle: msg.receipt_handle,
|
129
|
-
}
|
130
|
-
}
|
125
|
+
let_messages_in_flight_expire
|
131
126
|
|
132
|
-
sqs.delete_message_batch(
|
127
|
+
response = sqs.delete_message_batch(
|
133
128
|
queue_url: queue_url,
|
134
|
-
entries:
|
129
|
+
entries: messages_response.messages.map { |msg|
|
130
|
+
{
|
131
|
+
id: SecureRandom.uuid,
|
132
|
+
receipt_handle: msg.receipt_handle,
|
133
|
+
}
|
134
|
+
},
|
135
135
|
)
|
136
|
+
expect(response.successful.size).to eq(2)
|
136
137
|
|
137
|
-
|
138
|
-
|
139
|
-
response = sqs.receive_message(
|
138
|
+
messages_response = sqs.receive_message(
|
140
139
|
queue_url: queue_url,
|
140
|
+
max_number_of_messages: 2,
|
141
141
|
)
|
142
|
-
expect(
|
142
|
+
expect(messages_response.messages.size).to eq 0
|
143
143
|
end
|
144
144
|
|
145
145
|
specify "PurgeQueue" do
|
@@ -163,7 +163,7 @@ RSpec.describe "Actions for Messages", :sqs do
|
|
163
163
|
end
|
164
164
|
|
165
165
|
specify "DeleteQueue" do
|
166
|
-
sqs.send_message(
|
166
|
+
sent_message = sqs.send_message(
|
167
167
|
queue_url: queue_url,
|
168
168
|
message_body: "test1"
|
169
169
|
)
|
@@ -171,8 +171,11 @@ RSpec.describe "Actions for Messages", :sqs do
|
|
171
171
|
response = sqs.receive_message(
|
172
172
|
queue_url: queue_url,
|
173
173
|
)
|
174
|
+
expect(response.messages[0].message_id).to eq sent_message.message_id
|
174
175
|
expect(response.messages.size).to eq 1
|
175
176
|
|
177
|
+
let_messages_in_flight_expire
|
178
|
+
|
176
179
|
sqs.delete_queue(queue_url: queue_url)
|
177
180
|
sqs.create_queue(queue_name: QUEUE_NAME)
|
178
181
|
|
@@ -185,7 +188,7 @@ RSpec.describe "Actions for Messages", :sqs do
|
|
185
188
|
specify "SendMessageBatch" do
|
186
189
|
bodies = %w(a b c)
|
187
190
|
|
188
|
-
sqs.send_message_batch(
|
191
|
+
response = sqs.send_message_batch(
|
189
192
|
queue_url: queue_url,
|
190
193
|
entries: bodies.map { |bd|
|
191
194
|
{
|
@@ -194,12 +197,12 @@ RSpec.describe "Actions for Messages", :sqs do
|
|
194
197
|
}
|
195
198
|
}
|
196
199
|
)
|
200
|
+
expect(response.successful.size).to eq(3)
|
197
201
|
|
198
202
|
messages_response = sqs.receive_message(
|
199
203
|
queue_url: queue_url,
|
200
204
|
max_number_of_messages: 3,
|
201
205
|
)
|
202
|
-
|
203
206
|
expect(messages_response.messages.map(&:body)).to match_array bodies
|
204
207
|
end
|
205
208
|
|
@@ -213,14 +216,14 @@ RSpec.describe "Actions for Messages", :sqs do
|
|
213
216
|
|
214
217
|
message = sqs.receive_message(
|
215
218
|
queue_url: queue_url,
|
219
|
+
visibility_timeout: 10,
|
216
220
|
).messages.first
|
217
|
-
|
218
221
|
expect(message.body).to eq body
|
219
222
|
|
220
223
|
sqs.change_message_visibility(
|
221
224
|
queue_url: queue_url,
|
222
225
|
receipt_handle: message.receipt_handle,
|
223
|
-
visibility_timeout: 0
|
226
|
+
visibility_timeout: 0,
|
224
227
|
)
|
225
228
|
|
226
229
|
same_message = sqs.receive_message(
|
@@ -239,13 +242,14 @@ RSpec.describe "Actions for Messages", :sqs do
|
|
239
242
|
|
240
243
|
message = sqs.receive_message(
|
241
244
|
queue_url: queue_url,
|
245
|
+
visibility_timeout: 10,
|
242
246
|
).messages.first
|
243
247
|
expect(message.body).to eq body
|
244
248
|
|
245
249
|
sqs.change_message_visibility(
|
246
250
|
queue_url: queue_url,
|
247
251
|
receipt_handle: message.receipt_handle,
|
248
|
-
visibility_timeout:
|
252
|
+
visibility_timeout: 1,
|
249
253
|
)
|
250
254
|
|
251
255
|
nothing = sqs.receive_message(
|
@@ -253,9 +257,7 @@ RSpec.describe "Actions for Messages", :sqs do
|
|
253
257
|
)
|
254
258
|
expect(nothing.messages.size).to eq 0
|
255
259
|
|
256
|
-
|
257
|
-
# see https://github.com/iain/fake_sqs/pull/32
|
258
|
-
sleep(7)
|
260
|
+
sleep(2)
|
259
261
|
|
260
262
|
same_message = sqs.receive_message(
|
261
263
|
queue_url: queue_url,
|
@@ -264,27 +266,15 @@ RSpec.describe "Actions for Messages", :sqs do
|
|
264
266
|
end
|
265
267
|
|
266
268
|
specify 'should fail if trying to update the visibility_timeout for a message that is not in flight' do
|
267
|
-
|
268
|
-
sqs.send_message(
|
269
|
-
queue_url: queue_url,
|
270
|
-
message_body: body,
|
271
|
-
)
|
272
|
-
|
273
|
-
message = sqs.receive_message(
|
274
|
-
queue_url: queue_url,
|
275
|
-
).messages.first
|
276
|
-
expect(message.body).to eq body
|
277
|
-
|
278
|
-
sqs.change_message_visibility(
|
269
|
+
response = sqs.send_message(
|
279
270
|
queue_url: queue_url,
|
280
|
-
|
281
|
-
visibility_timeout: 0
|
271
|
+
message_body: 'some-sample-message',
|
282
272
|
)
|
283
273
|
|
284
274
|
expect {
|
285
275
|
sqs.change_message_visibility(
|
286
276
|
queue_url: queue_url,
|
287
|
-
receipt_handle:
|
277
|
+
receipt_handle: response.message_id,
|
288
278
|
visibility_timeout: 30
|
289
279
|
)
|
290
280
|
}.to raise_error(Aws::SQS::Errors::MessageNotInflight)
|
@@ -292,7 +282,7 @@ RSpec.describe "Actions for Messages", :sqs do
|
|
292
282
|
|
293
283
|
specify 'ChangeMessageVisibilityBatch' do
|
294
284
|
bodies = (1..10).map { |n| n.to_s }
|
295
|
-
sqs.send_message_batch(
|
285
|
+
response = sqs.send_message_batch(
|
296
286
|
queue_url: queue_url,
|
297
287
|
entries: bodies.map { |bd|
|
298
288
|
{
|
@@ -301,15 +291,16 @@ RSpec.describe "Actions for Messages", :sqs do
|
|
301
291
|
}
|
302
292
|
}
|
303
293
|
)
|
294
|
+
expect(response.successful.size).to eq(10)
|
295
|
+
|
304
296
|
message = sqs.receive_message(
|
305
297
|
queue_url: queue_url,
|
306
298
|
max_number_of_messages: 10,
|
307
|
-
visibility_timeout:
|
299
|
+
visibility_timeout: 1,
|
308
300
|
)
|
309
|
-
|
310
301
|
expect(message.messages.size).to eq(10)
|
311
302
|
|
312
|
-
sqs.change_message_visibility_batch(
|
303
|
+
response = sqs.change_message_visibility_batch(
|
313
304
|
queue_url: queue_url,
|
314
305
|
entries: message.messages.map { |m|
|
315
306
|
{
|
@@ -319,12 +310,14 @@ RSpec.describe "Actions for Messages", :sqs do
|
|
319
310
|
}
|
320
311
|
}
|
321
312
|
)
|
313
|
+
expect(response.successful.size).to eq(10)
|
314
|
+
|
315
|
+
sleep(2)
|
322
316
|
|
323
317
|
message = sqs.receive_message(
|
324
318
|
queue_url: queue_url,
|
325
319
|
max_number_of_messages: 10,
|
326
320
|
)
|
327
|
-
|
328
321
|
expect(message.messages.size).to eq(0)
|
329
322
|
end
|
330
323
|
|
@@ -367,7 +360,7 @@ RSpec.describe "Actions for Messages", :sqs do
|
|
367
360
|
sqs.change_message_visibility(
|
368
361
|
queue_url: queue_url,
|
369
362
|
receipt_handle: message.receipt_handle,
|
370
|
-
visibility_timeout: 0
|
363
|
+
visibility_timeout: 0,
|
371
364
|
)
|
372
365
|
end
|
373
366
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fake_sqs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- iain
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -191,6 +191,7 @@ files:
|
|
191
191
|
- lib/fake_sqs/databases/memory.rb
|
192
192
|
- lib/fake_sqs/error_response.rb
|
193
193
|
- lib/fake_sqs/error_responses.yml
|
194
|
+
- lib/fake_sqs/helper.rb
|
194
195
|
- lib/fake_sqs/message.rb
|
195
196
|
- lib/fake_sqs/queue.rb
|
196
197
|
- lib/fake_sqs/queue_factory.rb
|