test(e2e): migrate Ollama auth proxy to vitest - #5551
Conversation
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/pluginThe overall coverage in the Show a code coverage summary of the most covered files.
TypeScript / code-coverage/cliThe overall coverage in the Show a code coverage summary of the most covered files.
Updated |
E2E Advisor RecommendationRequired E2E: None Dispatch hint: Full advisor summaryE2E Recommendation AdvisorBase: Required E2E
Optional E2E
New E2E recommendations
Dispatch hint
|
Vitest E2E Scenario RecommendationRequired Vitest E2E scenarios: Dispatch required Vitest E2E scenarios:
Full Vitest E2E advisor summaryVitest E2E Scenario AdvisorBase: Required Vitest E2E scenarios
Optional Vitest E2E scenarios
Relevant changed files
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a live end-to-end Vitest test file ( ChangesOllama Auth Proxy E2E Test and CI Integration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
PR Review AdvisorFindings: 0 needs attention, 3 worth checking, 0 nice ideas Review findings🛠️ Needs attention
🔎 Worth checking
🌱 Nice ideas
Consider writing more tests for
Since last review detailsCurrent findings:
This is an automated advisory review. A human maintainer must make the final merge decision. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
test/e2e-scenario/live/ollama-auth-proxy.test.ts (1)
76-91: 💤 Low valuePotential file descriptor leak on spawn failure.
If
spawnfails (e.g., command not found), theerrorevent fires butexitmay not, leavingoutopen. Consider closing the fd in an error handler or using afinally-style cleanup.♻️ Suggested improvement
function spawnLogged( command: string, args: string[], logPath: string, env: NodeJS.ProcessEnv, ): ChildProcess { fs.mkdirSync(path.dirname(logPath), { recursive: true }); const out = fs.openSync(logPath, "a"); const child = spawn(command, args, { cwd: REPO_ROOT, env: { ...process.env, ...env }, stdio: ["ignore", out, out], }); - child.once("exit", () => fs.closeSync(out)); + const closeFd = () => { + try { fs.closeSync(out); } catch { /* already closed */ } + }; + child.once("exit", closeFd); + child.once("error", closeFd); return child; }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/e2e-scenario/live/ollama-auth-proxy.test.ts` around lines 76 - 91, The spawnLogged function has a potential file descriptor leak because the file descriptor cleanup happens only in the exit event handler, but if spawn fails (e.g., command not found), the error event fires instead and the exit handler may never be called, leaving the file descriptor open. Add an error event handler to the child process that also calls fs.closeSync(out) to ensure the file descriptor is closed in both success and failure scenarios. Reference the child.once("exit", ...) call as a model and add a similar child.once("error", ...) handler immediately after it that performs the same cleanup.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@test/e2e-scenario/live/ollama-auth-proxy.test.ts`:
- Around line 76-91: The spawnLogged function has a potential file descriptor
leak because the file descriptor cleanup happens only in the exit event handler,
but if spawn fails (e.g., command not found), the error event fires instead and
the exit handler may never be called, leaving the file descriptor open. Add an
error event handler to the child process that also calls fs.closeSync(out) to
ensure the file descriptor is closed in both success and failure scenarios.
Reference the child.once("exit", ...) call as a model and add a similar
child.once("error", ...) handler immediately after it that performs the same
cleanup.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 72240963-0c62-4e30-82a8-ad27853d9a77
📒 Files selected for processing (2)
.github/workflows/e2e-vitest-scenarios.yamltest/e2e-scenario/live/ollama-auth-proxy.test.ts
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
…ma-auth-proxy Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Summary
Migrates
test/e2e/test-ollama-auth-proxy-e2e.shinto a typed live Vitest scenario. The new coverage preserves the host-side proxy contract with real Ollama, the real Node auth proxy, authenticated and unauthenticated curl probes, inference calls, token persistence, restart recovery, optional Docker reachability, and token-divergence repair.Related Issue
Refs #5098
Changes
test/e2e-scenario/live/ollama-auth-proxy.test.tswith typed process cleanup, artifact logs, and token redaction.ollama-auth-proxy-vitestinto.github/workflows/e2e-vitest-scenarios.yamlas a free-standing dispatchable Vitest job.Type of Change
Verification
Verifiedin GitHubnpx prek run --from-ref main --to-ref HEADpassesnpm testpasses (broad runtime changes only)npm run docsbuilds without warnings (doc changes only)Targeted commands run:
npx biome check --write test/e2e-scenario/live/ollama-auth-proxy.test.tsNEMOCLAW_RUN_E2E_SCENARIOS=1 npx vitest run --project e2e-scenarios-live test/e2e-scenario/live/ollama-auth-proxy.test.ts -t __compile_only_nomatch__ --silent=false --reporter=default --passWithNoTestsnpx vitest run --project e2e-vitest-support test/e2e-scenario/support-tests/e2e-scenarios-workflow.test.tsnpx tsx scripts/check-test-file-size-budget.ts test/e2e-scenario/live/ollama-auth-proxy.test.tsnpx tsc --noEmit --strict --moduleResolution bundler --module preserve --target ES2022 --types node --allowImportingTsExtensions test/e2e-scenario/live/ollama-auth-proxy.test.tsgit diff --checkSigned-off-by: Carlos Villela cvillela@nvidia.com
Summary by CodeRabbit
Tests
CI/CD