diff --git a/.changeset/fix-telemetry-test-isolation.md b/.changeset/fix-telemetry-test-isolation.md new file mode 100644 index 0000000000..c783d48838 --- /dev/null +++ b/.changeset/fix-telemetry-test-isolation.md @@ -0,0 +1,5 @@ +--- +"@core/sync-service": patch +--- + +Test-only: make the StackSupervisor telemetry test synchronous to avoid serve_shape counter contamination from concurrently running tests. No runtime changes. diff --git a/packages/sync-service/test/electric/stack_supervisor/telemetry_test.exs b/packages/sync-service/test/electric/stack_supervisor/telemetry_test.exs index 0b658eae75..5c543abf87 100644 --- a/packages/sync-service/test/electric/stack_supervisor/telemetry_test.exs +++ b/packages/sync-service/test/electric/stack_supervisor/telemetry_test.exs @@ -1,6 +1,10 @@ if Electric.telemetry_enabled?() and Code.ensure_loaded?(ElectricTelemetry.Reporters.Prometheus) do defmodule Electric.StackSupervisor.TelemetryTest do - use ExUnit.Case, async: true + # Not async: the Prometheus reporter attaches a global :telemetry handler for + # [:electric, :plug, :serve_shape], so concurrent async tests that emit that + # event (via the real serve_shape plug) leak into this reporter's per-status + # counters and make the exact-count assertions below non-deterministic. + use ExUnit.Case, async: false alias Electric.StackSupervisor.Telemetry