refactor: apply review comments
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
858a0fc0d0
commit
6efad280bd
1 changed files with 5 additions and 2 deletions
|
|
@ -31,7 +31,10 @@ defmodule Mv.SeedsTest do
|
||||||
setup do
|
setup do
|
||||||
system_actor = Mv.Helpers.SystemActor.get_system_actor()
|
system_actor = Mv.Helpers.SystemActor.get_system_actor()
|
||||||
|
|
||||||
# Run seeds only once per test run (check process dictionary)
|
# Run seeds once per test process (due to sandbox isolation, each test runs in its own process)
|
||||||
|
# Process.get/put ensures seeds are only executed once per test process, not once per test
|
||||||
|
# Note: With async: false and sandbox isolation, this effectively runs seeds once per test,
|
||||||
|
# but the guard prevents multiple executions within the same test process if setup is called multiple times
|
||||||
unless Process.get(@seeds_run_key) do
|
unless Process.get(@seeds_run_key) do
|
||||||
Code.eval_file("priv/repo/seeds.exs")
|
Code.eval_file("priv/repo/seeds.exs")
|
||||||
Process.put(@seeds_run_key, true)
|
Process.put(@seeds_run_key, true)
|
||||||
|
|
@ -55,7 +58,7 @@ defmodule Mv.SeedsTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
test "is idempotent when run multiple times", %{actor: actor} do
|
test "is idempotent when run multiple times", %{actor: actor} do
|
||||||
# Seeds already run once in setup_all - count current state
|
# Seeds already run once in setup - count current state
|
||||||
{:ok, users_count_1} = Ash.read(Mv.Accounts.User, actor: actor)
|
{:ok, users_count_1} = Ash.read(Mv.Accounts.User, actor: actor)
|
||||||
{:ok, members_count_1} = Ash.read(Mv.Membership.Member, actor: actor)
|
{:ok, members_count_1} = Ash.read(Mv.Membership.Member, actor: actor)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue