Skip to content

Commit

Permalink
Test for the client accepting requests in 'receiving' state
Browse files Browse the repository at this point in the history
  • Loading branch information
bokner committed Jul 16, 2023
1 parent 74b735d commit d8337ba
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/client_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,18 @@ defmodule ClientTest do
end
)
end

test "handles requests while processing 'send'", %{client: client} = _ctx do
slow_processing_msg = "Asking receiver to SLOWDOWN..."
## One process sends a message, other 2 ask if the client is connected
send_task = Task.async(fn -> Client.send(client, slow_processing_msg) end)
Process.sleep(10)
## The client is in receivng mode...
{:receiving, _state} = :sys.get_state(client)
## ...and accepts other requests
assert Client.is_connected?(client)
assert Task.await(send_task) == {:ok, slow_processing_msg}
end
end

describe "send_async/2" do
Expand Down

0 comments on commit d8337ba

Please sign in to comment.