Test runs leave their data directory in the system temp dir #8

Open
opened 2026-12-01 04:40:17 +00:00 by mercurius · 0 comments
Member

Purpose (fix): a test run leaves no data directory behind in the system temp dir.

Refs #4

The defect

config/runtime.exs:11-18 (main a93a8b7) points MCL_DATA_DIR at System.tmp_dir!()/mcl_bookclub_test_<unique> on every :test run, and nothing removes the directory. Each mix test leaves one behind: the facade's sqlite and, since #4 PR 1 (forge PR 7), the reckon-db store files too. They pile up on a developer's machine and on a long-lived runner.

Found by Uranus in the review of #4 PR 1.

Constraint

reckon-db binds one Ra system per store id to the directory it first opened, for the life of the VM (test/support/test_store.ex, PR 7). So the directory can only go once the VM's tests are done, never between modules.

Fix shape

Remove the directory once the whole run is finished. One way is ExUnit.after_suite/1 in each app's test_helper.exs, removing MCL_DATA_DIR when its basename carries the mcl_bookclub_test_ prefix runtime.exs gave it. The cleanup must never remove a directory that the test config did not create.

Done when

  • after mix test, umbrella or single app, no mcl_bookclub_test_* directory from that run is left in the temp dir
  • a non-test MCL_DATA_DIR is never touched
Purpose (fix): a test run leaves no data directory behind in the system temp dir. Refs #4 ## The defect `config/runtime.exs:11-18` (main a93a8b7) points `MCL_DATA_DIR` at `System.tmp_dir!()/mcl_bookclub_test_<unique>` on every `:test` run, and nothing removes the directory. Each `mix test` leaves one behind: the facade's sqlite and, since #4 PR 1 (forge PR 7), the reckon-db store files too. They pile up on a developer's machine and on a long-lived runner. Found by Uranus in the review of #4 PR 1. ## Constraint reckon-db binds one Ra system per store id to the directory it first opened, for the life of the VM (`test/support/test_store.ex`, PR 7). So the directory can only go once the VM's tests are done, never between modules. ## Fix shape Remove the directory once the whole run is finished. One way is `ExUnit.after_suite/1` in each app's `test_helper.exs`, removing `MCL_DATA_DIR` when its basename carries the `mcl_bookclub_test_` prefix runtime.exs gave it. The cleanup must never remove a directory that the test config did not create. ## Done when - [ ] after `mix test`, umbrella or single app, no `mcl_bookclub_test_*` directory from that run is left in the temp dir - [ ] a non-test `MCL_DATA_DIR` is never touched
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
macula-services/mcl-bookclub-phoenix#8
No description provided.