fix: make cgroup acceptance test robust to runc scope naming#222
Conversation
|
Warning Review limit reached
More reviews will be available in 54 minutes and 25 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThe cgroup-limits test server handler is updated to derive a BPM container ID using Suggested reviewers
🚥 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)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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 `@src/bpm/acceptance/fixtures/test-server/handlers/cgroup_limits_test.go`:
- Line 42: The os.RemoveAll(root) call on line 42 is not checking the returned
error, which causes the errcheck linter to fail. Wrap the os.RemoveAll(root)
call in a Gomega assertion (using Expect) to check that the error is nil,
ensuring the linter passes and proper error handling is in place for the cleanup
operation.
🪄 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: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 86ef7ed9-1213-4d2a-925b-8afa1a8dc0ac
📒 Files selected for processing (2)
src/bpm/acceptance/fixtures/test-server/handlers/cgroup_limits.gosrc/bpm/acceptance/fixtures/test-server/handlers/cgroup_limits_test.go
The CgroupLimits test-server handler hardcoded the runc default scope name (runc-bpm-<job>.scope). Since the cgroup-v2-aware CgroupsPath fix (f8e0e29), runc derives the scope name from the self cgroup path, so it varies by environment (e.g. docker-bpm-bpm-<job>.scope), causing test-acceptance-noble to fail when cgroup v2 is delegated into the BOSH VM. findCgroupDir now matches on the bpm container ID, accepting both the cgroupfs leaf directory (named exactly containerID) and any systemd scope ending in -<containerID>.scope. The container ID is built via jobid.Encode to stay in sync with config.BPMConfig.ContainerID. Adds unit tests covering the legacy, cgroup-v2-aware, cgroupfs, named-process, and negative cases.
4a18d79 to
c14b36d
Compare
| // | ||
| // Returns the full path to the matching directory. | ||
| func findCgroupDir(root, containerID string) (string, error) { | ||
| scopeSuffix := "-" + containerID + ".scope" |
This is fixing CI after #219. Oddly there are some green builds with #219 that we can't explain, but the majority of them are red. They're red because the test server can't find the container to check if limits have been applied correctly.
The CgroupLimits test-server handler hardcoded the runc default scope name (runc-bpm-.scope). Since the cgroup-v2-aware CgroupsPath fix (f8e0e29), runc derives the scope name from the self cgroup path, so it varies by environment (e.g. docker-bpm-bpm-.scope), causing test-acceptance-noble to fail when cgroup v2 is delegated into the BOSH VM.
findCgroupDir now matches on the bpm container ID, accepting both the cgroupfs leaf directory (named exactly containerID) and any systemd scope ending in -.scope. The container ID is built via jobid.Encode to stay in sync with config.BPMConfig.ContainerID. Adds unit tests covering the legacy, cgroup-v2-aware, cgroupfs, named-process, and negative cases.