Add configurable history and storage retention policies

This commit is contained in:
2026-10-05 22:48:04 -04:00
parent 7c98df4fb0
commit 3952c4c938
37 changed files with 963 additions and 82 deletions
+3 -2
View File
@@ -1,3 +1,4 @@
import { initializeStandaloneSettings } from '../helpers/settings.js';
import Database from 'better-sqlite3';
import { createHash } from 'node:crypto';
import { mkdtemp, readFile, rm } from 'node:fs/promises';
@@ -15,7 +16,7 @@ let directory: string; let hostId: string; let credential: string;
const data = 'real game bytes';
const file = { path: 'zone/game.ff', size: Buffer.byteLength(data), sha256: createHash('sha256').update(data).digest('hex') };
beforeEach(async () => {
state.handle = new Database(':memory:'); state.handle.pragma('foreign_keys=ON');
state.handle = new Database(':memory:'); initializeStandaloneSettings(state.handle); state.handle.pragma('foreign_keys=ON');
directory = await mkdtemp(join(tmpdir(), 'ec-libraries-')); vi.stubEnv('GAME_FILES_ROOT', directory);
const host = createHost({ name: 'Debian host' }); hostId = host.id;
const enrollment = createEnrollment(host.id);
@@ -207,7 +208,7 @@ describe('verified host distribution', () => {
const report = () => updateHostLibraryCaches(hostId, [{ libraryVersionId: 'cache-version', status: 'ready', manifestSha256: 'checksum' }]);
seed(); report();
const original = state.handle!;
state.handle = new Database(':memory:');
state.handle = new Database(':memory:'); initializeStandaloneSettings(state.handle);
try {
seed();
const preparing = vi.spyOn(state.handle, 'prepare');