Files
moby/integration-cli/requirements_unix_test.go
Rob Murray 37259540e9 Remove/replace integration-cli tests that use iptables directly
In preparation for testing with an nftables backend.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-05-12 17:51:59 +01:00

76 lines
1.4 KiB
Go

//go:build !windows
package main
import (
"os"
"strings"
"github.com/containerd/cgroups/v3"
"github.com/docker/docker/pkg/sysinfo"
)
var sysInfo *sysinfo.SysInfo
func setupLocalInfo() {
sysInfo = sysinfo.New()
}
func cpuCfsPeriod() bool {
return testEnv.DaemonInfo.CPUCfsPeriod
}
func cpuCfsQuota() bool {
return testEnv.DaemonInfo.CPUCfsQuota
}
func cpuShare() bool {
return testEnv.DaemonInfo.CPUShares
}
func oomControl() bool {
return testEnv.DaemonInfo.OomKillDisable
}
func pidsLimit() bool {
return sysInfo.PidsLimit
}
func memoryLimitSupport() bool {
return testEnv.DaemonInfo.MemoryLimit
}
func memoryReservationSupport() bool {
return sysInfo.MemoryReservation
}
func swapMemorySupport() bool {
return testEnv.DaemonInfo.SwapLimit
}
func memorySwappinessSupport() bool {
return testEnv.IsLocalDaemon() && sysInfo.MemorySwappiness
}
func blkioWeight() bool {
return testEnv.IsLocalDaemon() && sysInfo.BlkioWeight
}
func cgroupCpuset() bool {
return testEnv.DaemonInfo.CPUSet
}
func seccompEnabled() bool {
return sysInfo.Seccomp
}
func onlyCgroupsv2() bool {
// Only check for unified, cgroup v1 tests can run under other modes
return cgroups.Mode() == cgroups.Unified
}
func unprivilegedUsernsClone() bool {
content, err := os.ReadFile("/proc/sys/kernel/unprivileged_userns_clone")
return err != nil || !strings.Contains(string(content), "0")
}