Skip to content

Commit d171622

Browse files
committed
Fix test failing because of concurrent compilation
1 parent d0e493e commit d171622

2 files changed

Lines changed: 15 additions & 8 deletions

File tree

config/test.exs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,8 @@ config :livebook,
3232
check_completion_data_interval: 300,
3333
iframe_port: 4003
3434

35-
data_path = Path.expand("tmp/livebook_data/test")
36-
37-
# Clear data path for tests
38-
if File.exists?(data_path) do
39-
File.rm_rf!(data_path)
40-
end
41-
4235
config :livebook,
43-
data_path: data_path,
36+
data_path: Path.expand("tmp/livebook_data/test"),
4437
agent_name: "chonky-cat",
4538
k8s_kubeconfig_pipeline:
4639
{Kubereq.Kubeconfig.Stub,

lib/livebook/application.ex

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ defmodule Livebook.Application do
44
require Logger
55

66
def start(_type, _args) do
7+
setup_tests()
8+
79
Logger.add_handlers(:livebook)
810
Livebook.ZTA.init()
911
create_teams_hub = parse_teams_hub()
@@ -432,4 +434,16 @@ defmodule Livebook.Application do
432434
defp serverless?() do
433435
Application.get_env(:livebook, :serverless, false)
434436
end
437+
438+
if Mix.env() == :test do
439+
defp setup_tests() do
440+
data_path = Livebook.Config.data_path()
441+
# Clear data path for tests
442+
if File.exists?(data_path) do
443+
File.rm_rf!(data_path)
444+
end
445+
end
446+
else
447+
defp setup_tets(), do: :ok
448+
end
435449
end

0 commit comments

Comments
 (0)