mirror of
https://github.com/esengine/DeepSeek-Reasonix.git
synced 2026-11-07 10:45:59 -10:00
Merge pull request #11889 from esengine/perf/boot-test-close-catalogs-before-tempdir
test(boot): close process-global catalogs before the temp dir is removed
This commit is contained in:
2 files changed
+10
-5
No files matched your search
@@ -9,6 +9,7 @@ import (
|
||||
|
||||
"reasonix/internal/state/history"
|
||||
"reasonix/internal/state/historycatalog"
|
||||
"reasonix/internal/state/stats"
|
||||
)
|
||||
|
||||
// isolateConfigHome redirects user config and cache paths to a per-test temp
|
||||
@@ -36,6 +37,9 @@ func closeBootTestHistoryCatalog(t *testing.T) {
|
||||
if err := history.CloseSharedCatalog(ctx); err != nil {
|
||||
t.Fatalf("close shared history catalog: %v", err)
|
||||
}
|
||||
if err := stats.CloseUsageCatalogs(ctx); err != nil {
|
||||
t.Fatalf("close usage catalogs: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// fenceBootTestHistoryCatalog releases a process-global projection inherited
|
||||
|
||||
@@ -6,11 +6,12 @@ import (
|
||||
"reasonix/internal/base/testenv"
|
||||
)
|
||||
|
||||
// robustTempDir is the name boot's call sites already use for testenv.TempDir,
|
||||
// whose cleanup retries RemoveAll. Teardown here can leave a job goroutine or an
|
||||
// MCP writer holding a file for a few milliseconds after Close returns, which
|
||||
// plain t.TempDir turns into a red test with every assertion passed.
|
||||
// robustTempDir is testenv.TempDir, whose cleanup retries RemoveAll for
|
||||
// handles that outlive Close by milliseconds. The process-global catalogs are
|
||||
// closed first: an open SQLite file outlasts every retry on Windows.
|
||||
func robustTempDir(t *testing.T) string {
|
||||
t.Helper()
|
||||
return testenv.TempDir(t)
|
||||
dir := testenv.TempDir(t)
|
||||
t.Cleanup(func() { closeBootTestHistoryCatalog(t) })
|
||||
return dir
|
||||
}
|
||||
Reference in new issue
Block a user