Summary
Add unit tests that verify environment variable bindings correctly populate the corresponding configuration values.
Currently there are no tests covering env-var bindings for CLI arguments such as FACT_INODES_MAX, FACT_INODE_MAX (old name), and other env-vars mapped in FactCli. These were deferred because std::env::set_var is process-global and inherently racy when tests run in parallel under the same process.
Motivation
The rename of FACT_INODE_MAX → FACT_INODES_MAX in #729 highlighted the lack of test coverage for env-var bindings. A regression here (wrong env-var name in the #[arg(env = ...)] attribute) would not be caught by existing tests.
Suggested approach
- Serialize env-var tests using a shared
Mutex (or the serial_test crate) so they don't interfere with parallel tests.
- Alternatively, scope tests to run with
RUST_TEST_THREADS=1 or via a dedicated test binary target.
- At minimum, add coverage for
FACT_INODES_MAX populating bpf.inodes_max, and consider covering other env-var bindings in FactCli.
- Ensure each test cleans up the env var (e.g., via
std::env::remove_var) to prevent cross-test pollution.
References
/cc @Molter73
Summary
Add unit tests that verify environment variable bindings correctly populate the corresponding configuration values.
Currently there are no tests covering env-var bindings for CLI arguments such as
FACT_INODES_MAX,FACT_INODE_MAX(old name), and other env-vars mapped inFactCli. These were deferred becausestd::env::set_varis process-global and inherently racy when tests run in parallel under the same process.Motivation
The rename of
FACT_INODE_MAX→FACT_INODES_MAXin #729 highlighted the lack of test coverage for env-var bindings. A regression here (wrong env-var name in the#[arg(env = ...)]attribute) would not be caught by existing tests.Suggested approach
Mutex(or theserial_testcrate) so they don't interfere with parallel tests.RUST_TEST_THREADS=1or via a dedicated test binary target.FACT_INODES_MAXpopulatingbpf.inodes_max, and consider covering other env-var bindings inFactCli.std::env::remove_var) to prevent cross-test pollution.References
/cc @Molter73