diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-10-16 08:12:32 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-10-16 08:17:31 +0200 |
commit | 665882f8f3d9dee4dac84d244e253db956fd94ab (patch) | |
tree | c7dcd27fb518cecb7a9965f3e99c5c21b1199edf /test/units/TEST-55-OOMD.sh | |
parent | TEST-55-OOMD: split into small testcases (diff) | |
download | systemd-665882f8f3d9dee4dac84d244e253db956fd94ab.tar.xz systemd-665882f8f3d9dee4dac84d244e253db956fd94ab.zip |
TEST-55-OOMD: check slice more in detail
system and user slice has same name, hence we need to check full path.
Diffstat (limited to '')
-rwxr-xr-x | test/units/TEST-55-OOMD.sh | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/test/units/TEST-55-OOMD.sh b/test/units/TEST-55-OOMD.sh index 43a9919165..ac49643074 100755 --- a/test/units/TEST-55-OOMD.sh +++ b/test/units/TEST-55-OOMD.sh @@ -96,13 +96,16 @@ else fi test_basic() { + local cgroup_path="${1:?}" + shift + systemctl "$@" start TEST-55-OOMD-testchill.service systemctl "$@" start TEST-55-OOMD-testbloat.service # Verify systemd-oomd is monitoring the expected units. - timeout 1m bash -xec 'until oomctl | grep "/TEST-55-OOMD-workload.slice"; do sleep 1; done' - oomctl | grep "/TEST-55-OOMD-workload.slice" - oomctl | grep "20.00%" + timeout 1m bash -xec "until oomctl | grep -q -F 'Path: $cgroup_path'; do sleep 1; done" + assert_in 'Memory Pressure Limit: 20.00%' \ + "$(oomctl | tac | sed -e '/Memory Pressure Monitored CGroups:/q' | tac | grep -A7 "Path: $cgroup_path")" systemctl "$@" status TEST-55-OOMD-testchill.service @@ -122,14 +125,15 @@ test_basic() { } testcase_basic_system() { - test_basic + test_basic /TEST.slice/TEST-55.slice/TEST-55-OOMD.slice/TEST-55-OOMD-workload.slice } testcase_basic_user() { # Make sure we also work correctly on user units. loginctl enable-linger testuser - test_basic --machine "testuser@.host" --user + test_basic "/user.slice/user-$(id -u testuser).slice/user@$(id -u testuser).service/TEST.slice/TEST-55.slice/TEST-55-OOMD.slice/TEST-55-OOMD-workload.slice" \ + --machine "testuser@.host" --user loginctl disable-linger testuser } |