fix: clarify CLIProxy dashboard install lifecycle

This commit is contained in:
Tam Nhu Tran
2026-03-07 10:52:46 +07:00
parent e14df1fe05
commit a4b626aede
2 changed files with 22 additions and 0 deletions
@@ -51,6 +51,8 @@ export async function installDashboardCliproxyVersion(
const backendLabel = backend === 'plus' ? 'CLIProxy Plus' : 'CLIProxy';
const shouldRestoreService = await wasProxyRunning(deps);
// The installer owns the stop-and-replace lifecycle: it stops a running proxy
// and waits for the port to free before swapping the binary.
await deps.installCliproxyVersion(version, true, backend);
if (!shouldRestoreService) {
@@ -102,4 +102,24 @@ describe('installDashboardCliproxyVersion', () => {
expect(calls.installCliproxyVersion).toBe(1);
expect(calls.ensureCliproxyService).toBe(1);
});
it('uses a fallback restart error when the start result omits one', async () => {
const { deps } = createDeps({
remoteRunning: true,
startResult: {
started: false,
alreadyRunning: false,
port: 8317,
},
});
const result = await installDashboardCliproxyVersion('6.7.1', 'plus', deps);
expect(result).toEqual<DashboardCliproxyInstallResult>({
success: false,
restarted: false,
error: 'Installed CLIProxy Plus v6.7.1, but restart failed',
message: 'Installed CLIProxy Plus v6.7.1, but failed to restart it',
});
});
});