Skip to content

Remove the temporary TOML and PEM files tests leave behind #2907

Closed

Description

@josecelano-bot

Parent EPIC: #2392

Goal

The configuration-file tests and the TLS tests remove every temporary file they create, on success, failure and drop paths.

This issue was narrowed on 2026-11-17. It first covered three leaks. The SQLite database leak (data_*.db) turned out to be larger than one issue and moved to #2924 and #2925.

Background

The shared-resource audit (#2394, finding F2) found test helpers that write files to std::env::temp_dir() with unique names and never remove them, or only when the test passes. This issue keeps two of them:

  • The configuration-file tests in packages/configuration/src/{v2_0_0,v3_0_0}/mod.rs: test_config_<uuid>.toml, never removed.
  • make_temp_file in packages/axum-server/src/tls.rs: <prefix>-<nanoseconds>.pem, removed only when the test passes.

The names are unique, so runs do not collide; the problem is accumulation. On one development machine, /tmp held 1,590 test_config_*.toml files.

Approach

Each test owns its file through a guard that removes it on drop. Proposed, to be confirmed by the maintainer: each configuration-file test writes inside its own tempfile::tempdir(), and make_temp_file returns a tempfile::NamedTempFile. Deleting files already leaked on a machine is out of scope.

Tasks

  • Reproduce: count the files one full test run leaves in a fresh TMPDIR.
  • Configuration-file tests: the file is removed when the test ends.
  • TLS tests: the files are removed when the test fails too.
  • Recheck: a full run leaves no test_config_*.toml and no PEM file.

The full specification is in docs/issues/open/2907-2392-remove-leaked-test-temporary-files/ISSUE.md.

Activity

  1. added 3 commits that reference this issue on Nov 17, 2026
  2. added a commit that references this issue on Nov 17, 2026
  3. self-assigned this
    on Nov 17, 2026
  4. changed the title [-]Remove the temporary files tests leave behind[/-] [+]Remove the temporary TOML and PEM files tests leave behind[/+] on Nov 17, 2026
  5. added 5 commits that reference this issue on Nov 17, 2026
  6. added 2 commits that reference this issue on Nov 17, 2026
  7. added a commit that references this issue on Nov 17, 2026
  8. 6 remaining items

  9. added 3 commits that reference this issue on Nov 18, 2026
  10. added 4 commits that reference this issue on Nov 18, 2026
  11. added a commit that references this issue on Nov 18, 2026
  12. added a commit that references this issue on Nov 18, 2026
  13. added 2 commits that reference this issue on Nov 18, 2026
  14. added a commit that references this issue on Nov 18, 2026
  15. added 2 commits that reference this issue on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions