Skip to content

Commit 1296220

Browse files
anandgupta42claude
andcommitted
test: drop redundant 'sudo rm -rf' from router e2e cleanup (review)
The afterAll cleanups ran Bun.spawnSync(["sudo","rm","-rf",d]) before rmSync(d, {recursive,force}). The temp dirs are mkdtemp dirs owned by the test user, so rmSync alone cleans them; the sudo call is redundant, needs passwordless sudo, and 'sudo rm -rf' is a dangerous pattern in a test. Removed (coderabbit). The other e2e-review flags were false positives: each beforeAll already guards with 'if (SKIP) return' (never throws when creds/image absent), and the ANSI parse test does use real ESC bytes. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
1 parent bc44570 commit 1296220

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎packages/opencode/test/router/router.e2e.test.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ beforeAll(() => {
6767
throw new Error(`image ${IMG} missing`)
6868
})
6969
afterAll(() => {
70-
for (const d of dirs) try { Bun.spawnSync(["sudo", "rm", "-rf", d]); rmSync(d, { recursive: true, force: true }) } catch {}
70+
// Temp dirs are mkdtemp dirs owned by this user — rmSync suffices; no sudo.
71+
for (const d of dirs) try { rmSync(d, { recursive: true, force: true }) } catch {}
7172
})
7273

7374
describe.skipIf(SKIP)("Router × REAL OpenRouter + REAL dbt (no mocks)", () => {

‎packages/opencode/test/router/verifier.e2e.test.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ beforeAll(() => {
3838
if (ok.exitCode !== 0) throw new Error(`E2E image ${IMG} not present`)
3939
})
4040
afterAll(() => {
41-
for (const d of dirs) try { Bun.spawnSync(["sudo", "rm", "-rf", d]); rmSync(d, { recursive: true, force: true }) } catch {}
41+
// Temp dirs are mkdtemp dirs owned by this user — rmSync suffices; no sudo.
42+
for (const d of dirs) try { rmSync(d, { recursive: true, force: true }) } catch {}
4243
})
4344

4445
describe.skipIf(SKIP)("Verifier × REAL dbt (no mocks)", () => {

0 commit comments

Comments
 (0)