Clean up acceptance LevelDB temp dirs

Each psf-memo-db acceptance scenario opened an isolated LevelDB directory
but close() only closed the handles, so tmp/acceptance grew without bound
(found at 961 dirs / 293 MB). Delete the scenario dir in close() and sweep
tmp/acceptance at the start of the acceptance run.

By specifier.
This commit is contained in:
Chris Troutner
2026-09-15 17:40:10 -07:00
parent 0bc73ec072
commit eb308d2f49
2 changed files with 19 additions and 0 deletions
+12
View File
@@ -33,7 +33,19 @@ function ensureAps () {
'https://github.com/unclebob/Acceptance-Pipeline-Specification.git', apsDir])
}
// Each scenario opens an isolated LevelDB directory under tmp/acceptance.
// Remove leftovers from earlier runs (including pre-fix runs that leaked them)
// so the directory cannot grow without bound.
function cleanStaleWorlds () {
try {
fs.rmSync(path.join(root, 'tmp', 'acceptance'), { recursive: true, force: true })
} catch (err) {
// ignore cleanup errors
}
}
function main () {
cleanStaleWorlds()
ensureAps()
const features = fs
+7
View File
@@ -152,6 +152,13 @@ async function createWorld () {
} catch (err) {
// ignore close errors
}
// Each scenario opens an isolated LevelDB directory. Remove it here so
// tmp/acceptance cannot grow without bound across runs.
try {
fs.rmSync(levelDir, { recursive: true, force: true })
} catch (err) {
// ignore cleanup errors
}
}
}
}