Skip to content

Commit 2a0ca8e

Browse files
surajssdclaude
andcommitted
test(backend): mock helm CLI in helm/status route test
The `GET /api/installation/helm/status` test called the real route, which spawns the `helm` binary. On CI runners without helm the spawn hangs until Bun's 5000ms per-test timeout, failing the suite. (This was masked before the coverage step started propagating exit codes.) Mock `helmService.checkHelmAvailable` with a local restore, matching the pattern used throughout installation.test.ts, so the test is deterministic and no longer depends on helm being installed. Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
1 parent 9dd7175 commit 2a0ca8e

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

backend/src/hono-app.test.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import app, { parseCorsOrigin } from './hono-app';
33
import { kubernetesService } from './services/kubernetes';
44
import { configService } from './services/config';
55
import { authService } from './services/auth';
6+
import { helmService } from './services/helm';
67
import { mockServiceMethod } from './test/helpers';
78
import { mockDeployment } from './test/fixtures';
89
import { HTTPException } from 'hono/http-exception';
@@ -1288,10 +1289,21 @@ describe('Hono Routes', () => {
12881289

12891290
describe('Installation Routes', () => {
12901291
test('GET /api/installation/helm/status returns helm status', async () => {
1291-
const res = await app.request('/api/installation/helm/status');
1292-
expect(res.status).toBe(200);
1293-
const data = await res.json();
1294-
expect(data.available).toBeDefined();
1292+
// Mock the helm CLI probe so the test never spawns the real `helm`
1293+
// binary, which hangs on CI runners where helm is absent. Mirrors the
1294+
// pattern used throughout installation.test.ts.
1295+
const restore = mockServiceMethod(helmService, 'checkHelmAvailable', async () => ({
1296+
available: true,
1297+
version: 'v3.14.0',
1298+
}));
1299+
try {
1300+
const res = await app.request('/api/installation/helm/status');
1301+
expect(res.status).toBe(200);
1302+
const data = await res.json();
1303+
expect(data.available).toBeDefined();
1304+
} finally {
1305+
restore();
1306+
}
12951307
});
12961308
});
12971309

0 commit comments

Comments
 (0)