forked from snxraven/peardock
Ship remaining roadmap items: encrypted registry vault, peer invite/revoke, Swarm/plugins behind flags, binary streams, engine create validation, deploy rollback, schema validation, fleet/access UI, metrics, fuzz/load/soak tests, systemd packaging, and release tooling. Mark ROADMAP fully complete.
21 lines
446 B
JavaScript
21 lines
446 B
JavaScript
import test from 'brittle'
|
|
import {
|
|
recordSample,
|
|
getHistory,
|
|
pruneMissing,
|
|
clearHistory,
|
|
} from '../server/services/stats-history.js'
|
|
|
|
test('stats history ring buffer', (t) => {
|
|
clearHistory()
|
|
const id = 'abc'
|
|
for (let i = 0; i < 5; i++) {
|
|
recordSample(id, { cpu: i, memory: i * 1000 })
|
|
}
|
|
const h = getHistory(id, { limit: 3 })
|
|
t.is(h.length, 3)
|
|
t.is(h[2].cpu, 4)
|
|
pruneMissing([])
|
|
t.is(getHistory(id).length, 0)
|
|
})
|