Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase receive timeout for integration test #75

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions test/broadway_sqs/integration_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ defmodule BroadwaySQS.BroadwaySQS.IntegrationTest do
</DeleteMessageBatchResponse>
"""

defmodule RequestConter do
defmodule RequestCounter do
use Agent

def start_link(counters) do
Expand Down Expand Up @@ -117,15 +117,15 @@ defmodule BroadwaySQS.BroadwaySQS.IntegrationTest do
response =
case body do
"Action=ReceiveMessage" <> _rest ->
if RequestConter.count_for(:receive_message) > 5 do
if RequestCounter.count_for(:receive_message) > 5 do
@receive_message_empty_response
else
RequestConter.increment_for(:receive_message)
RequestCounter.increment_for(:receive_message)
@receive_message_response
end

"Action=DeleteMessageBatch" <> _rest ->
RequestConter.increment_for(:delete_message_batch)
RequestCounter.increment_for(:delete_message_batch)
send(us, :messages_deleted)
@delete_message_response
end
Expand All @@ -135,11 +135,11 @@ defmodule BroadwaySQS.BroadwaySQS.IntegrationTest do
|> Conn.resp(200, response)
end)

{:ok, _} = RequestConter.start_link(%{receive_message: 0, delete_message_batch: 0})
{:ok, _} = RequestCounter.start_link(%{receive_message: 0, delete_message_batch: 0})

{:ok, _consumer} = start_fake_consumer(bypass)

assert_receive {:message_handled, "hello world", %{receipt_handle: "receipt-handle-1"}}
assert_receive {:message_handled, "hello world", %{receipt_handle: "receipt-handle-1"}}, 1_000
assert_receive {:message_handled, "how are you?", %{receipt_handle: "receipt-handle-2"}}

assert_receive {:batch_handled, _messages}
Expand All @@ -148,8 +148,8 @@ defmodule BroadwaySQS.BroadwaySQS.IntegrationTest do
assert_receive :messages_deleted
assert_receive :messages_deleted

assert RequestConter.count_for(:receive_message) == 6
assert RequestConter.count_for(:delete_message_batch) == 3
assert RequestCounter.count_for(:receive_message) == 6
assert RequestCounter.count_for(:delete_message_batch) == 3
end

defp start_fake_consumer(bypass) do
Expand Down