From 1f539a26417bf5e76604361c1ea2841941809359 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Tue, 21 Jun 2022 12:06:24 +0200 Subject: api: show the memory limit specified for the container use the memory limit specified for the container instead of reading it from the cgroup. It is not reliable to read it from the cgroup since the container could have been moved to a different cgroup and in general the OCI runtime might create a sub-cgroup (like crun does). Closes: https://github.com/containers/podman/issues/14676 Signed-off-by: Giuseppe Scrivano --- test/apiv2/20-containers.at | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test') diff --git a/test/apiv2/20-containers.at b/test/apiv2/20-containers.at index 383c527b4..2f48e188e 100644 --- a/test/apiv2/20-containers.at +++ b/test/apiv2/20-containers.at @@ -95,6 +95,17 @@ fi t DELETE libpod/containers/$cid 200 .[0].Id=$cid +# Issue #14676: make sure the stats show the memory limit specified for the container +if root; then + CTRNAME=ctr-with-limit + podman run --name $CTRNAME -d -m 512m -v /tmp:/tmp $IMAGE top + + t GET libpod/containers/$CTRNAME/stats?stream=false 200 \ + .memory_stats.limit=536870912 + + podman rm -f $CTRNAME +fi + # Issue #6799: it should be possible to start a container, even w/o args. t POST libpod/containers/create?name=test_noargs Image=${IMAGE} 201 \ .Id~[0-9a-f]\\{64\\} -- cgit v1.2.3-54-g00ecf