2021-10-14 04:25:33 +08:00
|
|
|
# Start manager on the current node and configure it not to
|
|
|
|
# terminate automatically, so there is no race condition
|
|
|
|
# when starting/stopping Embedded runtimes in parallel
|
|
|
|
Livebook.Runtime.ErlDist.NodeManager.start(
|
|
|
|
auto_termination: false,
|
|
|
|
unload_modules_on_termination: false
|
|
|
|
)
|
|
|
|
|
2022-04-02 02:13:37 +08:00
|
|
|
# Use the embedded runtime in tests by default, so they are
|
|
|
|
# cheaper to run. Other runtimes can be tested by starting
|
|
|
|
# and setting them explicitly
|
|
|
|
Application.put_env(:livebook, :default_runtime, Livebook.Runtime.Embedded.new())
|
2023-02-16 20:47:46 +08:00
|
|
|
Application.put_env(:livebook, :default_app_runtime, Livebook.Runtime.Embedded.new())
|
2022-04-02 02:13:37 +08:00
|
|
|
|
2022-04-04 18:20:36 +08:00
|
|
|
Application.put_env(:livebook, :runtime_modules, [
|
|
|
|
Livebook.Runtime.ElixirStandalone,
|
|
|
|
Livebook.Runtime.Attached,
|
|
|
|
Livebook.Runtime.Embedded
|
|
|
|
])
|
|
|
|
|
2022-04-30 23:14:10 +08:00
|
|
|
defmodule Livebook.Runtime.Embedded.Packages do
|
|
|
|
def list() do
|
2022-04-02 02:13:37 +08:00
|
|
|
[
|
|
|
|
%{
|
2022-12-03 23:23:43 +08:00
|
|
|
dependency: %{dep: {:jason, "~> 1.3.0"}, config: []},
|
2022-04-29 19:45:33 +08:00
|
|
|
description: "A blazing fast JSON parser and generator in pure Elixir",
|
|
|
|
name: "jason",
|
|
|
|
url: "https://hex.pm/packages/jason",
|
|
|
|
version: "1.3.0"
|
2022-04-02 02:13:37 +08:00
|
|
|
}
|
|
|
|
]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# Enable dependency saerch for the embedded runtime
|
|
|
|
Application.put_env(:livebook, Livebook.Runtime.Embedded,
|
2022-04-30 23:14:10 +08:00
|
|
|
load_packages: {Livebook.Runtime.Embedded.Packages, :list, []}
|
2022-04-02 02:13:37 +08:00
|
|
|
)
|
|
|
|
|
2022-01-31 18:51:57 +08:00
|
|
|
# Disable autosaving
|
2022-10-07 01:53:37 +08:00
|
|
|
Livebook.Storage.insert(:settings, "global", autosave_path: nil)
|
2022-01-31 18:51:57 +08:00
|
|
|
|
2023-03-11 05:36:51 +08:00
|
|
|
# Always use the same secret key in tests
|
|
|
|
secret_key =
|
|
|
|
"5ji8DpnX761QAWXZwSl-2Y-mdW4yTcMimdOJ8SSxCh44wFE0jEbGBUf-VydKwnTLzBiAUedQKs3X_q1j_3lgrw"
|
|
|
|
|
|
|
|
personal_hub = Livebook.Hubs.fetch_hub!(Livebook.Hubs.Personal.id())
|
|
|
|
Livebook.Hubs.Personal.update_hub(personal_hub, %{secret_key: secret_key})
|
|
|
|
|
2021-04-21 01:34:17 +08:00
|
|
|
erl_docs_available? = Code.fetch_docs(:gen_server) != {:error, :chunk_not_found}
|
|
|
|
|
2023-03-08 21:05:41 +08:00
|
|
|
windows? = match?({:win32, _}, :os.type())
|
|
|
|
|
2022-10-11 22:27:27 +08:00
|
|
|
ExUnit.start(
|
2023-03-08 21:05:41 +08:00
|
|
|
assert_receive_timeout: if(windows?, do: 2_500, else: 1_500),
|
2023-01-26 03:40:14 +08:00
|
|
|
exclude: [
|
|
|
|
erl_docs: erl_docs_available?,
|
|
|
|
enterprise_integration: not Livebook.EnterpriseServer.available?()
|
|
|
|
]
|
2022-10-11 22:27:27 +08:00
|
|
|
)
|