Skip to content

Commit

Permalink
Fix race condition in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatanklosko committed Sep 6, 2024
1 parent 4ede27c commit 94f7d3f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/livebook_web/live/session_live_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2122,6 +2122,12 @@ defmodule LivebookWeb.SessionLiveTest do
# Use the standalone runtime, to encapsulate env var changes
Session.set_runtime(session.pid, Runtime.Standalone.new())

# We start the runtime before adding the env var setting,
# otherwise a concurrent embedded runtime server could set PATH
# in this node and the standalone runtime would inherit it
Session.subscribe(session.id)
connect_and_await_runtime(session.pid)

separator =
case :os.type() do
{:win32, _} -> ";"
Expand All @@ -2134,7 +2140,6 @@ defmodule LivebookWeb.SessionLiveTest do
attrs = params_for(:env_var, name: "PATH", value: tmp_dir)
Settings.set_env_var(attrs)

Session.subscribe(session.id)
{:ok, view, _} = live(conn, ~p"/sessions/#{session.id}")

section_id = insert_section(session.pid)
Expand Down

0 comments on commit 94f7d3f

Please sign in to comment.