openvibers/openvibe.tools Commits

Tests: the per-app prune check reads rows with db.many (db.query returns a result, not an array); spawned apps get one PGlite directory each (observe.test.js ran img, text and yt on one DATA_DIR and PGlite, single-process, aborted)

OP OpenVibers committed 30 Sept 2026 · b593cd90db · 2 files, +5 −3


Changes

ddiff --git a/apps/_shared/test/guard.test.js b/apps/_shared/test/guard.test.js
iindex d716257..5543e18 100644
---- a/apps/_shared/test/guard.test.js
++++ b/apps/_shared/test/guard.test.js
@@@ -446,7 +446,7 @@ async function serve(app) {
}
const img = createGuardStore({ db, app: 'img', log: quiet });
assert.strictEqual(await img.pruneAbuse(now0), 1, "img prunes its own row");
-- const left = await db.query('SELECT app FROM guard_abuse ORDER BY app');
++ const left = await db.many('SELECT app FROM guard_abuse ORDER BY app');
assert.deepStrictEqual(left.map(r => r.app), ['docs'], "docs' row is untouched");
}
ddiff --git a/apps/_shared/test/spawn.js b/apps/_shared/test/spawn.js
iindex aaff0dc..9db628f 100644
---- a/apps/_shared/test/spawn.js
++++ b/apps/_shared/test/spawn.js
@@@ -26,10 +26,12 @@ async function startApp(app, env = {}, port, { readyPath = '/api/health' } = {})
let out = '';
// Without a DATABASE_URL the app serves from an embedded PGlite database. Point it at a directory
// under the test's own DATA_DIR, so it survives the kill a restart test does (production uses a real
-- // PostgreSQL, which outlives the process the same way).
++ // PostgreSQL, which outlives the process the same way). One directory per app: PGlite is a
++ // single-process database, and tests that start several apps on one DATA_DIR (observe.test.js runs
++ // img, text and yt at once) aborted when two processes opened the same files.
const url = env.DATABASE_URL !== undefined ? env.DATABASE_URL : process.env.DATABASE_URL;
const pglite = (!String(url || '').trim() && env.DATA_DIR && env.TOOLS_PGLITE_DIR === undefined)
-- ? { TOOLS_PGLITE_DIR: path.join(env.DATA_DIR, 'pglite') }
++ ? { TOOLS_PGLITE_DIR: path.join(env.DATA_DIR, 'pglite', app) }
: {};
const child = spawn(process.execPath, ['server/index.js'], {
cwd: dir,