From d17162295e88ffba6796de49e6ae0661aa07a8ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonatan=20K=C5=82osko?= Date: Sat, 12 Jul 2025 09:15:22 +0200 Subject: [PATCH] Fix test failing because of concurrent compilation --- config/test.exs | 9 +-------- lib/livebook/application.ex | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/config/test.exs b/config/test.exs index cc5a3791f..ec9f7b41f 100644 --- a/config/test.exs +++ b/config/test.exs @@ -32,15 +32,8 @@ config :livebook, check_completion_data_interval: 300, iframe_port: 4003 -data_path = Path.expand("tmp/livebook_data/test") - -# Clear data path for tests -if File.exists?(data_path) do - File.rm_rf!(data_path) -end - config :livebook, - data_path: data_path, + data_path: Path.expand("tmp/livebook_data/test"), agent_name: "chonky-cat", k8s_kubeconfig_pipeline: {Kubereq.Kubeconfig.Stub, diff --git a/lib/livebook/application.ex b/lib/livebook/application.ex index bb9a9fa15..f17abd384 100644 --- a/lib/livebook/application.ex +++ b/lib/livebook/application.ex @@ -4,6 +4,8 @@ defmodule Livebook.Application do require Logger def start(_type, _args) do + setup_tests() + Logger.add_handlers(:livebook) Livebook.ZTA.init() create_teams_hub = parse_teams_hub() @@ -432,4 +434,16 @@ defmodule Livebook.Application do defp serverless?() do Application.get_env(:livebook, :serverless, false) end + + if Mix.env() == :test do + defp setup_tests() do + data_path = Livebook.Config.data_path() + # Clear data path for tests + if File.exists?(data_path) do + File.rm_rf!(data_path) + end + end + else + defp setup_tets(), do: :ok + end end