Compile teams hub on test_helper.exs if available

This commit is contained in:
José Valim 2023-08-01 18:48:16 +02:00
parent 481d39d7ed
commit c404e817fb
2 changed files with 9 additions and 7 deletions

View file

@ -12,6 +12,12 @@ defmodule Livebook.TeamsServer do
System.get_env("TEAMS_PATH") != nil or File.exists?(@default_teams_dir)
end
def setup do
if available?() do
mix(%{"MIX_ENV" => "livebook"}, ["compile"])
end
end
def start(opts \\ []) do
GenServer.start(__MODULE__, opts, name: @name)
end
@ -32,13 +38,6 @@ defmodule Livebook.TeamsServer do
GenServer.call(@name, :fetch_node, @timeout)
end
def drop_database() do
app_port = GenServer.call(@name, :fetch_port)
state_env = GenServer.call(@name, :fetch_env)
app_port |> env(state_env) |> mix(["ecto.drop", "--quiet"])
end
# GenServer Callbacks
@impl true

View file

@ -50,6 +50,9 @@ Livebook.Hubs.Personal.update_hub(personal_hub, %{secret_key: secret_key})
# Always set the same offline team hub in tests
Livebook.HubHelpers.set_offline_hub()
# Compile anything pending on TeamsServer
Livebook.TeamsServer.setup()
erl_docs_available? = Code.fetch_docs(:gen_server) != {:error, :chunk_not_found}
windows? = match?({:win32, _}, :os.type())