Fixes after dnephin review

Signed-off-by: Christopher Crone <christopher.crone@docker.com>
This commit is contained in:
Christopher Crone
2017-09-14 19:17:49 +02:00
parent 81f69a5931
commit 7dabed019a
17 changed files with 87 additions and 118 deletions

View File

@@ -14,6 +14,7 @@ import (
"github.com/docker/docker/client"
"github.com/docker/docker/integration-cli/checker"
"github.com/docker/docker/integration-cli/request"
"github.com/docker/docker/pkg/parsers/kernel"
"github.com/go-check/check"
"github.com/kr/pty"
)
@@ -170,6 +171,18 @@ func (s *DockerSuite) TestUpdateKernelMemoryUninitialized(c *check.C) {
c.Assert(strings.TrimSpace(out), checker.Equals, "314572800")
}
// GetKernelVersion gets the current kernel version.
func GetKernelVersion() *kernel.VersionInfo {
v, _ := kernel.ParseRelease(testEnv.DaemonInfo.KernelVersion)
return v
}
// CheckKernelVersion checks if current kernel is newer than (or equal to)
// the given version.
func CheckKernelVersion(k, major, minor int) bool {
return kernel.CompareKernelVersion(*GetKernelVersion(), kernel.VersionInfo{Kernel: k, Major: major, Minor: minor}) > 0
}
func (s *DockerSuite) TestUpdateSwapMemoryOnly(c *check.C) {
testRequires(c, DaemonIsLinux)
testRequires(c, memoryLimitSupport)