Skip to content

Make /per-rule usable ad-hoc, for quick unit test runs #415

@comps

Description

@comps

Currently, the new /per-rule

  • always reinstalls a clean VM before running the tests,
  • always rsyncs everything into it,
  • etc.

and is not really optimized for a use case of a CaC/content developer incrementally making changes to unit tests & quickly testing them via the /from-env test variant.

To improve this, a few things can be changed:

  1. Implement CONTEST_REBUILD_CONTENT, a Contest-wide override for util.build_content() that would behave as if the function was called with rebuild=True. This is useful when a developer incrementally rsyncs small changes to a CONTEST_CONTENT location on the remote machine, without clearing the build/ directory. Forcing a rebuild incorporates the small source file changes.

  2. Implement some VM-snapshot-removal function in lib.virt that would remove the external snapshot and clear any other snapshot-ish files in /var/lib/libvirt/images, and have the /per-rule test do something like:

    if not prepared for snapshot (never installed):
        g.install(...)
    else:
        g.unprepare_snapshot()
    

    effectively resulting in a regular bootable VM (to be set up via with g.booted(): like now) that the test can rsync files to. This should take only a few moments and shouldn't matter if done repeatedly. The rsync should be with --delete to cleanly update any existing content inside the (un-prepared-snapshot) VM, overriding it.

    Maybe do the un-prepare only on some variable, like CONTEST_PER_RULE_REFRESH_VM and rely on repeated test executions just re-using the same snapshot, which would be a good default for >5 slices running in ATEX, reusing remotes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions