mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-20 02:17:05 +00:00
fix(cliproxy): harden update recovery paths
This commit is contained in:
1 parent
8e4def4713
commit
4502e5d503
9 files changed
+318
-52
No files matched your search
@@ -35,9 +35,15 @@ describe('CLIProxy Docker host continuity assets', () => {
|
||||
});
|
||||
|
||||
it('recreates missing containers and escalates unhealthy recovery', () => {
|
||||
expect(reconcileScript).toContain('docker compose -f "$compose_file" up -d --no-build');
|
||||
expect(reconcileScript).toContain('CCS_CLIPROXY_COMPOSE_DIR:-/opt/cliproxy');
|
||||
expect(reconcileScript).toContain('CCS_CLIPROXY_COMPOSE_PROJECT:-docker');
|
||||
expect(reconcileScript).toContain('--project-name "$compose_project"');
|
||||
expect(reconcileScript).toContain('-f "$compose_file" up -d --no-build');
|
||||
expect(reconcileScript).toContain('restart ccs-dashboard cliproxy');
|
||||
expect(reconcileScript).toContain('docker restart "$container_name"');
|
||||
expect(reconcileScript.indexOf('docker restart "$container_name"')).toBeGreaterThan(
|
||||
reconcileScript.indexOf('restart ccs-dashboard cliproxy')
|
||||
);
|
||||
});
|
||||
|
||||
it('installs executable services on bounded timers', () => {
|
||||
|
||||
@@ -10,6 +10,7 @@ function createDeps(
|
||||
sessionRunning?: boolean;
|
||||
remoteRunning?: boolean;
|
||||
startResult?: { started: boolean; alreadyRunning: boolean; port: number; error?: string };
|
||||
installError?: Error;
|
||||
} = {}
|
||||
) {
|
||||
const calls = {
|
||||
@@ -30,6 +31,7 @@ function createDeps(
|
||||
_backend?: CLIProxyBackend
|
||||
) => {
|
||||
calls.installCliproxyVersion += 1;
|
||||
if (overrides.installError) throw overrides.installError;
|
||||
},
|
||||
ensureCliproxyService: async () => {
|
||||
calls.ensureCliproxyService += 1;
|
||||
@@ -122,4 +124,16 @@ describe('installDashboardCliproxyVersion', () => {
|
||||
message: 'Installed CLIProxy Plus v6.7.1, but failed to restart it',
|
||||
});
|
||||
});
|
||||
|
||||
it('restores a previously running proxy when installation fails', async () => {
|
||||
const { deps, calls } = createDeps({
|
||||
sessionRunning: true,
|
||||
installError: new Error('checksum mismatch'),
|
||||
});
|
||||
|
||||
await expect(installDashboardCliproxyVersion('6.7.1', 'plus', deps)).rejects.toThrow(
|
||||
'checksum mismatch'
|
||||
);
|
||||
expect(calls.ensureCliproxyService).toBe(1);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user