fix: clean stale test data before each suite run
Some checks failed
Build and Push / Build and Push Docker Image (push) Has been cancelled
Some checks failed
Build and Push / Build and Push Docker Image (push) Has been cancelled
Rows left behind by a crashed/killed prior run persist because sandbox on_exit callbacks don't fire on BEAM crash or SIGKILL. Wipe known test-data tables (contacts, hrrr_fetch_tasks, iemre_observations, oban_jobs) after app boot so every suite starts clean regardless of previous run state.
This commit is contained in:
parent
581955bd69
commit
d35239ba1e
1 changed files with 8 additions and 0 deletions
|
|
@ -39,6 +39,14 @@ end
|
|||
# DBConnection.Ownership from the app env and initializes with it.
|
||||
{:ok, _} = Application.ensure_all_started(:microwaveprop)
|
||||
|
||||
# Clean up any rows left behind by a crashed or killed prior run.
|
||||
# The sandbox rolls back per-test, but if the suite itself crashes
|
||||
# mid-run, committed data persists and causes count-mismatch failures
|
||||
# in the next run. Wipe known test-data tables before each suite.
|
||||
for table <- ~w(contacts hrrr_fetch_tasks iemre_observations oban_jobs) do
|
||||
Microwaveprop.Repo.delete_all(table)
|
||||
end
|
||||
|
||||
# stream_data is a test-only dep — its ebin is on the code path from the
|
||||
# wildcard above, but the application isn't started. `check all` etc.
|
||||
# call Application.fetch_env!(:stream_data, :initial_size), which needs
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue