Skip to content

Keep VM snapshots local to a test #376

@comps

Description

@comps

Currently, a test can leave a VM snapshot of a running VM behind (disk+RAM snapshot).

This has the advantage of it being quickly reused by subsequent test re-runs or runs of other tests, but there are several issues:

  • If somebody starts up the VM using ./contest-sshvm, it desyncs (corrupts) both the disk and RAM snapshot, which a subsequent test rerun might not catch
  • It requires re-reading (re-discovering) IP address of the VM in a new test with a fresh class Guest instance
  • It might break SSH if a test tries to run (reuse the snapshot) after NETWORK_EXPIRY hours (7 days)

But mainly, keeping the snapshot around is probably not good design - it keeps the VM in a "fragile" unstable state, which is also a problem for CONTEST_LEAVE_GUEST_RUNNING.

A better solution would be to always keep the VM shut down and without snapshots, but installed-and-ready, between tests.

A test could the easily

  1. boot the VM up (1min?)
  2. wait for boot to settle (30sec?)
  3. Create a persistent ssh connection using ControlMaster
  4. create a disk+RAM snapshot
  5. do testing by (perhaps repeatedly) restoring the snapshot, using the persistent ssh connection
  6. destroy / remove the disk and RAM snapshots

This would also allow hand-tuning of the VM environment for debugging - the test would always re-use an installed VM (given the right tag, eg. Guest() argument), so a human can add some debug/monitoring before rerunning the test. Kind of like manually set-up CONTEST_CONTENT with hand-merged PRs, etc.

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