Skip to content

Commit 34bc389

Browse files
committed
Skip Repatch for Oracle tests
1 parent 04523da commit 34bc389

File tree

1 file changed

+38
-29
lines changed

1 file changed

+38
-29
lines changed

packages/sync-service/test/test_helper.exs

Lines changed: 38 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,35 +13,44 @@ ExUnit.start(assert_receive_timeout: 400, exclude: [:slow, :oracle], capture_log
1313
# causing a deadlock when OTP tries to start both applications.
1414
{:ok, _} = Electric.Client.Application.start(:normal, [])
1515

16+
skip_repatch_prewarm? = System.get_env("SKIP_REPATCH_PREWARM") == "true"
17+
1618
# Repatch in async tests has lazy recompilation issues, so as a temporary fix
1719
# we force recompilation in the setup. The issue is tracked here:
1820
# https://github.com/hissssst/repatch/issues/2
19-
Repatch.setup(
20-
recompile: [
21-
# IMPORTANT: When adding a new Repatch.patch(..., mode: :shared, ...) in any
22-
# test file, add the target module to this list. Omitting it causes rare async
23-
# test failures because Repatch recompiles modules on first patch, which
24-
# destroys Erlang trace patterns, invalidates ETS table references, and breaks
25-
# anonymous function closures in concurrent tests. Pre-warming here triggers
26-
# the recompilation once at startup so subsequent patches only update ETS hooks.
27-
Postgrex,
28-
Plug.Conn,
29-
Electric.StatusMonitor,
30-
Electric.Telemetry.Sampler,
31-
Electric.Connection.Manager,
32-
Electric.Connection.Restarter,
33-
Electric.Postgres.Configuration,
34-
Electric.Postgres.Inspector,
35-
Electric.Replication.PublicationManager,
36-
Electric.Replication.ShapeLogCollector,
37-
Electric.ShapeCache,
38-
Electric.ShapeCache.PureFileStorage,
39-
Electric.ShapeCache.ShapeCleaner,
40-
Electric.ShapeCache.ShapeStatus,
41-
Electric.ShapeCache.Storage,
42-
Electric.Shapes.Consumer.Snapshotter,
43-
Electric.Shapes.DynamicConsumerSupervisor,
44-
Electric.Shapes.Shape,
45-
:otel_tracer
46-
]
47-
)
21+
#
22+
# Repatch does slow down execution so if needed this prewarm can be skipped
23+
# by setting the SKIP_REPATCH_PREWARM environment variable to "true".
24+
# Skipping the prewarm is useful for the postgres oracle tests where performance
25+
# is critical for high load.
26+
if not skip_repatch_prewarm? do
27+
Repatch.setup(
28+
recompile: [
29+
# IMPORTANT: When adding a new Repatch.patch(..., mode: :shared, ...) in any
30+
# test file, add the target module to this list. Omitting it causes rare async
31+
# test failures because Repatch recompiles modules on first patch, which
32+
# destroys Erlang trace patterns, invalidates ETS table references, and breaks
33+
# anonymous function closures in concurrent tests. Pre-warming here triggers
34+
# the recompilation once at startup so subsequent patches only update ETS hooks.
35+
Postgrex,
36+
Plug.Conn,
37+
Electric.StatusMonitor,
38+
Electric.Telemetry.Sampler,
39+
Electric.Connection.Manager,
40+
Electric.Connection.Restarter,
41+
Electric.Postgres.Configuration,
42+
Electric.Postgres.Inspector,
43+
Electric.Replication.PublicationManager,
44+
Electric.Replication.ShapeLogCollector,
45+
Electric.ShapeCache,
46+
Electric.ShapeCache.PureFileStorage,
47+
Electric.ShapeCache.ShapeCleaner,
48+
Electric.ShapeCache.ShapeStatus,
49+
Electric.ShapeCache.Storage,
50+
Electric.Shapes.Consumer.Snapshotter,
51+
Electric.Shapes.DynamicConsumerSupervisor,
52+
Electric.Shapes.Shape,
53+
:otel_tracer
54+
]
55+
)
56+
end

0 commit comments

Comments
 (0)