tests/integration: rm kmem from upgrade tests

... and add kmem-tcp to cgroups kmem test.

First, we already have a separate kmem test in cgroups.bats.

Second, making kmem a requirement leads to skipping all the other
test cases in the update.bats test.

Third, kmem limit is being removed from the kernel, so it makes sense
to handle it separately.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin 2020-03-30 14:00:35 -07:00
parent ba3ee7fe04
commit b8b46419ce
2 changed files with 15 additions and 37 deletions

View File

@ -14,7 +14,7 @@ function setup() {
setup_busybox
}
@test "runc update --kernel-memory (initialized)" {
@test "runc update --kernel-memory{,-tcp} (initialized)" {
[[ "$ROOTLESS" -ne 0 ]] && requires rootless_cgroup
requires cgroups_kmem
@ -23,7 +23,8 @@ function setup() {
# Set some initial known values
DATA=$(cat <<-EOF
"memory": {
"kernel": 16777216
"kernel": 16777216,
"kernelTCP": 11534336
},
EOF
)
@ -35,13 +36,17 @@ EOF
[ "$status" -eq 0 ]
check_cgroup_value "memory.kmem.limit_in_bytes" 16777216
check_cgroup_value "memory.kmem.tcp.limit_in_bytes" 11534336
# update kernel memory limit
runc update test_cgroups_kmem --kernel-memory 50331648
[ "$status" -eq 0 ]
# check the value
check_cgroup_value "memory.kmem.limit_in_bytes" 50331648
# update kernel memory tcp limit
runc update test_cgroups_kmem --kernel-memory-tcp 41943040
[ "$status" -eq 0 ]
check_cgroup_value "memory.kmem.tcp.limit_in_bytes" 41943040
}
@test "runc update --kernel-memory (uninitialized)" {

View File

@ -19,9 +19,7 @@ function setup() {
DATA=$(cat <<EOF
"memory": {
"limit": 33554432,
"reservation": 25165824,
"kernel": 16777216,
"kernelTCP": 11534336
"reservation": 25165824
},
"cpu": {
"shares": 100,
@ -39,10 +37,7 @@ EOF
}
@test "update" {
# XXX: Also, this test should be split into separate sections so that we
# can skip kmem without skipping update tests overall.
[[ "$ROOTLESS" -ne 0 ]] && requires rootless_cgroup
requires cgroups_kmem
# run a few busyboxes detached
runc run -d --console-socket $CONSOLE_SOCKET test_update
@ -53,8 +48,6 @@ EOF
check_cgroup_value "cpu.cfs_quota_us" 500000
check_cgroup_value "cpu.shares" 100
check_cgroup_value "cpuset.cpus" 0
check_cgroup_value "memory.kmem.limit_in_bytes" 16777216
check_cgroup_value "memory.kmem.tcp.limit_in_bytes" 11534336
check_cgroup_value "memory.limit_in_bytes" 33554432
check_cgroup_value "memory.soft_limit_in_bytes" 25165824
check_cgroup_value "pids.max" 20
@ -125,16 +118,6 @@ EOF
check_cgroup_value "memory.memsw.limit_in_bytes" ${SYSTEM_MEMORY}
fi
# update kernel memory limit
runc update test_update --kernel-memory 50331648
[ "$status" -eq 0 ]
check_cgroup_value "memory.kmem.limit_in_bytes" 50331648
# update kernel memory tcp limit
runc update test_update --kernel-memory-tcp 41943040
[ "$status" -eq 0 ]
check_cgroup_value "memory.kmem.tcp.limit_in_bytes" 41943040
# update pids limit
runc update test_update --pids-limit 10
[ "$status" -eq 0 ]
@ -145,9 +128,7 @@ EOF
{
"memory": {
"limit": 33554432,
"reservation": 25165824,
"kernel": 16777216,
"kernelTCP": 11534336
"reservation": 25165824
},
"cpu": {
"shares": 100,
@ -165,23 +146,19 @@ EOF
check_cgroup_value "cpu.cfs_quota_us" 500000
check_cgroup_value "cpu.shares" 100
check_cgroup_value "cpuset.cpus" 0
check_cgroup_value "memory.kmem.limit_in_bytes" 16777216
check_cgroup_value "memory.kmem.tcp.limit_in_bytes" 11534336
check_cgroup_value "memory.limit_in_bytes" 33554432
check_cgroup_value "memory.soft_limit_in_bytes" 25165824
check_cgroup_value "pids.max" 20
# redo all the changes at once
runc update test_update \
--cpu-period 900000 --cpu-quota 600000 --cpu-share 200 --memory 67108864 \
--memory-reservation 33554432 --kernel-memory 50331648 --kernel-memory-tcp 41943040 \
--cpu-period 900000 --cpu-quota 600000 --cpu-share 200 \
--memory 67108864 --memory-reservation 33554432 \
--pids-limit 10
[ "$status" -eq 0 ]
check_cgroup_value "cpu.cfs_period_us" 900000
check_cgroup_value "cpu.cfs_quota_us" 600000
check_cgroup_value "cpu.shares" 200
check_cgroup_value "memory.kmem.limit_in_bytes" 50331648
check_cgroup_value "memory.kmem.tcp.limit_in_bytes" 41943040
check_cgroup_value "memory.limit_in_bytes" 67108864
check_cgroup_value "memory.soft_limit_in_bytes" 33554432
check_cgroup_value "pids.max" 10
@ -191,9 +168,7 @@ EOF
{
"memory": {
"limit": 33554432,
"reservation": 25165824,
"kernel": 16777216,
"kernelTCP": 11534336
"reservation": 25165824
},
"cpu": {
"shares": 100,
@ -215,8 +190,6 @@ EOF
check_cgroup_value "cpu.cfs_quota_us" 500000
check_cgroup_value "cpu.shares" 100
check_cgroup_value "cpuset.cpus" 0
check_cgroup_value "memory.kmem.limit_in_bytes" 16777216
check_cgroup_value "memory.kmem.tcp.limit_in_bytes" 11534336
check_cgroup_value "memory.limit_in_bytes" 33554432
check_cgroup_value "memory.soft_limit_in_bytes" 25165824
check_cgroup_value "pids.max" 20
@ -224,7 +197,7 @@ EOF
@test "update rt period and runtime" {
[[ "$ROOTLESS" -ne 0 ]] && requires rootless_cgroup
requires cgroups_kmem cgroups_rt
requires cgroups_rt
# run a detached busybox
runc run -d --console-socket $CONSOLE_SOCKET test_update_rt