Files
Alessandro 9f8ed8fb29 Fix first-run instance creation after setup
Persist the one-shot first-instance run intent across renderer reloads or CLI terminal detours during the initial image install. Keep newly created managed instances visible when only the UI readiness probe times out, so slow blank-slate starts are not deleted after container creation.
2026-06-23 02:08:38 +02:00

28 lines
837 B
JavaScript

const assert = require('node:assert/strict');
const { test } = require('node:test');
const dockerManager = require('./index');
const { shouldKeepCreatedManagedInstanceOnError } = dockerManager._test;
test('managed instance run keeps started containers when UI readiness is slow', () => {
const error = new Error('Agent Zero UI is not reachable yet after starting the instance.');
error.code = 'UI_NOT_READY';
assert.equal(
shouldKeepCreatedManagedInstanceOnError(error, { containerId: 'abc123' }),
true
);
assert.equal(
shouldKeepCreatedManagedInstanceOnError(error, null),
false
);
const createError = new Error('Failed to create container');
createError.code = 'CREATE_FAILED';
assert.equal(
shouldKeepCreatedManagedInstanceOnError(createError, { containerId: 'abc123' }),
false
);
});