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:
-
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.
-
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.
Currently, the new
/per-rulersyncs everything into it,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-envtest variant.To improve this, a few things can be changed:
Implement
CONTEST_REBUILD_CONTENT, a Contest-wide override forutil.build_content()that would behave as if the function was called withrebuild=True. This is useful when a developer incrementallyrsyncs small changes to aCONTEST_CONTENTlocation on the remote machine, without clearing thebuild/directory. Forcing a rebuild incorporates the small source file changes.Implement some VM-snapshot-removal function in
lib.virtthat would remove the external snapshot and clear any other snapshot-ish files in/var/lib/libvirt/images, and have the/per-ruletest do something like:effectively resulting in a regular bootable VM (to be set up via
with g.booted():like now) that the test canrsyncfiles to. This should take only a few moments and shouldn't matter if done repeatedly. Thersyncshould be with--deleteto 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_VMand 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.