diff --git a/test/seeds_test.exs b/test/seeds_test.exs index c729dbb..2721d13 100644 --- a/test/seeds_test.exs +++ b/test/seeds_test.exs @@ -24,21 +24,11 @@ defmodule Mv.SeedsTest do require Ash.Query - # Module attribute to track if seeds have been run - # This allows us to run seeds once per test module while respecting sandbox isolation - @seeds_run_key :seeds_test_run - setup do system_actor = Mv.Helpers.SystemActor.get_system_actor() - # 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 - Code.eval_file("priv/repo/seeds.exs") - Process.put(@seeds_run_key, true) - end + # Each test runs in its own sandbox-owned process, so seeds are loaded once per test. + Code.eval_file("priv/repo/seeds.exs") %{actor: system_actor} end