Skip to content

Delete image snapshots created for integration tests#682

Merged
mitechie merged 3 commits into
canonical:masterfrom
TheRealFalcon:delete-snapshots
Nov 30, 2020
Merged

Delete image snapshots created for integration tests#682
mitechie merged 3 commits into
canonical:masterfrom
TheRealFalcon:delete-snapshots

Conversation

@TheRealFalcon
Copy link
Copy Markdown
Contributor

Proposed Commit Message

Delete image snapshots created for integration tests

Additional Context

For integration testing, any time we use a PPA, proposed, or deb image as our cloud init source, we create a snapshot of setup instance to be the image source for the test run. I originally left deleting that snapshot image as a todo since we weren't using those methods much. With the upcoming SRU we'll be using them a ton, so I figured it was finally time to add it.

Test Steps

Run cloud-init integration tests with CLOUD_INIT_SOURCE = 'PROPOSED'. When the tests are done running, list the custom images for the particular cloud in use (e.g., lxc image list for lxd) and verify no snapshot image exists for that particular test run.

Checklist:

  • My code follows the process laid out in the documentation
  • I have updated or added any unit tests accordingly
  • I have updated or added any documentation accordingly


def destroy(self):
self.cloud_instance.delete_resource_group()
if self.settings.KEEP_INSTANCE:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually unrelated to the image snapshot but found while testing Azure.

@TheRealFalcon TheRealFalcon self-assigned this Nov 23, 2020
@paride paride self-requested a review November 24, 2020 15:39
Copy link
Copy Markdown
Contributor

@paride paride left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM, but I'd mention the Azure drive-by fix in the commit message.

Integration tests have been leaving behind snapshot images, so now we
clean them up. Also, in testing, found that in Azure, deleting a
resource group will automatically delete the instance, so if
KEEP_INSTANCE is True, we no longer delete the resource group.
Copy link
Copy Markdown
Collaborator

@OddBloke OddBloke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM and I've confirmed it works locally; thanks!

@mitechie mitechie merged commit 2bd34bd into canonical:master Nov 30, 2020
@TheRealFalcon TheRealFalcon deleted the delete-snapshots branch June 29, 2021 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants