Skip to content

Use clean VM snapshot for testing

Amos Kong edited this page Mar 13, 2017 · 2 revisions

Request

Currently we access the disk with write mode, so tests will change the VM disk every time. If the job fails during the testing, there maybe some uncertain condition.

We wish to use a clean environment (VM disk) for some test. Some basic requests:

  • no scylla installed
  • no scylla repo exists

Solution:

  • clean VM as request

  • stop VM

sudo virsh destroy --graceful
  • create an internal (inside old image file) snapshot for original image
sudo virsh snapshot-create-as --domain debian8 --name debian8-orig
  • revert to this snapshot before each tests
sudo virsh snapshot-revert --domain debian8 --snapshotname debian8-orig
sudo virsh start debian8