fix existing flakiness + cut runtime closes #533 #544

Merged
moritz merged 11 commits from issue/mitgliederverwaltung-533 into main 2026-06-16 18:30:14 +02:00
Showing only changes of commit 3bd55fbfec - Show all commits

View file

@ -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