about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/search/native.rs15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/search/native.rs b/src/search/native.rs
index 76acbc2..6e5dab4 100644
--- a/src/search/native.rs
+++ b/src/search/native.rs
@@ -911,18 +911,15 @@ mod tests {
     /// The C3.6 engine guard: the sentinel anywhere in the parsed query
     /// surfaces as InvalidQuery BEFORE the index is opened — so the
     /// invalid-location class reports as a query fault (the blessed 422)
-    /// even with no index configured, mirroring gn3's parse-before-open
-    /// order (search.py:291 vs :296).
+    /// whatever `XAPIAN_DB_PATH` holds, mirroring gn3's parse-before-open
+    /// order (search.py:291 vs :296). The error VARIANT is the proof:
+    /// an unset path would surface as Internal and an unopenable one as
+    /// Unreachable if the query ever reached the index. No environment
+    /// is touched: this test runs in the lib binary next to the config
+    /// tests, which mutate `XAPIAN_DB_PATH` on their own threads.
     #[test]
     fn hs_mm_engine_guard_fires_before_the_index() {
-        let prior = std::env::var("XAPIAN_DB_PATH").ok();
-        // SAFETY: hermetic single-threaded unit test; restored below.
-        unsafe { std::env::set_var("XAPIAN_DB_PATH", "") };
         let outcome = futures_of_native_guard("Hs:foo:1M");
-        match prior {
-            Some(value) => unsafe { std::env::set_var("XAPIAN_DB_PATH", value) },
-            None => unsafe { std::env::remove_var("XAPIAN_DB_PATH") },
-        }
         assert!(
             matches!(outcome, Err(SearchError::InvalidQuery { .. })),
             "the guard must report InvalidQuery before the index is touched"