package cgrouptest
import "internal/cgrouptest"
Package cgrouptest provides best-effort helpers for running tests inside a cgroup.
Index
Functions
func InCgroupV2
func InCgroupV2(t *testing.T, fn func(*CgroupV2))
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
func (c *CgroupV2) CPUMaxPath() string
Path to cpu.max.
func (*CgroupV2) Path
func (c *CgroupV2) Path() string
func (*CgroupV2) SetCPUMax
func (c *CgroupV2) SetCPUMax(quota, period int64) error
Set cpu.max. Pass -1 for quota to disable the limit.