Merge pull request #143 from thaJeztah/18.09_backport_skip_kmem_tests_on_rhel
[18.09 backport] Skip kernel-memory tests on RHEL/CentOS daemons Upstream-commit: 6b0ba3745d073717887ead912c3c7dea4c99fc45 Component: engine
This commit is contained in:
@@ -497,7 +497,7 @@ func (s *DockerSuite) TestRunWithInvalidCpuPeriod(c *check.C) {
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunWithKernelMemory(c *check.C) {
|
||||
testRequires(c, kernelMemorySupport)
|
||||
testRequires(c, DaemonIsLinux, kernelMemorySupport)
|
||||
|
||||
file := "/sys/fs/cgroup/memory/memory.kmem.limit_in_bytes"
|
||||
cli.DockerCmd(c, "run", "--kernel-memory", "50M", "--name", "test1", "busybox", "cat", file).Assert(c, icmd.Expected{
|
||||
@@ -510,7 +510,7 @@ func (s *DockerSuite) TestRunWithKernelMemory(c *check.C) {
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunWithInvalidKernelMemory(c *check.C) {
|
||||
testRequires(c, kernelMemorySupport)
|
||||
testRequires(c, DaemonIsLinux, kernelMemorySupport)
|
||||
|
||||
out, _, err := dockerCmdWithError("run", "--kernel-memory", "2M", "busybox", "true")
|
||||
c.Assert(err, check.NotNil)
|
||||
|
||||
@@ -38,6 +38,17 @@ func pidsLimit() bool {
|
||||
}
|
||||
|
||||
func kernelMemorySupport() bool {
|
||||
// TODO remove this once kmem support in RHEL kernels is fixed. See https://github.com/opencontainers/runc/pull/1921
|
||||
daemonV, err := kernel.ParseRelease(testEnv.DaemonInfo.KernelVersion)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
requiredV := kernel.VersionInfo{Kernel: 3, Major: 10}
|
||||
if kernel.CompareKernelVersion(*daemonV, requiredV) < 1 {
|
||||
// On Kernel 3.10 and under, don't consider kernel memory to be supported,
|
||||
// even if the kernel (and thus the daemon) reports it as being supported
|
||||
return false
|
||||
}
|
||||
return testEnv.DaemonInfo.KernelMemory
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user