github.com/Prakhar-Agarwal-byte/moby@v0.0.0-20231027092010-a14e3e8ab87e/integration-cli/requirements_unix_test.go (about) 1 //go:build !windows 2 3 package main 4 5 import ( 6 "os" 7 "strings" 8 9 "github.com/Prakhar-Agarwal-byte/moby/pkg/sysinfo" 10 ) 11 12 var sysInfo *sysinfo.SysInfo 13 14 func setupLocalInfo() { 15 sysInfo = sysinfo.New() 16 } 17 18 func cpuCfsPeriod() bool { 19 return testEnv.DaemonInfo.CPUCfsPeriod 20 } 21 22 func cpuCfsQuota() bool { 23 return testEnv.DaemonInfo.CPUCfsQuota 24 } 25 26 func cpuShare() bool { 27 return testEnv.DaemonInfo.CPUShares 28 } 29 30 func oomControl() bool { 31 return testEnv.DaemonInfo.OomKillDisable 32 } 33 34 func pidsLimit() bool { 35 return sysInfo.PidsLimit 36 } 37 38 func memoryLimitSupport() bool { 39 return testEnv.DaemonInfo.MemoryLimit 40 } 41 42 func memoryReservationSupport() bool { 43 return sysInfo.MemoryReservation 44 } 45 46 func swapMemorySupport() bool { 47 return testEnv.DaemonInfo.SwapLimit 48 } 49 50 func memorySwappinessSupport() bool { 51 return testEnv.IsLocalDaemon() && sysInfo.MemorySwappiness 52 } 53 54 func blkioWeight() bool { 55 return testEnv.IsLocalDaemon() && sysInfo.BlkioWeight 56 } 57 58 func cgroupCpuset() bool { 59 return testEnv.DaemonInfo.CPUSet 60 } 61 62 func seccompEnabled() bool { 63 return sysInfo.Seccomp 64 } 65 66 func bridgeNfIptables() bool { 67 return !sysInfo.BridgeNFCallIPTablesDisabled 68 } 69 70 func unprivilegedUsernsClone() bool { 71 content, err := os.ReadFile("/proc/sys/kernel/unprivileged_userns_clone") 72 return err != nil || !strings.Contains(string(content), "0") 73 }