Skip to content

Commit 332ba75

Browse files
committed
test(pi-shell): give the consent test the default serial key of the GROK_HOME tests
`set_consent_answer_is_monotonic_per_account` set GROK_HOME under the named key `serial(GROK_HOME)`. `EnvGuard` has no lock of its own, and every other test that sets GROK_HOME uses the default `serial` key, so only the consent test could run at the same time as the tests that read GROK_HOME without a guard (`session::worktree::tests::resolve_worktree_by_id_or_path_*`). When the two overlapped, the worktree test opened `worktrees.db` in the temporary home of the consent test. The consent test then deleted that home at its end, and the open connection failed with SQLite error 1802 ("disk I/O error", a failed stat of the database file). An LD_PRELOAD trace of one failing run showed it: the worktree test's thread opened `<tmp>/worktrees.db`, a thread that ran the consent test removed the directory 130 ms later, and no `fstat` call failed. Before the fix the failure was deterministic in the full lib run with 12 test threads; at 4 threads it did not appear. The fix is one attribute. No production code changes.
1 parent 5a39e09 commit 332ba75

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎tui/crates/codegen/pi-shell/src/util/config/consent_tests.rs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,12 @@ account = "[email protected]"
3030
assert_eq!(reparsed, consent);
3131
}
3232

33+
// The default `serial` key, like every other test that sets `GROK_HOME`. `EnvGuard` has no lock of
34+
// its own: a named key lets this test run at the same time as the tests that read `GROK_HOME`
35+
// (for example `session::worktree`), and they then open their files in the temporary home that
36+
// this test deletes at its end.
3337
#[tokio::test]
34-
#[serial_test::serial(GROK_HOME)]
38+
#[serial_test::serial]
3539
async fn set_consent_answer_is_monotonic_per_account() {
3640
let home = tempfile::tempdir().expect("home");
3741
let _guard = pi_test_support::env::EnvGuard::set("GROK_HOME", home.path());

0 commit comments

Comments
 (0)