Skip to content

Commit

Permalink
Bump assert_receive timeout in an attempt to reduce test flake
Browse files Browse the repository at this point in the history
  • Loading branch information
alco committed Dec 13, 2024
1 parent 80833b3 commit e7dab2f
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ defmodule Electric.Plug.ServeShapePlugTest do
@start_offset_50 LogOffset.new(Lsn.from_integer(50), 0)
@test_pg_id "12345"

# Higher timeout is needed for some tests that tend to run slower on CI.
@receive_timeout 1000

def load_column_info({"public", "users"}, _),
do: {:ok, @test_shape.table_info[{"public", "users"}][:columns]}

Expand Down Expand Up @@ -453,9 +456,7 @@ defmodule Electric.Plug.ServeShapePlugTest do
|> call_serve_shape_plug(ctx)
end)

# Raised timeout here because sometimes, rarely, the task takes a little while to reach this point
assert_receive :got_log_stream, 300
Process.sleep(50)
assert_receive :got_log_stream, @receive_timeout

# Simulate new changes arriving
Registry.dispatch(@registry, @test_shape_handle, fn [{pid, ref}] ->
Expand Down Expand Up @@ -512,9 +513,7 @@ defmodule Electric.Plug.ServeShapePlugTest do
|> call_serve_shape_plug(ctx)
end)

# Raised timeout here because sometimes, rarely, the task takes a little while to reach this point
assert_receive :got_log_stream, 300
Process.sleep(50)
assert_receive :got_log_stream, @receive_timeout

# Simulate shape rotation
Registry.dispatch(@registry, @test_shape_handle, fn [{pid, ref}] ->
Expand Down

0 comments on commit e7dab2f

Please sign in to comment.