Skip to content

Commit

Permalink
re-use an installed VM in /per-rule
Browse files Browse the repository at this point in the history
Signed-off-by: Jiri Jaburek <[email protected]>
  • Loading branch information
comps authored and matusmarhefka committed Apr 25, 2024
1 parent 24423b4 commit 2505af8
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions per-rule/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,14 @@ def report_test_with_log(status, note, log_dir, rule_name, test_name):
our_rules_textblock = textwrap.indent(('\n'.join(our_rules)), ' ')
util.log(f"testing rules:\n{our_rules_textblock}")

g = virt.Guest()

# install a qcow2-backed VM, so automatus.py can snapshot it
# - use hardening-style partitions, automatus tests need them
ks = virt.Kickstart(partitions=partitions.partitions)
g.install(kickstart=ks, disk_format='qcow2')
# tag named after the tool that modifies the VM/image
g = virt.Guest('automatus')

if not g.is_installed():
# install a qcow2-backed VM, so automatus.py can snapshot it
# - use hardening-style partitions, automatus tests need them
ks = virt.Kickstart(partitions=partitions.partitions)
g.install(kickstart=ks, disk_format='qcow2')

with util.get_content() as content_dir, g.booted():
env = os.environ.copy()
Expand Down

0 comments on commit 2505af8

Please sign in to comment.