@@ -197,6 +197,18 @@ func TestStatter(t *testing.T) {
197
197
assert .Nil (t , mem .Total )
198
198
assert .Equal (t , "B" , mem .Unit )
199
199
})
200
+ t .Run ("ContainerMemory/NoLimit" , func (t * testing.T ) {
201
+ t .Parallel ()
202
+ fs := initFS (t , fsContainerCgroupV1DockerNoMemoryLimit )
203
+ s , err := New (WithFS (fs ), withNoWait )
204
+ require .NoError (t , err )
205
+ mem , err := s .ContainerMemory (PrefixDefault )
206
+ require .NoError (t , err )
207
+ require .NotNil (t , mem )
208
+ assert .Equal (t , 268435456.0 , mem .Used )
209
+ assert .Nil (t , mem .Total )
210
+ assert .Equal (t , "B" , mem .Unit )
211
+ })
200
212
})
201
213
202
214
t .Run ("CGroupV2" , func (t * testing.T ) {
@@ -384,6 +396,17 @@ proc /proc/sys proc ro,nosuid,nodev,noexec,relatime 0 0`,
384
396
cgroupV1MemoryUsageBytes : "536870912" ,
385
397
cgroupV1MemoryStat : "total_inactive_file 268435456" ,
386
398
}
399
+ fsContainerCgroupV1DockerNoMemoryLimit = map [string ]string {
400
+ procOneCgroup : "0::/docker/aa86ac98959eeedeae0ecb6e0c9ddd8ae8b97a9d0fdccccf7ea7a474f4e0bb1f" ,
401
+ procMounts : `overlay / overlay rw,relatime,lowerdir=/some/path:/some/path,upperdir=/some/path:/some/path,workdir=/some/path:/some/path 0 0
402
+ proc /proc/sys proc ro,nosuid,nodev,noexec,relatime 0 0` ,
403
+ cgroupV1CPUAcctUsage : "0" ,
404
+ cgroupV1CFSQuotaUs : "-1" ,
405
+ cgroupV1CFSPeriodUs : "100000" ,
406
+ cgroupV1MemoryMaxUsageBytes : "9223372036854771712" ,
407
+ cgroupV1MemoryUsageBytes : "536870912" ,
408
+ cgroupV1MemoryStat : "total_inactive_file 268435456" ,
409
+ }
387
410
fsContainerCgroupV1AltPath = map [string ]string {
388
411
procOneCgroup : "0::/docker/aa86ac98959eeedeae0ecb6e0c9ddd8ae8b97a9d0fdccccf7ea7a474f4e0bb1f" ,
389
412
procMounts : `overlay / overlay rw,relatime,lowerdir=/some/path:/some/path,upperdir=/some/path:/some/path,workdir=/some/path:/some/path 0 0
0 commit comments