Repository navigation
Conversation
f43cb7a to
ab409fb
Compare
74da0ec to
703d3ea
Compare
ab409fb to
fe70683
Compare
703d3ea to
91e6361
Compare
fe70683 to
720819d
Compare
91e6361 to
8edfe60
Compare
720819d to
d089b9e
Compare
8edfe60 to
9c5ecd0
Compare
9c5ecd0 to
ecb32ff
Compare
d089b9e to
dac3bf5
Compare
ecb32ff to
afac66f
Compare
dac3bf5 to
5589e2b
Compare
afac66f to
f1b373f
Compare
5589e2b to
8cd23e7
Compare
f1b373f to
c353351
Compare
8cd23e7 to
92f2563
Compare
c353351 to
31314b7
Compare
92f2563 to
092480a
Compare
49b925f to
820794a
Compare
82c32e8 to
7628305
Compare
7628305 to
fc21251
Compare
820794a to
8e1fea1
Compare
fc21251 to
e5ce185
Compare
8e1fea1 to
142122f
Compare
e5ce185 to
7923751
Compare
142122f to
1d9291e
Compare
7923751 to
be6f7e9
Compare
1d9291e to
d0f85dc
Compare
0e5f4de to
8aa766e
Compare
tmakatos
left a comment
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 |
There was a problem hiding this comment.
I don't get what you mean by "scoped" here.
There was a problem hiding this comment.
The per-thread prefix is only overwritten for as long as this guard exists so I think scoped is the right word here.
| } | ||
|
|
||
| /// Override the root used by `util::Path` on the current test thread. | ||
| pub(crate) fn override_root(root: impl Into<PathBuf>) -> RootOverride { |
There was a problem hiding this comment.
I presume this replaces the first absolute component with root?
There was a problem hiding this comment.
It doesn't replace the first component, it changes what the thread local override is and new paths will be prefixed with root. I've updated the comment to clarify.
| } | ||
|
|
||
| /// Override the root used by `util::Path` on the current test thread. | ||
| pub(crate) fn override_root(root: impl Into<PathBuf>) -> RootOverride { |
There was a problem hiding this comment.
Also, why is this a free function and not in impl MockDir?
There was a problem hiding this comment.
It's independent of MockDir. It doesn't need to be pub(crate) so I've dropped that.
4f1c2af to
79bf436
Compare
Ensure concurrently running unit tests get independent temporary working directories. Previously, a process-wide static would make all paths use the same prefix, causing unit tests to share a working directory. Create a fixture which hooks into the custom prefix Path system, but doesn't require an env var to control it. Instead, unit tests can create a MockDir which will then control the path prefix. Signed-off-by: Leonardo Forchini <leonardo.forchini@nutanix.com>
Signed-off-by: Leonardo Forchini <leonardo.forchini@nutanix.com>
e5165cc to
283d368
Compare
Ensure concurrently running unit tests get independent temporary working
directories. Previously, a process-wide static would make all paths use
the same prefix, causing unit tests to share a working directory.
Create a fixture which hooks into the custom prefix Path system, but
doesn't require an env var to control it. Instead, unit tests can create
a MockDir which will then control the path prefix.
Signed-off-by: Leonardo Forchini leonardo.forchini@nutanix.com