Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

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 #1504

Signed-off-by: Julio Montes <[email protected]>
  • Loading branch information
Julio Montes committed Apr 26, 2019
1 parent 6ae9592 commit bb49514
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 bb49514

Please sign in to comment.