mirror of https://github.com/docker/docs.git
Merge pull request #13866 from brahmaroutu/runOOM_13766
RunOOM test should check to see if Oom Control is enabled
This commit is contained in:
commit
a5283d2ff3
|
@ -2883,6 +2883,7 @@ func (s *DockerSuite) TestRunAllowPortRangeThroughPublish(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestRunOOMExitCode(c *check.C) {
|
func (s *DockerSuite) TestRunOOMExitCode(c *check.C) {
|
||||||
|
testRequires(c, OomControl)
|
||||||
errChan := make(chan error)
|
errChan := make(chan error)
|
||||||
go func() {
|
go func() {
|
||||||
defer close(errChan)
|
defer close(errChan)
|
||||||
|
|
|
@ -7,9 +7,11 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/docker/libcontainer/cgroups"
|
||||||
"github.com/go-check/check"
|
"github.com/go-check/check"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -119,6 +121,24 @@ var (
|
||||||
},
|
},
|
||||||
"Test requires support for IPv6",
|
"Test requires support for IPv6",
|
||||||
}
|
}
|
||||||
|
OomControl = TestRequirement{
|
||||||
|
func() bool {
|
||||||
|
cgroupMemoryMountpoint, err := cgroups.FindCgroupMountpoint("memory")
|
||||||
|
if err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if _, err := ioutil.ReadFile(path.Join(cgroupMemoryMountpoint, "memory.memsw.limit_in_bytes")); err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err = ioutil.ReadFile(path.Join(cgroupMemoryMountpoint, "memory.oom_control")); err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
|
||||||
|
},
|
||||||
|
"Test requires Oom control enabled.",
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// testRequires checks if the environment satisfies the requirements
|
// testRequires checks if the environment satisfies the requirements
|
||||||
|
|
Loading…
Reference in New Issue