summaryrefslogtreecommitdiff
path: root/tests/integration_tests/clouds.py
diff options
context:
space:
mode:
authorJames Falcon <TheRealFalcon@users.noreply.github.com>2020-12-04 10:56:29 -0600
committerGitHub <noreply@github.com>2020-12-04 09:56:29 -0700
commit974145d063afac3934a9b7c506bebf4318f9424d (patch)
tree361e3376cc7f1e3d459fbf7d57ffda1cca285804 /tests/integration_tests/clouds.py
parent06f7b4522aaa2f5c7f773f42f6c88aed50bb00d5 (diff)
downloadvyos-cloud-init-974145d063afac3934a9b7c506bebf4318f9424d.tar.gz
vyos-cloud-init-974145d063afac3934a9b7c506bebf4318f9424d.zip
Add ability to keep snapshotted images in integration tests (#711)
For SRU test development, every single time we start a new test run, we need to first install the PROPOSED version and create an image snapshot. Instead of automatically deleting a snapshot, add an integration setting to allow us to keep the snapshot. The end of the test run will log the image name which can then be used as the OS_IMAGE in subsequent test runs.
Diffstat (limited to 'tests/integration_tests/clouds.py')
-rw-r--r--tests/integration_tests/clouds.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/tests/integration_tests/clouds.py b/tests/integration_tests/clouds.py
index 8cdb3fcc..ea42b6d5 100644
--- a/tests/integration_tests/clouds.py
+++ b/tests/integration_tests/clouds.py
@@ -166,11 +166,16 @@ class IntegrationCloud(ABC):
def delete_snapshot(self):
if self.snapshot_id:
- log.info(
- 'Deleting snapshot image created for this testrun: %s',
- self.snapshot_id
- )
- self.cloud_instance.delete_image(self.snapshot_id)
+ if self.settings.KEEP_IMAGE:
+ log.info(
+ 'NOT deleting snapshot image created for this testrun '
+ 'because KEEP_IMAGE is True: %s', self.snapshot_id)
+ else:
+ log.info(
+ 'Deleting snapshot image created for this testrun: %s',
+ self.snapshot_id
+ )
+ self.cloud_instance.delete_image(self.snapshot_id)
class Ec2Cloud(IntegrationCloud):