summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSea-Eun Lee <seaeunlee@microsoft.com>2024-11-18 20:13:40 +0100
committerLennart Poettering <lennart@poettering.net>2025-01-14 14:42:23 +0100
commit015a3b8cb1d40d420eaa961e27cdee463f57f8a0 (patch)
tree19bc2336378ef6b6415fd9ed1e73da6bf3856156 /test
parentcore: serialize API bus id and validate before deserializing bus tracks, plus... (diff)
downloadsystemd-015a3b8cb1d40d420eaa961e27cdee463f57f8a0.tar.xz
systemd-015a3b8cb1d40d420eaa961e27cdee463f57f8a0.zip
oomd: support reloading configuration at runtime
Diffstat (limited to 'test')
-rwxr-xr-xtest/units/TEST-55-OOMD.sh34
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