project-nomad/admin/tests/unit/dependency_start.spec.ts
Matt Moyles 634e180edf
fix(kb): recreate a missing Qdrant container instead of spinning on Start Qdrant
The Knowledge Base's "Start Qdrant" button called start on a container
that no longer existed. The server answered 200 with success: false, the
modal ignored that flag, and the button polled the health check forever.

Starting a dependency service whose container is gone now recreates it
from its stored config through the normal install path. Its data lives on
a host bind mount, so nothing is lost. The modal shows a refused start as
an error, and stops waiting after five minutes if Qdrant never comes
online.

Fixes #1426
2026-10-15 13:00:51 -04:00

22 lines
804 B
TypeScript

import * as assert from 'node:assert/strict'
import { test } from 'node:test'
import { recreatesOnStart } from '../../app/utils/dependency_start.js'
test('starting a dependency service whose container is gone recreates it', () => {
assert.equal(recreatesOnStart('start', true, false), true)
})
test('starting a dependency service whose container exists just starts it', () => {
assert.equal(recreatesOnStart('start', true, true), false)
})
test('stop and restart never recreate a missing dependency container', () => {
assert.equal(recreatesOnStart('stop', true, false), false)
assert.equal(recreatesOnStart('restart', true, false), false)
})
test('starting a user-facing app with no container does not recreate it', () => {
assert.equal(recreatesOnStart('start', false, false), false)
})