Files
usenet-indexer/tests/unit/disk_space.spec.ts
T
Daan MeijerandClaude Opus 5.5 9fb36d217c
Test and deploy / test (push) Successful in 52s
Test and deploy / edge (push) Successful in 2m5s
Test and deploy / deploy (push) Successful in 1m1s
Prober: no claims under PROBE_MIN_FREE_GB free on the NVMe
At ~200 articles/s what the prober stores (inspections, par2 file lists,
the WAL) took ~0.8-1.1 GB an hour of homelab's root, and nothing stopped it
at the 10 GB floor. Below 12 GB free it claims nothing (resumed 1 GB above):
the lanes go dry and its share shrinks to its minimum.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 17:38:37 +02:00

23 lines
815 B
TypeScript

import { test } from '@japa/runner'
import { DiskSpace } from '#services/disk_space'
test.group('DiskSpace', () => {
test('short below the floor, fine again a margin above it; off without a floor', async ({ assert }) => {
let gb = 15
const space = new DiskSpace('probing', '/', 12, async () => gb * 1e9, 0)
assert.isFalse(await space.short())
gb = 11.5
assert.isTrue(await space.short())
// Back over the floor, not yet over the margin: still short.
gb = 12.5
assert.isTrue(await space.short())
gb = 13.1
assert.isFalse(await space.short())
assert.isFalse(await new DiskSpace('probing', '/', 0, async () => 0, 0).short())
})
test('measures a real filesystem', async ({ assert }) => {
assert.isFalse(await new DiskSpace('probing', '/', 0.001).short())
})
})