[test] Use anonymous inodes for temp DB files in snapshot and valset …#2146
Open
maxkozlovsky wants to merge 1 commit intomainfrom
Open
[test] Use anonymous inodes for temp DB files in snapshot and valset …#2146maxkozlovsky wants to merge 1 commit intomainfrom
maxkozlovsky wants to merge 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors test setup/teardown for on-disk DB snapshot/staking tests to use a temporary inode (via make_temporary_inode) and RAII helpers, reducing reliance on named temp files and manual cleanup.
Changes:
- Replace
mkstemp-based temp DB creation with an RAIITempDbthat usesmake_temporary_inode()and/proc/self/fd/<fd>. - Add RAII
TempDirfor snapshot directory lifecycle management in snapshot tests. - Adjust test fixtures to ensure correct destruction order when an FD must remain open.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
category/execution/monad/staking/test_read_valset.cpp |
Introduces TempDb RAII helper and switches staking valset tests to use an anonymous temporary inode-backed DB path. |
category/execution/ethereum/test/test_db_snapshot.cpp |
Introduces TempDb/TempDir RAII helpers and updates snapshot tests to use them instead of manual temp paths and cleanup. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
aebe5ce to
e42c375
Compare
…tests Replace named temp files (mkstemp + manual cleanup) with anonymous inodes via make_temporary_inode(), referenced through /proc/self/fd/<N>. Files are automatically reclaimed by the OS when the fd closes, even on crash or abort. Also replace hardcoded /tmp/snapshot paths with mkdtemp-based TempDir RAII to avoid conflicts between concurrent test runs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
e42c375 to
5db2a32
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…tests
Replace named temp files (mkstemp + manual cleanup) with anonymous inodes via make_temporary_inode(), referenced through /proc/self/fd/. Files are automatically reclaimed by the OS when the fd closes, even on crash or abort.
Also replace hardcoded /tmp/snapshot paths with mkdtemp-based TempDir RAII to avoid conflicts between concurrent test runs.