@norskvideo/ctl-test-harness 0.1.27 → 0.1.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/smoke.js +11 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@norskvideo/ctl-test-harness",
3
- "version": "0.1.27",
3
+ "version": "0.1.29",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
package/smoke.js CHANGED
@@ -187,6 +187,7 @@ export async function runProductSmoke(slug, spec, deps = defaultSmokeDeps) {
187
187
  };
188
188
  let daemon = null;
189
189
  let launched = false;
190
+ let registered = false;
190
191
  let handles = [];
191
192
  let journeyError;
192
193
  try {
@@ -226,6 +227,7 @@ export async function runProductSmoke(slug, spec, deps = defaultSmokeDeps) {
226
227
  if (added.name !== spec.product.name) {
227
228
  throw new Error(`product add registered '${added.name}', expected '${spec.product.name}'`);
228
229
  }
230
+ registered = true;
229
231
  // Template.
230
232
  let templateName;
231
233
  if ("name" in spec.template) {
@@ -327,6 +329,15 @@ export async function runProductSmoke(slug, spec, deps = defaultSmokeDeps) {
327
329
  }
328
330
  if (handles.length)
329
331
  await deps.stopSources(handles).catch(() => { });
332
+ // The daemon reaps its own control-plane containers on shutdown (daemon.ts,
333
+ // model B), but only on the graceful path -- and cleanupDaemon escalates to
334
+ // SIGKILL 3s after SIGTERM, which can cut a slow `docker rm` short. Removing
335
+ // the product here does it while the daemon is calm rather than racing its
336
+ // own teardown. Best-effort: a throw here would mask the journey's own error,
337
+ // and a killed job never reaches this line -- the workflow's reap is what
338
+ // heals a runner already holding the port.
339
+ if (registered)
340
+ await cli(["product", "remove", spec.product.name]).catch(() => { });
330
341
  // cleanupDaemon ends with rmSync(storeDir); Docker's root-owned bind-mount
331
342
  // targets make that EACCES on a non-root runner. Expected: the root nuke
332
343
  // below is what removes them. Only a store that survives the nuke fails.