Repository navigation
Conversation
lforchini
force-pushed
the
test/test-utils
branch
from
October 1, 2026 14:48
f43cb7a to
ab409fb
Compare
lforchini
force-pushed
the
test/test-utils
branch
from
October 5, 2026 08:10
ab409fb to
fe70683
Compare
lforchini
marked this pull request as ready for review
October 5, 2026 08:26
lforchini
force-pushed
the
test/test-utils
branch
from
October 5, 2026 08:49
fe70683 to
720819d
Compare
lforchini
force-pushed
the
test/test-utils
branch
from
October 8, 2026 07:30
720819d to
d089b9e
Compare
lforchini
force-pushed
the
test/test-utils
branch
from
October 8, 2026 15:23
d089b9e to
dac3bf5
Compare
lforchini
force-pushed
the
test/test-utils
branch
from
October 13, 2026 12:43
dac3bf5 to
5589e2b
Compare
lforchini
force-pushed
the
test/test-utils
branch
from
October 13, 2026 13:18
5589e2b to
8cd23e7
Compare
lforchini
force-pushed
the
test/test-utils
branch
from
October 13, 2026 13:29
8cd23e7 to
92f2563
Compare
lforchini
force-pushed
the
test/test-utils
branch
from
October 13, 2026 14:02
92f2563 to
092480a
Compare
lforchini
force-pushed
the
test/test-utils
branch
from
October 23, 2026 08:24
092480a to
49b925f
Compare
lforchini
changed the base branch from
test/refactor-config-loading
to
fix-double-path-bug
October 23, 2026 08:44
lforchini
force-pushed
the
test/test-utils
branch
from
October 29, 2026 14:29
49b925f to
820794a
Compare
lforchini
force-pushed
the
test/test-utils
branch
from
October 30, 2026 10:49
820794a to
8e1fea1
Compare
lforchini
force-pushed
the
test/test-utils
branch
from
November 5, 2026 15:03
8e1fea1 to
142122f
Compare
lforchini
force-pushed
the
test/test-utils
branch
from
November 5, 2026 15:10
142122f to
1d9291e
Compare
lforchini
force-pushed
the
test/test-utils
branch
from
November 6, 2026 10:24
1d9291e to
d0f85dc
Compare
lforchini
force-pushed
the
test/test-utils
branch
2 times, most recently
from
November 13, 2026 09:38
c0d134f to
0e5f4de
Compare
Create a fixture which hooks into the custom-prefixed Path system, but doesn't require an env var to control it. Instead, unit tests can create a MockDir which will then act as the path prefix. It should still allow for multiple tests to be run at the same time as a thread_local is used to store the prefix. Signed-off-by: Leonardo Forchini <leonardo.forchini@nutanix.com>
lforchini
force-pushed
the
test/test-utils
branch
from
November 13, 2026 09:55
0e5f4de to
8aa766e
Compare
tmakatos
reviewed
Nov 13, 2026
tmakatos
left a comment
Collaborator
There was a problem hiding this comment.
Can you reword the commit message to state first what the problem is?
| pub static ROOT_OVERRIDE: RefCell<Option<PathBuf>> = const { RefCell::new(None) }; | ||
| } | ||
|
|
||
| /// Scoped root override for tests that access absolute paths through |
Collaborator
There was a problem hiding this comment.
I don't get what you mean by "scoped" here.
| // | ||
| // Author: Leonardo Forchini <leonardo.forchini@nutanix.com> | ||
| // | ||
| //! `tempfile::TempDir` wrapper which controls the prefix of `util::Path`s. |
Collaborator
There was a problem hiding this comment.
Could you elaborate? How does it control it? Why is it needed? What's the use case?
| } | ||
|
|
||
| /// Override the root used by `util::Path` on the current test thread. | ||
| pub(crate) fn override_root(root: impl Into<PathBuf>) -> RootOverride { |
Collaborator
There was a problem hiding this comment.
I presume this replaces the first absolute component with root?
| } | ||
|
|
||
| /// Override the root used by `util::Path` on the current test thread. | ||
| pub(crate) fn override_root(root: impl Into<PathBuf>) -> RootOverride { |
Collaborator
There was a problem hiding this comment.
Also, why is this a free function and not in impl MockDir?
| engines::{EngineTickContext, ScalingEngine}, | ||
| instance::{InstanceClient, ThreadPoolSnapshot}, | ||
| per_vm_log::PerVmLog, | ||
| test::MockDir, |
Collaborator
There was a problem hiding this comment.
nit, test::{MockDir, mockdir::mockdir}
| } | ||
|
|
||
| static IO_THREAD_CONTROLLER_ROOT_PATH: LazyLock<std::path::PathBuf> = LazyLock::new(|| { | ||
| static ROOT_PATH: LazyLock<std::path::PathBuf> = LazyLock::new(|| { |
| ) | ||
| }); | ||
|
|
||
| /// Returns the path new `util::Path`s will have prefixed. In non-test |
Collaborator
There was a problem hiding this comment.
I don't understand this sentence.
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.
Create a fixture which hooks into the custom-prefixed Path system, but
doesn't require an env var to control it. Instead, unit tests can create
a MockDir which will then act as the path prefix.
It should still allow for multiple tests to be run at the same time as
a thread_local is used to store the prefix.
Signed-off-by: Leonardo Forchini leonardo.forchini@nutanix.com
Stack created with GitHub Stacks CLI • Give Feedback 💬