1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/integration-cli/requirements_unix.go
John Howard c1b524486c Fix Windows CI fail due to GH13866 and patch up tests
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-07-09 10:09:45 -07:00

57 lines
1.3 KiB
Go

// +build !windows
package main
import (
"io/ioutil"
"path"
"github.com/docker/libcontainer/cgroups"
)
var (
CpuCfsPeriod = TestRequirement{
func() bool {
cgroupCpuMountpoint, err := cgroups.FindCgroupMountpoint("cpu")
if err != nil {
return false
}
if _, err := ioutil.ReadFile(path.Join(cgroupCpuMountpoint, "cpu.cfs_period_us")); err != nil {
return false
}
return true
},
"Test requires an environment that supports cgroup cfs period.",
}
CpuCfsQuota = TestRequirement{
func() bool {
cgroupCpuMountpoint, err := cgroups.FindCgroupMountpoint("cpu")
if err != nil {
return false
}
if _, err := ioutil.ReadFile(path.Join(cgroupCpuMountpoint, "cpu.cfs_quota_us")); err != nil {
return false
}
return true
},
"Test requires an environment that supports cgroup cfs quota.",
}
OomControl = TestRequirement{
func() bool {
cgroupMemoryMountpoint, err := cgroups.FindCgroupMountpoint("memory")
if err != nil {
return false
}
if _, err := ioutil.ReadFile(path.Join(cgroupMemoryMountpoint, "memory.memsw.limit_in_bytes")); err != nil {
return false
}
if _, err = ioutil.ReadFile(path.Join(cgroupMemoryMountpoint, "memory.oom_control")); err != nil {
return false
}
return true
},
"Test requires Oom control enabled.",
}
)