diff options
author | Sea-Eun Lee <seaeunlee@microsoft.com> | 2024-11-18 20:13:40 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2025-01-14 14:42:23 +0100 |
commit | 015a3b8cb1d40d420eaa961e27cdee463f57f8a0 (patch) | |
tree | 19bc2336378ef6b6415fd9ed1e73da6bf3856156 /test | |
parent | core: serialize API bus id and validate before deserializing bus tracks, plus... (diff) | |
download | systemd-015a3b8cb1d40d420eaa961e27cdee463f57f8a0.tar.xz systemd-015a3b8cb1d40d420eaa961e27cdee463f57f8a0.zip |
oomd: support reloading configuration at runtime
Diffstat (limited to 'test')
-rwxr-xr-x | test/units/TEST-55-OOMD.sh | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/units/TEST-55-OOMD.sh b/test/units/TEST-55-OOMD.sh index 3c9b4391a9..6679337858 100755 --- a/test/units/TEST-55-OOMD.sh +++ b/test/units/TEST-55-OOMD.sh @@ -264,6 +264,40 @@ EOF systemctl daemon-reload } +testcase_reload() { + # Check if the oomd.conf drop-in config is loaded. + assert_in 'Swap Used Limit: 90.00%' "$(oomctl)" + assert_in 'Default Memory Pressure Limit: 60.00%' "$(oomctl)" + assert_in 'Default Memory Pressure Duration: 2s' "$(oomctl)" + + # Test oomd reload + mkdir -p /run/systemd/oomd.conf.d/ + { + echo "[OOM]" + echo "SwapUsedLimit=80%" + echo "DefaultMemoryPressureLimit=55%" + echo "DefaultMemoryPressureDurationSec=5s" + } >/run/systemd/oomd.conf.d/99-oomd-test.conf + + systemctl reload systemd-oomd.service + assert_in 'Swap Used Limit: 80.00%' "$(oomctl)" + assert_in 'Default Memory Pressure Limit: 55.00%' "$(oomctl)" + assert_in 'Default Memory Pressure Duration: 5s' "$(oomctl)" + + # Set back to default via reload + mkdir -p /run/systemd/oomd.conf.d/ + { + echo "[OOM]" + echo "DefaultMemoryPressureDurationSec=2s" + } >/run/systemd/oomd.conf.d/99-oomd-test.conf + + systemctl reload systemd-oomd.service + + assert_in 'Swap Used Limit: 90.00%' "$(oomctl)" + assert_in 'Default Memory Pressure Limit: 60.00%' "$(oomctl)" + assert_in 'Default Memory Pressure Duration: 2s' "$(oomctl)" +} + run_testcases systemd-analyze log-level info |