Restrict launches to prepared runtimes (Refs #93)
CI / checks (push) Successful in 4m53s

This commit is contained in:
2026-10-09 17:15:15 -04:00
parent f0afd6de67
commit 596b160be3
36 changed files with 347 additions and 116 deletions
+19 -4
View File
@@ -12,7 +12,7 @@ const inventory = {
dockerRunning: true,
directoriesWritable: true,
storageAvailable: 100 * 1024 ** 3,
runtimeImages: ['plutainer:test'],
preparedRuntimeImages: ['plutainer:test'],
libraries: [{ id: 'test-library', state: 'ready' }]
};
beforeEach(async () => {
@@ -494,6 +494,21 @@ describe('native host enrollment and scoped authentication', () => {
});
describe('native host readiness and reservations', () => {
it.each([
{ preparedRuntimeImages: 'plutainer:test' },
{ preparedRuntimeImages: [123] },
{ preparedRuntimeImages: null }
])(
'rejects malformed prepared runtime inventory: $preparedRuntimeImages',
async ({ preparedRuntimeImages }) => {
const api = await enrolled();
expect(() =>
api.heartbeat(api.host.id, { ...inventory, preparedRuntimeImages })
).toThrow(/runtime image inventory/i);
expect(api.requireReadyHost(api.host.id).readiness).toBe('ready');
}
);
it('separates a connected agent from ready Docker, storage, runtime and library state', async () => {
const api = await enrolled();
expect(api.requireReadyHost(api.host.id).readiness).toBe('ready');
@@ -518,8 +533,8 @@ describe('native host readiness and reservations', () => {
});
it.each([
{ missing: { libraries: [] }, expected: 'needs-game-files' },
{ missing: { runtimeImages: [] }, expected: 'needs-runtime' },
{ missing: { runtimeImages: [], libraries: [] }, expected: 'needs-runtime' }
{ missing: { preparedRuntimeImages: [] }, expected: 'needs-runtime' },
{ missing: { preparedRuntimeImages: [], libraries: [] }, expected: 'needs-runtime' }
])(
'names missing content as $expected until a prepared heartbeat arrives',
async ({ missing, expected }) => {
@@ -545,7 +560,7 @@ describe('native host readiness and reservations', () => {
download.id,
runtime.id
]);
api.heartbeat(api.host.id, { ...inventory, runtimeImages: [], libraries: [] });
api.heartbeat(api.host.id, { ...inventory, preparedRuntimeImages: [], libraries: [] });
expect(api.pendingHostOperations(api.host.id).map((operation) => operation.id)).toEqual([
download.id,
runtime.id