Skip to content

Commit fe1f308

Browse files
alcoclaude
andcommitted
fixup! chore(sync-service): upgrade Elixir to 1.20.0-rc.3
Fix flaky CallHomeReporterTest by adding Bypass.pass after assert_receive. CallHomeReporter.terminate/2 sends a final HTTP report via Task.async, which races with Bypass's on_exit verification during test cleanup. The Cowboy handler for this extra request can get killed by the shutdown cascade, causing Bypass to record {:exit, :shutdown} and re-raise it. Bypass.pass tells Bypass to return :ok during on_exit regardless. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2121a96 commit fe1f308

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

packages/electric-telemetry/test/electric/telemetry/call_home_reporter_test.exs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ defmodule ElectricTelemetry.CallHomeReporterTest do
7272
start_supervised!({ElectricTelemetry.ApplicationTelemetry, ctx.telemetry_opts})
7373

7474
assert_receive :bypass_done, 500
75+
# Bypass.pass prevents a race condition where CallHomeReporter.terminate/2 sends
76+
# an extra HTTP request to Bypass during test cleanup, whose Cowboy handler can get
77+
# killed by the shutdown cascade, causing Bypass to record a {:exit, :shutdown} error.
78+
Bypass.pass(ctx.bypass)
7579
end
7680

7781
test "reports all expected info when started under StackTelemetry", ctx do
@@ -117,6 +121,7 @@ defmodule ElectricTelemetry.CallHomeReporterTest do
117121
start_supervised!({ElectricTelemetry.StackTelemetry, ctx.telemetry_opts})
118122

119123
assert_receive :bypass_done, 500
124+
Bypass.pass(ctx.bypass)
120125
end
121126

122127
test "StackTelemetry report data conforms to remote server schema", ctx do
@@ -143,6 +148,7 @@ defmodule ElectricTelemetry.CallHomeReporterTest do
143148
start_supervised!({ElectricTelemetry.StackTelemetry, ctx.telemetry_opts})
144149

145150
assert_receive :bypass_done, 500
151+
Bypass.pass(ctx.bypass)
146152
end
147153

148154
defp add_bypass_expectation(%{bypass: bypass, telemetry_opts: telemetry_opts}, test_specific_fn) do

0 commit comments

Comments
 (0)