@@ -36,6 +36,7 @@ func (suite *PouchRunMemorySuite) TearDownTest(c *check.C) {
3636// TestRunWithMemoryswap is to verify the valid running container
3737// with --memory-swap
3838func (suite * PouchRunMemorySuite ) TestRunWithMemoryswap (c * check.C ) {
39+ SkipIfFalse (c , environment .IsMemorySupport )
3940 SkipIfFalse (c , environment .IsMemorySwapSupport )
4041
4142 cname := "TestRunWithMemoryswap"
@@ -90,8 +91,18 @@ func (suite *PouchRunMemorySuite) TestRunWithMemoryswap(c *check.C) {
9091// TestRunWithMemoryswappiness is to verify the valid running container
9192// with memory-swappiness
9293func (suite * PouchRunMemorySuite ) TestRunWithMemoryswappiness (c * check.C ) {
93- cname := "TestRunWithMemoryswappiness"
94- res := command .PouchRun ("run" , "-d" , "-m" , "100m" ,
94+ SkipIfFalse (c , environment .IsMemorySupport )
95+ SkipIfFalse (c , environment .IsMemorySwappinessSupport )
96+
97+ cname := "TestRunWithMemoryswappiness-1"
98+ res := command .PouchRun ("run" , "-d" ,
99+ "--memory-swappiness" , "-1" ,
100+ "--name" , cname , busyboxImage , "top" )
101+ DelContainerForceMultyTime (c , cname )
102+ res .Assert (c , icmd .Success )
103+
104+ cname = "TestRunWithMemoryswappiness"
105+ res = command .PouchRun ("run" , "-d" , "-m" , "100m" ,
95106 "--memory-swappiness" , "70" ,
96107 "--name" , cname , busyboxImage , "sleep" , "10000" )
97108 defer DelContainerForceMultyTime (c , cname )
@@ -117,6 +128,8 @@ func (suite *PouchRunMemorySuite) TestRunWithMemoryswappiness(c *check.C) {
117128
118129// TestRunWithLimitedMemory is to verify the valid running container with -m
119130func (suite * PouchRunMemorySuite ) TestRunWithLimitedMemory (c * check.C ) {
131+ SkipIfFalse (c , environment .IsMemorySupport )
132+
120133 cname := "TestRunWithLimitedMemory"
121134 res := command .PouchRun ("run" , "-d" , "-m" , "100m" ,
122135 "--name" , cname , busyboxImage , "top" )
@@ -143,6 +156,8 @@ func (suite *PouchRunMemorySuite) TestRunWithLimitedMemory(c *check.C) {
143156
144157// TestRunMemoryOOM is to verify return value when a container is OOM.
145158func (suite * PouchRunMemorySuite ) TestRunMemoryOOM (c * check.C ) {
159+ SkipIfFalse (c , environment .IsMemorySupport )
160+
146161 cname := "TestRunMemoryOOM"
147162 ret := command .PouchRun ("run" , "-m" , "20m" , "--name" , cname , busyboxImage , "sh" , "-c" , "x=a; while true; do x=$x$x$x$x; done" )
148163 defer DelContainerForceMultyTime (c , cname )
@@ -151,6 +166,7 @@ func (suite *PouchRunMemorySuite) TestRunMemoryOOM(c *check.C) {
151166
152167// TestRunWithMemoryFlag test pouch run with memory flags
153168func (suite * PouchRunSuite ) TestRunWithMemoryFlag (c * check.C ) {
169+ SkipIfFalse (c , environment .IsMemorySupport )
154170 SkipIfFalse (c , environment .IsMemorySwapSupport )
155171
156172 cname := "RunWithOnlyMemorySwap"
0 commit comments