Merge pull request #2439 from kolyshkin/int-noswap
integration tests fixes for no swap ctrl case
This commit is contained in:
commit
dbe5acade3
|
@ -112,11 +112,11 @@ function teardown() {
|
|||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "events oom " {
|
||||
@test "events oom" {
|
||||
# XXX: currently cgroups require root containers.
|
||||
requires root
|
||||
requires root cgroups_swap
|
||||
init_cgroup_paths
|
||||
|
||||
|
||||
# we need the container to hit OOM, so disable swap
|
||||
# ("swap" here is actually memory+swap)
|
||||
DATA=$(cat <<EOF
|
||||
|
|
|
@ -266,6 +266,12 @@ function requires() {
|
|||
skip_me=1
|
||||
fi
|
||||
;;
|
||||
cgroups_swap)
|
||||
init_cgroup_paths
|
||||
if [ $CGROUP_UNIFIED = "no" -a ! -e "${CGROUP_MEMORY_BASE_PATH}/memory.memsw.limit_in_bytes" ]; then
|
||||
skip_me=1
|
||||
fi
|
||||
;;
|
||||
cgroups_v1)
|
||||
init_cgroup_paths
|
||||
if [ "$CGROUP_UNIFIED" != "no" ]; then
|
||||
|
|
|
@ -69,7 +69,10 @@ EOF
|
|||
MEM_SWAP="memory.memsw.limit_in_bytes"
|
||||
SD_MEM_SWAP="unsupported"
|
||||
SYSTEM_MEM=$(cat "${CGROUP_MEMORY_BASE_PATH}/${MEM_LIMIT}")
|
||||
SYSTEM_MEM_SWAP=$(cat "${CGROUP_MEMORY_BASE_PATH}/$MEM_SWAP")
|
||||
HAVE_SWAP="no"
|
||||
if [ -f "${CGROUP_MEMORY_BASE_PATH}/${MEM_SWAP}" ]; then
|
||||
HAVE_SWAP="yes"
|
||||
fi
|
||||
;;
|
||||
yes)
|
||||
MEM_LIMIT="memory.max"
|
||||
|
@ -79,8 +82,7 @@ EOF
|
|||
MEM_SWAP="memory.swap.max"
|
||||
SD_MEM_SWAP="MemorySwapMax"
|
||||
SYSTEM_MEM="max"
|
||||
SYSTEM_MEM_SWAP="max"
|
||||
CGROUP_MEMORY=$CGROUP_PATH
|
||||
HAVE_SWAP="yes"
|
||||
;;
|
||||
esac
|
||||
SD_UNLIMITED="infinity"
|
||||
|
@ -126,11 +128,11 @@ EOF
|
|||
check_systemd_value "$SD_MEM_RESERVE" 33554432
|
||||
|
||||
# Run swap memory tests if swap is available
|
||||
if [ -f "$CGROUP_MEMORY/$MEM_SWAP" ]; then
|
||||
if [ "$HAVE_SWAP" = "yes" ]; then
|
||||
# try to remove memory swap limit
|
||||
runc update test_update --memory-swap -1
|
||||
[ "$status" -eq 0 ]
|
||||
check_cgroup_value "$MEM_SWAP" $SYSTEM_MEM_SWAP
|
||||
check_cgroup_value "$MEM_SWAP" $SYSTEM_MEM
|
||||
check_systemd_value "$SD_MEM_SWAP" $SD_UNLIMITED
|
||||
|
||||
# update memory swap
|
||||
|
@ -158,7 +160,7 @@ EOF
|
|||
check_systemd_value $SD_MEM_LIMIT $SD_UNLIMITED
|
||||
|
||||
# check swap memory limited is gone
|
||||
if [ -f "$CGROUP_MEMORY/$MEM_SWAP" ]; then
|
||||
if [ "$HAVE_SWAP" = "yes" ]; then
|
||||
check_cgroup_value $MEM_SWAP $SYSTEM_MEM
|
||||
check_systemd_value "$SD_MEM_SWAP" $SD_UNLIMITED
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue