huskies: merge 1111 bug Test isolation: init_for_test() and ensure_content_store() are once-per-thread, not once-per-test, polluting CRDT state across tests

This commit is contained in:
dave
2026-05-17 00:28:48 +00:00
parent f8212f102f
commit a40500eea9
9 changed files with 111 additions and 36 deletions
+1
View File
@@ -86,6 +86,7 @@ mod tests {
use crate::http::test_helpers::test_ctx;
fn setup_git_repo_in(dir: &std::path::Path) {
crate::db::ensure_content_store();
std::process::Command::new("git")
.args(["init"])
.current_dir(dir)
@@ -115,6 +115,7 @@ mod tests {
#[test]
fn tool_create_refactor_accepts_single_criterion() {
crate::db::ensure_content_store();
let tmp = tempfile::tempdir().unwrap();
let ctx = test_ctx(tmp.path());
let result = tool_create_refactor(
@@ -146,6 +147,7 @@ mod tests {
#[test]
fn tool_create_refactor_accepts_mixed_junk_and_real_acceptance_criteria() {
crate::db::ensure_content_store();
let tmp = tempfile::tempdir().unwrap();
let ctx = test_ctx(tmp.path());
let result = tool_create_refactor(
+4
View File
@@ -118,6 +118,7 @@ mod tests {
#[test]
fn tool_create_spike_creates_file() {
crate::db::ensure_content_store();
let tmp = tempfile::tempdir().unwrap();
let ctx = test_ctx(tmp.path());
@@ -147,6 +148,7 @@ mod tests {
#[test]
fn tool_create_spike_creates_file_without_description() {
crate::db::ensure_content_store();
let tmp = tempfile::tempdir().unwrap();
let ctx = test_ctx(tmp.path());
@@ -202,6 +204,7 @@ mod tests {
#[test]
fn tool_create_spike_accepts_single_criterion() {
crate::db::ensure_content_store();
let tmp = tempfile::tempdir().unwrap();
let ctx = test_ctx(tmp.path());
let result = tool_create_spike(
@@ -233,6 +236,7 @@ mod tests {
#[test]
fn tool_create_spike_accepts_mixed_junk_and_real_acceptance_criteria() {
crate::db::ensure_content_store();
let tmp = tempfile::tempdir().unwrap();
let ctx = test_ctx(tmp.path());
let result = tool_create_spike(
@@ -256,6 +256,7 @@ mod tests {
#[test]
fn tool_create_story_accepts_single_criterion() {
crate::db::ensure_content_store();
let tmp = tempfile::tempdir().unwrap();
let ctx = test_ctx(tmp.path());
let result = tool_create_story(
@@ -283,6 +284,7 @@ mod tests {
#[test]
fn tool_create_story_accepts_mixed_junk_and_real_acceptance_criteria() {
crate::db::ensure_content_store();
let tmp = tempfile::tempdir().unwrap();
let ctx = test_ctx(tmp.path());
let result = tool_create_story(
@@ -299,6 +301,7 @@ mod tests {
#[test]
fn tool_create_story_description_is_written_to_file() {
crate::db::ensure_content_store();
let tmp = tempfile::tempdir().unwrap();
let ctx = test_ctx(tmp.path());
@@ -368,6 +371,7 @@ mod tests {
#[test]
fn tool_create_story_html_sanitised_in_name() {
crate::db::ensure_content_store();
let tmp = tempfile::tempdir().unwrap();
let ctx = test_ctx(tmp.path());
// HTML in name is sanitised (not rejected)
@@ -124,6 +124,7 @@ mod tests {
#[test]
fn tool_create_story_and_list_upcoming() {
crate::db::ensure_content_store();
let tmp = tempfile::tempdir().unwrap();
// No git repo needed: spike 61 — create_story just writes the file;
// the filesystem watcher handles the commit asynchronously.