Skip to content

Commit

Permalink
Merge pull request moby#38493 from thaJeztah/skip_kmem_tests_on_rhel
Browse files Browse the repository at this point in the history
Skip kernel-memory tests on RHEL/CentOS daemons
  • Loading branch information
thaJeztah authored Jan 5, 2019
2 parents b958b43 + 1e1156c commit 926edd6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions integration-cli/docker_cli_run_unix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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)
Expand Down
11 changes: 11 additions & 0 deletions integration-cli/requirements_unix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
1 change: 1 addition & 0 deletions pkg/parsers/kernel/kernel_unix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func TestParseRelease(t *testing.T) {
assertParseRelease(t, "3.4.54.longterm-1", &VersionInfo{Kernel: 3, Major: 4, Minor: 54, Flavor: ".longterm-1"}, 0)
assertParseRelease(t, "3.4.54.longterm-1", &VersionInfo{Kernel: 3, Major: 4, Minor: 54, Flavor: ".longterm-1"}, 0)
assertParseRelease(t, "3.8.0-19-generic", &VersionInfo{Kernel: 3, Major: 8, Minor: 0, Flavor: "-19-generic"}, 0)
assertParseRelease(t, "3.10.0-862.2.3.el7.x86_64", &VersionInfo{Kernel: 3, Major: 10, Minor: 0, Flavor: "-862.2.3.el7.x86_64"}, 0)
assertParseRelease(t, "3.12.8tag", &VersionInfo{Kernel: 3, Major: 12, Minor: 8, Flavor: "tag"}, 0)
assertParseRelease(t, "3.12-1-amd64", &VersionInfo{Kernel: 3, Major: 12, Minor: 0, Flavor: "-1-amd64"}, 0)
assertParseRelease(t, "3.8.0", &VersionInfo{Kernel: 4, Major: 8, Minor: 0}, -1)
Expand Down

0 comments on commit 926edd6

Please sign in to comment.