Skip to content

Commit

Permalink
org.osbuild.systemd: Add unit test
Browse files Browse the repository at this point in the history
Test the new systemd generator masking
This was written by Michael Vogt
  • Loading branch information
alexlarsson committed Dec 15, 2023
1 parent 8e5c0d6 commit 48d4cda
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions stages/test/test_systemd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/python3

import os
import os.path

from osbuild.testutil.imports import import_module_from_path


def test_systemd_masked_generators(tmp_path):
stage_path = os.path.join(os.path.dirname(__file__), "../org.osbuild.systemd")
stage = import_module_from_path("stage", stage_path)

options = {"masked_generators": ["fake-generator"]}

stage.main(tmp_path, options)

masked_generator_path = os.path.join(tmp_path, "etc/systemd/system-generators/fake-generator")
assert os.path.lexists(masked_generator_path)
assert os.readlink(masked_generator_path) == "/dev/null"

0 comments on commit 48d4cda

Please sign in to comment.