Repository navigation
test: serialise process-environment tests behind a shared guard - #100
Merged
Merged
Conversation
Unit tests that set POLYVOICE_* overrides raced under the default multi-threaded cargo test harness: the missing-cohort case observed the cohort set by the concurrent env-override case (about one run in four on the filtered suite). The comments assumed nextest process isolation, and the CI local-pipeline job papered over it with --test-threads=1. Add a crate-level test-only guard: one global mutex plus RAII undo that records the prior value of every variable it touches and restores it on drop, so a caller's shell environment survives the run. Route every env-mutating unit test and the env-reading tests they race with through it; the offline-failure cases clear the override under the lock so an inherited variable cannot flip them. Drop the single-thread workaround from CI so the parallel harness exercises the fix. Verified: 40/40 filtered and 10/10 full parallel runs of the pipeline-local+vbx lib suite, the cli-native lib suite, nextest on the env tests, clippy -D warnings on the touched feature sets.
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.
Problem
Unit tests that set
POLYVOICE_*overrides raced under the default multi-threadedcargo testharness. The missing-cohort case observed the cohort path set by the concurrent env-override case (about one filtered run in four locally). The comments assumed nextest process isolation, and the CI local-pipeline job hid the race with--test-threads=1.Change
src/test_env.rs: one global mutex plus an RAII guard whoseset/removerecord the prior value of every variable they touch and restore it on drop, so a caller's shell environment survives the run.clusterer_factoryandvbx_tests, PLDA-dir and AS-norm cohort overrides inbuilder_tests) now goes through the guard. The offline-failure and registry-only cases clear the override under the lock so an inherited variable cannot flip their outcome.pipeline-local,vbxlib run drops--test-threads=1so the parallel harness exercises the fix.Verification
load_as_norm_cohort*tests failed.pipeline-local,vbxlib suite green (876 tests);cli-nativelib suite green (922 tests).cargo nextest runon the env tests: 8/8.cargo clippy -D warningsclean oncli,cli-native,pipeline-local,vbx,clusterer,vbx, and no-default feature sets.--all-featuresis not buildable on the local host (no OpenBLAS) and is left to CI.