openvibers/openrestream Commits

Reuse coordinator test DB and run test files three at a time

OP OpenVibers committed 13 Oct 2026 · 6d0059981a · 2 files, +6 −3

Asked: Cut this repo's full test-suite wall time (npm test ran ~8 min; the verify goal is 10 min including test-pg). Cached per-file times (/home/workstation/openvibe/agents/ds/test-cache/OpenRe.Stream.json): coordinator 122s, jsmpeg 57s, api 53s, destinations-ui 42s, jsmpeg-migration 26s, asset-cache 24s…
Harness job openre-stream-cut-this-repo-s-full-test--224742.

Changes

ddiff --git a/test/coordinator.test.js b/test/coordinator.test.js
iindex 44517b0..a66df4c 100644
---- a/test/coordinator.test.js
++++ b/test/coordinator.test.js
@@@ -2,15 +2,18 @@
// Session coordinator: generations and draining, lost workers, lease expiry, output assignment to
// the newest restream generation, drain-deadline handover and the single-coordinator lease.
const assert = require('assert');
--const { runtime, manualClock, suite, OWNER, outboxTypes, silent } = require('./helpers');
++const { runtime, manualClock, suite, OWNER, outboxTypes, silent, tmpDir } = require('./helpers');
const { createCoordinator } = require('../server/coordinator');
const { createWorkerRuntime } = require('../workers/runtime');
const t = suite('coordinator');
++const dir = tmpDir();
async function setup() {
const clock = manualClock();
-- const rt = await runtime({ clock });
++ const rt = await runtime({ clock, dir });
++ // Every case starts with fresh rows, while helpers.testDb reuses the migrated database.
++ await rt.db.prepare('TRUNCATE TABLE stream_definitions, workers, event_outbox, leases, output_logs RESTART IDENTITY CASCADE').run();
const coordinator = createCoordinator({ rt, media: null, log: silent });
const { definition, key } = await rt.store.definitions.create({ owner_subject: OWNER });
const worker = async (kind) => { const w = await rt.store.workers.register({ kind, endpoints: { flvPort: 19361, rtmpPlayPort: 19360 } }); await rt.store.workers.ready(w.id); return await rt.store.workers.get(w.id); };
ddiff --git a/test/run.js b/test/run.js
iindex aada94c..687ba66 100644
---- a/test/run.js
++++ b/test/run.js
@@@ -13,4 +13,4 @@
* ○ and not counted as passed (openvibe-shared/test-runner).
*/
'use strict';
--require('openvibe-shared/test-runner').main({ dir: __dirname, timeoutMs: 180000, pad: 32, parallel: 1 });
++require('openvibe-shared/test-runner').main({ dir: __dirname, timeoutMs: 180000, pad: 32, parallel: 3 });