Skip to content

Commit

Permalink
Extend message receive timeout in tests to make up for Travis slowness
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafal Studnicki authored and Simon Zelazny committed Jun 8, 2017
1 parent 55b2bac commit 10324f2
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions test/phoenix/pubsub/pg2_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ defmodule Phoenix.PubSub.PG2Test do
@node1 :"[email protected]"
@node2 :"[email protected]"

@receive_timeout 200

setup config do
size = config[:pool_size] || 1
if config[:pool_size] do
Expand All @@ -29,15 +31,15 @@ defmodule Phoenix.PubSub.PG2Test do

PubSub.subscribe(config.pubsub, config.topic)
:ok = PubSub.direct_broadcast(@node1, config.pubsub, config.topic, :ping)
assert_receive {@node1, :ping}
assert_receive {@node1, :ping}, @receive_timeout
:ok = PubSub.direct_broadcast!(@node1, config.pubsub, config.topic, :ping)
assert_receive {@node1, :ping}
assert_receive {@node1, :ping}, @receive_timeout

:ok = PubSub.direct_broadcast(@node2, config.pubsub, config.topic, :ping)
refute_receive {@node1, :ping}
refute_receive {@node1, :ping}, @receive_timeout

:ok = PubSub.direct_broadcast!(@node2, config.pubsub, config.topic, :ping)
refute_receive {@node1, :ping}
refute_receive {@node1, :ping}, @receive_timeout
end

@tag pool_size: size, topic: topic
Expand All @@ -46,15 +48,15 @@ defmodule Phoenix.PubSub.PG2Test do

PubSub.subscribe(config.pubsub, config.topic)
:ok = PubSub.direct_broadcast_from(@node1, config.pubsub, self(), config.topic, :ping)
assert_receive {@node1, :ping}
assert_receive {@node1, :ping}, @receive_timeout
:ok = PubSub.direct_broadcast_from!(@node1, config.pubsub, self(), config.topic, :ping)
assert_receive {@node1, :ping}
assert_receive {@node1, :ping}, @receive_timeout

:ok = PubSub.direct_broadcast_from(@node2, config.pubsub, self(), config.topic, :ping)
refute_receive {@node1, :ping}
refute_receive {@node1, :ping}, @receive_timeout

:ok = PubSub.direct_broadcast_from!(@node2, config.pubsub, self(), config.topic, :ping)
refute_receive {@node1, :ping}
refute_receive {@node1, :ping}, @receive_timeout
end
end

Expand Down

0 comments on commit 10324f2

Please sign in to comment.