tests/int: swap-related fixes#4188
Conversation
There was a problem hiding this comment.
Sorry, when we set memory to -1 in cgroupv2, it means set both memory and swap limit to max:
runc/tests/integration/update.bats
Lines 119 to 121 in a837eeb
@lifubang I'm not sure why this comment is related to this PR. In here I am just fixing some issues with the test. |
runc/tests/integration/update.bats Lines 119 to 121 in a837eeb Indeed it does remove both memory and swap limits in v2, and the test is checking it (see commit commit 18ebc51). IOW it's not a bug, it's a feature. (and I still don't understand how this question relates to this PR) |
Because with your patch, I still can get an error when test this case. This is because: so, need to move this test to the if condition check: runc/tests/integration/update.bats Line 120 in a837eeb |
Thanks, I think I understand it now. Added two more commits, untested locally, please give it a try @lifubang. |
I'll check it later, once I'm sitting in the front of my PC with an old kernel. |
If swap is disabled, we should not run swap tests. Fixes 4166. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
1. Add "-maxdepth 2" to not dive too deep into cgroup hierarchy. 2. Add "-type f" to look for a regular file. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
In case of cgroup v2, there's no memory.swap.max in the top-level cgroup, so we have to use find. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
When swap is being disabled (as set to 0), or set to max, ignore non-existent memory.swap.max cgroup file. If swap is being set explicitly to some value, do return an error like before. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
There are cgroup v2 systems out there that do not have cgroup swap enabled, and this test will probably fail in there. Move it to a separate case, guarded with requires cgroups_swap. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
|
Maybe the forth commit(4209439) should be backported to release-1.1? |
See individual commits for details.
Fixes #4166