test(e2e): migrate test-jetson-nvmap-gpu.sh to vitest#5613
Conversation
📝 WalkthroughWalkthroughAdds a new live Vitest E2E test ( ChangesJetson NVMap GPU E2E Test and CI Wiring
Possibly related issues
Possibly related PRs
Suggested labels
Suggested reviewers
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/pluginThe overall coverage in the branch is 96%. Coverage data for the branch is not yet available. Show a code coverage summary of the most covered files.
TypeScript / code-coverage/cliThe overall coverage in the branch is 46%. Coverage data for the branch is not yet available. Show a code coverage summary of the most covered files.
Updated |
E2E Advisor RecommendationRequired E2E: 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
|
Vitest E2E Scenario Results —
|
| Job | Result |
|---|---|
| jetson-nvmap-gpu-vitest |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@test/e2e-scenario/live/jetson-nvmap-gpu.test.ts`:
- Around line 66-70: The expectGroupMembership function currently matches the
group ID against the full id command output, which can cause false positives
when the gid appears in uid or primary gid fields instead of supplemental
groups. Change the function to accept output from id -G (which returns only
space-separated numeric group IDs) instead of full id output, and replace the
regex matching logic with a simple token-based check that verifies the gid
exists as a complete whitespace-separated token in the id -G output. Apply the
same fix to the other location mentioned at lines 174-180.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: cf1c95fe-a017-45cf-9873-7d1c3c461827
📒 Files selected for processing (4)
.github/workflows/e2e-vitest-scenarios.yamltest/e2e-scenario/live/jetson-nvmap-gpu.test.tstest/e2e-scenario/support-tests/e2e-scenarios-workflow.test.tstools/e2e-scenarios/workflow-boundary.mts
| function expectGroupMembership(idOutput: string, gid: string): void { | ||
| expect(gid).toMatch(/^[0-9]+$/u); | ||
| const groupPattern = new RegExp(`(^|[(,=])${gid}([(,) ]|$)`, "u"); | ||
| expect(idOutput).toMatch(groupPattern); | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Use numeric group output to avoid false-positive membership checks.
expectGroupMembership() currently matches against full id output, so a hit can come from uid=/primary gid= fields instead of supplemental groups. That can mask a missing --group-add grant. Prefer id -G and token matching.
Suggested patch
function expectGroupMembership(idOutput: string, gid: string): void {
expect(gid).toMatch(/^[0-9]+$/u);
- const groupPattern = new RegExp(`(^|[(,=])${gid}([(,) ]|$)`, "u");
- expect(idOutput).toMatch(groupPattern);
+ const groups = idOutput.trim().split(/\s+/u).filter(Boolean);
+ expect(groups).toContain(gid);
}
@@
const sandboxId = await sandbox.execShell(SANDBOX_NAME, trustedSandboxShellScript("id"), {
+ artifactName: "phase-3-sandbox-id",
+ env: env(),
+ timeoutMs: 60_000,
+ });
+ // numeric-only supplemental group list
+ const sandboxGroups = await sandbox.execShell(
+ SANDBOX_NAME,
+ trustedSandboxShellScript("id -G"),
artifactName: "phase-3-sandbox-id",
env: env(),
timeoutMs: 60_000,
- });
- expect(sandboxId.exitCode, resultText(sandboxId)).toBe(0);
- expectGroupMembership(resultText(sandboxId), hostNvmapGid);
+ );
+ expect(sandboxGroups.exitCode, resultText(sandboxGroups)).toBe(0);
+ expectGroupMembership(resultText(sandboxGroups), hostNvmapGid);Also applies to: 174-180
🧰 Tools
🪛 ast-grep (0.44.0)
[warning] 67-67: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp((^|[(,=])${gid}([(,) ]|$), "u")
Note: [CWE-1333] Inefficient Regular Expression Complexity
(regexp-from-variable)
🤖 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/jetson-nvmap-gpu.test.ts` around lines 66 - 70, The
expectGroupMembership function currently matches the group ID against the full
id command output, which can cause false positives when the gid appears in uid
or primary gid fields instead of supplemental groups. Change the function to
accept output from id -G (which returns only space-separated numeric group IDs)
instead of full id output, and replace the regex matching logic with a simple
token-based check that verifies the gid exists as a complete
whitespace-separated token in the id -G output. Apply the same fix to the other
location mentioned at lines 174-180.
PR Review Advisor — Changes requestedMerge posture: Do not merge yet Action checklist
Findings index
Review findings by urgency: 0 required fixes, 4 items to resolve/justify, 0 in-scope improvements
|
Summary
Migrate
test/e2e/test-jetson-nvmap-gpu.shwith equivalent live Vitest coverage. Legacy shell deletion and nightly shell retirement are deferred to #5098 Phase 11.Related Issues
Refs #5098
Refs #4231
Assertion parity
/dev/nvmap/Tegra model detection.test/e2e-scenario/live/jetson-nvmap-gpu.test.tschecks/dev/nvmap,/etc/nv_tegra_release,/proc/device-tree/model, thenskip(...)before cleanup/onboard.coveredNEMOCLAW_NON_INTERACTIVE=1andNEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE=1.env()asserts both values before prerequisites/onboard.covereddocker infoexit code is0;docker info --format '{{json .Runtimes}}'matchesnvidia.coveredcleanupJetsonSandbox()runs before onboard and is registered with fixture cleanup.nemoclaw,openshell,pkillcleanupcoveredinstall.sh --non-interactivecompletes the Jetson/Ollama onboard path and leavesnemoclawon PATH.host.command("bash", ["install.sh", "--non-interactive"])exit code is0;command -v nemoclawsucceeds.coveredGranting sandbox user access to Jetson Tegra GPU device nodes via --group-add.covered/dev/nvmapowning GID.stat -c 'gid=%g' /dev/nvmap; sandboxid; regex asserts GID membership.covered/dev/nvmapis present inside the sandbox.ls -l /dev/nvmapexits0and contains/dev/nvmap.coveredcuInit(0)=0; reporter failureNvRmMemInitNvmap/permission denied is rejected.ctypes.CDLL("libcuda.so.1").cuInit(0)exits0, containscuInit(0)=0, and does not match `NvRmMemInitNvmapnemoclaw statusreportsSandbox GPU: enabledwithCUDA verified, not bare enabled,CUDA unverified, orlast CUDA proof failed.Sandbox GPU: enabledandCUDA verified, and does not match `last CUDA proof failedAll legacy assertions are covered or intentionally stronger in Vitest. No row is
missing,partial, orcandidate only.Contract mapping
test/e2e-scenario/live/jetson-nvmap-gpu.test.ts(A1-A10)install.sh, OpenShell sandbox exec,/dev/nvmap, CUDAcuInit(0), andnemoclaw status.Simplicity check
.github/workflows/nightly-e2e.yamljobgpu-jetson-nvmap-e2e,runs-on: ${{ vars.JETSON_E2E_RUNNER_LABEL || 'linux-arm64-gpu-jetson-orin-latest-1' }}, gated by Jetson runner availability.github/workflows/e2e-vitest-scenarios.yamljobjetson-nvmap-gpu-vitestgh workflow run e2e-vitest-scenarios.yaml --repo NVIDIA/NemoClaw --ref e2e-migrate/test-jetson-nvmap-gpu-vitest -f jobs=jetson-nvmap-gpu-vitest -f pr_number=<PR>Pre-push parity gate
test/e2e/test-jetson-nvmap-gpu.sh101000yes — nightly gpu-jetson-nvmap-e2e Jetson runner classVerification
npm run build:cliNEMOCLAW_RUN_E2E_SCENARIOS=1 npx vitest run --project e2e-scenarios-live test/e2e-scenario/live/jetson-nvmap-gpu.test.ts --silent=false --reporter=default(skips on local non-Jetson host)npx vitest run --project e2e-vitest-support test/e2e-scenario/support-tests/e2e-scenarios-workflow.test.ts --reporter=defaultnpm run typecheck:clinpm run test-size:checkgit diff --checkpending)Summary by CodeRabbit
Tests
Chores