package cgrouptest
import "internal/cgrouptest"
Package cgrouptest provides best-effort helpers for running tests inside a cgroup.
Index ¶
Functions ¶
func InCgroupV2 ¶
InCgroupV2 creates a new v2 cgroup, migrates the current process into it, and then calls fn. When fn returns, the current process is migrated back to the original cgroup and the new cgroup is destroyed.
If a new cgroup cannot be created, the test is skipped.
This must not be used in parallel tests, as it affects the entire process.
Types ¶
type CgroupV2 ¶
type CgroupV2 struct {
// contains filtered or unexported fields
}
func (*CgroupV2) CPUMaxPath ¶
Path to cpu.max.
func (*CgroupV2) Path ¶
func (*CgroupV2) SetCPUMax ¶
Set cpu.max. Pass -1 for quota to disable the limit.
Source Files ¶
- Version
- v1.25.0-rc.1
- Published
- Jun 11, 2025
- Platform
- linux/amd64
- Imports
- 9 packages
- Last checked
- 2 minutes ago –
Tools for package owners.