From 7f589821d4c76fc6ee27b0ec70db2c69d3aedfd9 Mon Sep 17 00:00:00 2001 From: Ignasi Barrera Date: Fri, 24 Mar 2017 17:53:25 +0100 Subject: [PATCH] Provide a method to prepare an before taking an snapshot from it --- .../extensions/internal/BaseImageExtensionLiveTest.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/compute/src/test/java/org/jclouds/compute/extensions/internal/BaseImageExtensionLiveTest.java b/compute/src/test/java/org/jclouds/compute/extensions/internal/BaseImageExtensionLiveTest.java index 4bdd4bbb02..ca337d5dc4 100644 --- a/compute/src/test/java/org/jclouds/compute/extensions/internal/BaseImageExtensionLiveTest.java +++ b/compute/src/test/java/org/jclouds/compute/extensions/internal/BaseImageExtensionLiveTest.java @@ -104,6 +104,8 @@ public abstract class BaseImageExtensionLiveTest extends BaseComputeServiceConte Template template = getNodeTemplate().build(); NodeMetadata node = Iterables.getOnlyElement(computeService.createNodesInGroup(imageGroup, 1, template)); checkReachable(node); + + prepareNodeBeforeCreatingImage(node); logger.info("Creating image from node %s, started with template: %s", node, template); ImageTemplate newImageTemplate = imageExtension.get().buildImageTemplateFromNode(imageGroup, @@ -120,6 +122,13 @@ public abstract class BaseImageExtensionLiveTest extends BaseComputeServiceConte assertTrue(optImage.isPresent()); } + /** + * Subclasses can override this to prepare the node before creating an image (run cleanup scripts, etc) + */ + protected void prepareNodeBeforeCreatingImage(NodeMetadata node) { + + } + @Test(groups = { "integration", "live" }, singleThreaded = true, dependsOnMethods = "testCreateImage") public void testImageIsCachedAfterBeingCreated() { Optional imageInCache = findImageWithNameInCache(imageGroup);