core: don't export per-unit metadata files in test mode
authorLennart Poettering <lennart@poettering.net>
Thu, 19 Apr 2018 08:34:58 +0000 (10:34 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 19 Apr 2018 09:30:18 +0000 (11:30 +0200)
We shouldn't clobber the host's /run directories with metadata we export
for our units when we run in test mode.

src/core/unit.c

index 01e7cc9..6affc65 100644 (file)
@@ -5169,6 +5169,9 @@ void unit_export_state_files(Unit *u) {
         if (!MANAGER_IS_SYSTEM(u->manager))
                 return;
 
+        if (u->manager->test_run_flags != 0)
+                return;
+
         /* Exports a couple of unit properties to /run/systemd/units/, so that journald can quickly query this data
          * from there. Ideally, journald would use IPC to query this, like everybody else, but that's hard, as long as
          * the IPC system itself and PID 1 also log to the journal.