110
110
111
111
# We have to make sure we create a bunch of events
112
112
# so we actually really try to stop the plugin.
113
- #
114
- # rspec's `and_yield` allow you to define a fix amount of possible
113
+ #
114
+ # rspec's `and_yield` allow you to define a fix amount of possible
115
115
# yielded values and doesn't allow you to create infinite loop.
116
116
# And since we are actually creating thread we need to make sure
117
117
# we have enough work to keep the thread working until we kill it..
@@ -140,10 +140,11 @@ def poll(polling_options = {})
140
140
let ( :id_field ) { "my_id_field" }
141
141
let ( :md5_field ) { "my_md5_field" }
142
142
let ( :sent_timestamp_field ) { "my_sent_timestamp_field" }
143
+ let ( :user_attributes_field ) { "my_user_attributes_field" }
143
144
144
145
let ( :message ) do
145
- double ( "message" , :message_id => message_id , :md5_of_body => md5_of_body , :attributes => { LogStash ::Inputs ::SQS ::SENT_TIMESTAMP => epoch_timestamp } )
146
- end
146
+ double ( "message" , :message_id => message_id , :md5_of_body => md5_of_body , :attributes => { LogStash ::Inputs ::SQS ::SENT_TIMESTAMP => epoch_timestamp } , :user_attributes => user_attributes_field )
147
+ end
147
148
148
149
subject { input . add_sqs_data ( event , message ) }
149
150
@@ -156,7 +157,8 @@ def poll(polling_options = {})
156
157
"queue" => queue_name ,
157
158
"id_field" => id_field ,
158
159
"md5_field" => md5_field ,
159
- "sent_timestamp_field" => sent_timestamp_field
160
+ "sent_timestamp_field" => sent_timestamp_field ,
161
+ "user_attributes_field" => user_attributes_field
160
162
}
161
163
end
162
164
@@ -198,7 +200,7 @@ def poll(polling_options = {})
198
200
end
199
201
200
202
context "receiving messages" do
201
- before do
203
+ before do
202
204
expect ( subject ) . to receive ( :poller ) . and_return ( mock_sqs ) . at_least ( :once )
203
205
end
204
206
@@ -235,7 +237,7 @@ def poll(polling_options = {})
235
237
it "retry to fetch messages" do
236
238
# change the poller implementation to raise SQS errors.
237
239
had_error = false
238
-
240
+
239
241
# actually using the child of `Object` to do an expectation of `#sleep`
240
242
expect ( subject ) . to receive ( :sleep ) . with ( LogStash ::Inputs ::SQS ::BACKOFF_SLEEP_TIME )
241
243
expect ( mock_sqs ) . to receive ( :poll ) . with ( anything ( ) ) . at_most ( 2 ) do
0 commit comments