mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-04 20:17:24 +00:00
fix: clarify CLIProxy dashboard install lifecycle
This commit is contained in:
@@ -51,6 +51,8 @@ export async function installDashboardCliproxyVersion(
|
|||||||
const backendLabel = backend === 'plus' ? 'CLIProxy Plus' : 'CLIProxy';
|
const backendLabel = backend === 'plus' ? 'CLIProxy Plus' : 'CLIProxy';
|
||||||
const shouldRestoreService = await wasProxyRunning(deps);
|
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);
|
await deps.installCliproxyVersion(version, true, backend);
|
||||||
|
|
||||||
if (!shouldRestoreService) {
|
if (!shouldRestoreService) {
|
||||||
|
|||||||
@@ -102,4 +102,24 @@ describe('installDashboardCliproxyVersion', () => {
|
|||||||
expect(calls.installCliproxyVersion).toBe(1);
|
expect(calls.installCliproxyVersion).toBe(1);
|
||||||
expect(calls.ensureCliproxyService).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',
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user