mirror of
https://github.com/plausible/analytics.git
synced 2024-12-23 17:44:43 +03:00
0d6bec1bbe
* Expose site limit, usage, ensure_can_add_new_site via Adapter * Print to stdout if TEST_READ_TEAM_SCHEMAS is enabled * Add factory wrappers for remaining subscription types * Ensure consistent ordering when fetching latest subscription * Switch creating new site to read team schemas * Dedup code based on read team schemas switching * Switch to transitional factory where necessary * Update yet another test requiring transitional factory
37 lines
1.2 KiB
Elixir
37 lines
1.2 KiB
Elixir
if not Enum.empty?(Path.wildcard("lib/**/*_test.exs")) do
|
|
raise "Oops, test(s) found in `lib/` directory. Move them to `test/`."
|
|
end
|
|
|
|
{:ok, _} = Application.ensure_all_started(:ex_machina)
|
|
Mox.defmock(Plausible.HTTPClient.Mock, for: Plausible.HTTPClient.Interface)
|
|
Application.ensure_all_started(:double)
|
|
|
|
FunWithFlags.enable(:channels)
|
|
# Temporary flag to test `read_team_schemas` flag on all tests.
|
|
if System.get_env("TEST_READ_TEAM_SCHEMAS") == "1" do
|
|
IO.puts("READS TEAM SCHEMAS")
|
|
FunWithFlags.enable(:read_team_schemas)
|
|
else
|
|
FunWithFlags.disable(:read_team_schemas)
|
|
end
|
|
|
|
Ecto.Adapters.SQL.Sandbox.mode(Plausible.Repo, :manual)
|
|
|
|
# warn about minio if it's included in tests but not running
|
|
if :minio in Keyword.fetch!(ExUnit.configuration(), :include) do
|
|
Plausible.TestUtils.ensure_minio()
|
|
end
|
|
|
|
default_exclude = [:slow, :minio, :migrations]
|
|
|
|
# avoid slowdowns contacting the code server https://github.com/sasa1977/con_cache/pull/79
|
|
:code.ensure_loaded(ConCache.Lock.Resource)
|
|
|
|
if Mix.env() == :ce_test do
|
|
IO.puts("Test mode: Community Edition")
|
|
ExUnit.configure(exclude: [:ee_only | default_exclude])
|
|
else
|
|
IO.puts("Test mode: Enterprise Edition")
|
|
ExUnit.configure(exclude: [:ce_build_only | default_exclude])
|
|
end
|