This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user