fix tests

This commit is contained in:
Raven Scott
2026-04-03 19:45:02 -04:00
parent 93f82ce905
commit 76dc3ecb7c
4 changed files with 9 additions and 6 deletions
+3 -3
View File
@@ -48,7 +48,8 @@ let kernelLoggerOrigLog = null
let kernelLoggerOrigErr = null
/**
* Register cleanup (e.g. clearInterval) for when the kernel session ends.
* Register cleanup (e.g. clearInterval). Invoked on every {@link stopBareInitd}
* (e.g. each REPL session teardown); callbacks should be idempotent.
* @param {() => void} fn
*/
export function registerBareInitdDisposer(fn) {
@@ -79,8 +80,7 @@ export async function runKernelShutdownHooks() {
}
export function stopBareInitd() {
while (disposers.length) {
const fn = disposers.pop()
for (const fn of disposers) {
try {
fn()
} catch {
+4 -1
View File
@@ -1188,6 +1188,7 @@ test('systemctl list after startBareInitd shows kernel-logger and bare-cron', as
const text = logs.join('\n')
t.ok(text.includes('kernel-logger'))
t.ok(text.includes('bare-cron'))
stopBareInitd()
await store.close()
rmSync(dir, { recursive: true, force: true })
})
@@ -1211,6 +1212,7 @@ test('systemctl list-units delegates to same backend', async (t) => {
await runBinCommand(ctx, ['systemctl', 'list-units'])
t.is(ctx.exitCode, 0)
t.ok(logs.join('\n').includes('bare-cron'))
stopBareInitd()
await store.close()
rmSync(dir, { recursive: true, force: true })
})
@@ -1234,6 +1236,7 @@ test('systemctl restart bare-cron succeeds', async (t) => {
await runBinCommand(ctx, ['systemctl', 'restart', 'bare-cron'])
t.is(ctx.exitCode, 0)
t.ok(logs.some((l) => /restarted bare-cron/i.test(l)))
stopBareInitd()
await store.close()
rmSync(dir, { recursive: true, force: true })
})
@@ -1278,7 +1281,7 @@ test('stopBareInitd runs registered disposers', async (t) => {
stopBareInitd()
t.is(n, 1)
stopBareInitd()
t.is(n, 1)
t.is(n, 2)
})
test('runKernelShutdownHooks runs LIFO once', async (t) => {
File diff suppressed because one or more lines are too long