Expand description
Shared test-only utilities.
Multiple modules’ tests mutate process-global environment variables
(HOME, SHINE_CONFIG_DIR, SHINE_PRESETS) to control config/preset
resolution. A single crate-wide lock serialises these mutations so
tests in different modules don’t race on the shared process environment
when cargo test runs unit tests in parallel.
Structs§
- Admin
Category Test Lock Guard - Some embedded app categories (e.g.
docker-engine) install to a real, absolute system path (/etc/docker/daemon.json) rather than one scoped under the test’s temporaryHOME.cargo nextestruns each test in its own OS process, soenv_lock()— a single-processMutex— cannot prevent two such test processes from racing on that one real, shared file. Tests that install/uninstall the full embedded category set must hold this cross-process lock for their entire body.
Functions§
- admin_
category_ test_ lock - env_
lock - make_
temp_ dir - Creates and returns a uniquely-named temp directory under the OS temp dir.
- restore_
current_ dir - Restores the process’s current directory, for tests that temporarily
set_current_dirto exercise relative-path resolution. - test_
config - A
Configrooted atdir, for tests that don’t need a separatehomesubdirectory.config::test_util::config_inis a distinct homed variant (it additionally rootshome_dirunderdir.join("home")) and stays separate from this one.