mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-09-05 20:44:30 +08:00
Compile teams hub on test_helper.exs if available
This commit is contained in:
parent
481d39d7ed
commit
c404e817fb
2 changed files with 9 additions and 7 deletions
|
@ -12,6 +12,12 @@ defmodule Livebook.TeamsServer do
|
||||||
System.get_env("TEAMS_PATH") != nil or File.exists?(@default_teams_dir)
|
System.get_env("TEAMS_PATH") != nil or File.exists?(@default_teams_dir)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def setup do
|
||||||
|
if available?() do
|
||||||
|
mix(%{"MIX_ENV" => "livebook"}, ["compile"])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def start(opts \\ []) do
|
def start(opts \\ []) do
|
||||||
GenServer.start(__MODULE__, opts, name: @name)
|
GenServer.start(__MODULE__, opts, name: @name)
|
||||||
end
|
end
|
||||||
|
@ -32,13 +38,6 @@ defmodule Livebook.TeamsServer do
|
||||||
GenServer.call(@name, :fetch_node, @timeout)
|
GenServer.call(@name, :fetch_node, @timeout)
|
||||||
end
|
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
|
# GenServer Callbacks
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
|
|
|
@ -50,6 +50,9 @@ Livebook.Hubs.Personal.update_hub(personal_hub, %{secret_key: secret_key})
|
||||||
# Always set the same offline team hub in tests
|
# Always set the same offline team hub in tests
|
||||||
Livebook.HubHelpers.set_offline_hub()
|
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}
|
erl_docs_available? = Code.fetch_docs(:gen_server) != {:error, :chunk_not_found}
|
||||||
|
|
||||||
windows? = match?({:win32, _}, :os.type())
|
windows? = match?({:win32, _}, :os.type())
|
||||||
|
|
Loading…
Add table
Reference in a new issue