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_test.go
Sebastiaan van Stijn a1150245cc
Update to Go 1.17.0, and gofmt with Go 1.17
Movified from 686be57d0a, and re-ran
gofmt again to address for files not present in 20.10 and vice-versa.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 686be57d0a)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-04-07 23:27:50 +02:00

90 lines
1.7 KiB
Go

//go:build !windows
// +build !windows
package main
import (
"bytes"
"io/ioutil"
"os/exec"
"strings"
"github.com/docker/docker/pkg/sysinfo"
)
var (
// SysInfo stores information about which features a kernel supports.
SysInfo *sysinfo.SysInfo
)
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 supportsSeccomp && SysInfo.Seccomp
}
func bridgeNfIptables() bool {
return !SysInfo.BridgeNFCallIPTablesDisabled
}
func unprivilegedUsernsClone() bool {
content, err := ioutil.ReadFile("/proc/sys/kernel/unprivileged_userns_clone")
return err != nil || !strings.Contains(string(content), "0")
}
func overlayFSSupported() bool {
cmd := exec.Command(dockerBinary, "run", "--rm", "busybox", "/bin/sh", "-c", "cat /proc/filesystems")
out, err := cmd.CombinedOutput()
if err != nil {
return false
}
return bytes.Contains(out, []byte("overlay\n"))
}
func init() {
if testEnv.IsLocalDaemon() {
SysInfo = sysinfo.New(true)
}
}