openvibers/openrestream Commits
Reuse coordinator test DB and run test files three at a time
Changes
@@@ -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); };@@@ -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 });
@@ -2,15 +2,18 @@
@@ -2,15 +2,18 @@
// Session coordinator: generations and draining, lost workers, lease expiry, output assignment to
// Session coordinator: generations and draining, lost workers, lease expiry, output assignment to
// the newest restream generation, drain-deadline handover and the single-coordinator lease.
// the newest restream generation, drain-deadline handover and the single-coordinator lease.
const assert = require('assert');
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 { createCoordinator } = require('../server/coordinator');
const { createWorkerRuntime } = require('../workers/runtime');
const { createWorkerRuntime } = require('../workers/runtime');
const t = suite('coordinator');
const t = suite('coordinator');
+const dir = tmpDir();
async function setup() {
async function setup() {
const clock = manualClock();
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 coordinator = createCoordinator({ rt, media: null, log: silent });
const { definition, key } = await rt.store.definitions.create({ owner_subject: OWNER });
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); };
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); };
@@ -13,4 +13,4 @@
@@ -13,4 +13,4 @@
* ○ and not counted as passed (openvibe-shared/test-runner).
* ○ and not counted as passed (openvibe-shared/test-runner).
*/
*/
'use strict';
'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 });