Skip to content

Commit

Permalink
integration/docker: improve memory test
Browse files Browse the repository at this point in the history
Consume twice the memory hot added to the container to guarantee
the `out of memory` error.

fixes kata-containers#1504

Signed-off-by: Julio Montes <[email protected]>
(cherry picked from commit bb49514)
Signed-off-by: Ganesh Maharaj Mahalingam <[email protected]>
  • Loading branch information
Julio Montes authored and Ganesh Maharaj Mahalingam committed Apr 30, 2019
1 parent 189a3b3 commit b47d3b3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions integration/docker/mem_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ var _ = Describe("memory constraints", func() {
useKmem bool
err error
defaultMemSz int
hotMemSz int
)

BeforeEach(func() {
Expand Down Expand Up @@ -143,8 +144,9 @@ var _ = Describe("memory constraints", func() {

Context("run container exceeding memory constraints", func() {
It("should ran out of memory", func() {
memSize = "256MB"
limSize = strconv.Itoa(260+defaultMemSz) + "M"
hotMemSz = 256
memSize = fmt.Sprintf("%dMB", hotMemSz)
limSize = fmt.Sprintf("%dM", (hotMemSz*2)+defaultMemSz)
args = []string{"--name", id, "--rm", "-m", memSize, StressImage, "-mem-total", limSize, "-mem-alloc-size", limSize}
_, stderr, exitCode = dockerRun(args...)
Expect(exitCode).NotTo(Equal(0))
Expand Down

0 comments on commit b47d3b3

Please sign in to comment.