]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
pid1: don't connect to oomd in test runs
authorLennart Poettering <lennart@poettering.net>
Thu, 13 Mar 2025 10:13:44 +0000 (11:13 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Sat, 22 Mar 2025 15:51:44 +0000 (15:51 +0000)
(cherry picked from commit ec5bcf0b699bcd9d6cc597a73317f0540031ad20)

src/core/core-varlink.c

index 8cdff3a974807c66a15ffc480d257de9e010d603..ceffb76def6b3779307f631e43228f852a146623 100644 (file)
@@ -160,6 +160,9 @@ static int manager_varlink_send_managed_oom_initial(Manager *m) {
         if (!MANAGER_IS_USER(m))
                 return 0;
 
+        if (MANAGER_IS_TEST_RUN(m))
+                return 0;
+
         assert(m->managed_oom_varlink);
 
         r = build_managed_oom_cgroups_json(m, &v);
@@ -206,6 +209,9 @@ static int manager_varlink_managed_oom_connect(Manager *m) {
         if (!MANAGER_IS_USER(m))
                 return -EINVAL;
 
+        if (MANAGER_IS_TEST_RUN(m))
+                return 0;
+
         r = sd_varlink_connect_address(&link, VARLINK_ADDR_PATH_MANAGED_OOM_USER);
         if (r == -ENOENT)
                 return 0;
@@ -245,6 +251,9 @@ int manager_varlink_send_managed_oom_update(Unit *u) {
         if (!UNIT_VTABLE(u)->can_set_managed_oom || !u->manager)
                 return 0;
 
+        if (MANAGER_IS_TEST_RUN(u->manager))
+                return 0;
+
         crt = unit_get_cgroup_runtime(u);
         if (!crt || !crt->cgroup_path)
                 return 0;