From 516301c02bee18c32ebbd877e37f9ab5908d8bce Mon Sep 17 00:00:00 2001 From: Karolina Surma Date: Fri, 13 Jun 2025 14:39:27 +0200 Subject: [PATCH] Skip tests creating system units in RPM environment Attempting to run them during the RPM build ends with an error: 'Failed to create directory '/run/systemd/': Permission denied' --- stages/test/test_systemd_unit_create.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/stages/test/test_systemd_unit_create.py b/stages/test/test_systemd_unit_create.py index 582b7450..eb2af02f 100644 --- a/stages/test/test_systemd_unit_create.py +++ b/stages/test/test_systemd_unit_create.py @@ -469,6 +469,8 @@ def test_systemd_unit_create(tmp_path, stage_module, unit_type, unit_path, expec stage_module.main(tmp_path, options) assert os.path.exists(expected_unit_path) if unit_type == "system": + if os.environ.get("RPM_BUILD_ROOT"): + pytest.skip("systemd-analyze can't be run in the RPM build root environment") # When verifying user units, systemd expects runtime directories and more generally a booted system. Setting # something up like that to verify it is more trouble than it's worth, especially since the system units are # identical. @@ -562,6 +564,8 @@ def test_systemd_unit_create_mount(tmp_path, stage_module, unit_type, unit_path, stage_module.main(tmp_path, options) assert os.path.exists(expected_unit_path) if unit_type == "system": + if os.environ.get("RPM_BUILD_ROOT"): + pytest.skip("systemd-analyze can't be run in the RPM build root environment") # When verifying user units, systemd expects runtime directories and more generally a booted system. Setting # something up like that to verify it is more trouble than it's worth, especially since the system units are # identical.