Skip to content

Commit f09b71b

Browse files
author
Leandro Serra
committed
fix fork_choice.ex tests were flaky because env var cleanup was not done
in fails
1 parent 9aa4202 commit f09b71b

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

test/spec/runners/sync.ex

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ defmodule SyncTestRunner do
3232
def run_test_case(%SpecTestCase{} = testcase) do
3333
original_engine_api_config = Application.fetch_env!(:lambda_ethereum_consensus, EngineApi)
3434

35+
on_exit(fn ->
36+
Application.put_env(
37+
:lambda_ethereum_consensus,
38+
EngineApi,
39+
original_engine_api_config
40+
)
41+
end)
42+
3543
Application.put_env(
3644
:lambda_ethereum_consensus,
3745
EngineApi,
@@ -41,13 +49,6 @@ defmodule SyncTestRunner do
4149
{:ok, _pid} = SyncTestRunner.EngineApiMock.start_link([])
4250

4351
ForkChoiceTestRunner.run_test_case(testcase)
44-
45-
# TODO: we should do this cleanup even if the test crashes/fails
46-
Application.put_env(
47-
:lambda_ethereum_consensus,
48-
EngineApi,
49-
original_engine_api_config
50-
)
5152
end
5253
end
5354

0 commit comments

Comments
 (0)