test: failing reproducer - instance not stopped on setup error - #947
Draft
lengau wants to merge 2 commits into
Draft
test: failing reproducer - instance not stopped on setup error#947lengau wants to merge 2 commits into
lengau wants to merge 2 commits into
Conversation
Adds two regression tests demonstrating that instances are left running when base_configuration.setup() raises an error: - test_instance_stopped_when_setup_fails: regular instance (no base) - test_base_instance_stopped_when_setup_fails: base instance path Fixes: #447 Fixes: #757 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Collaborator
Author
|
@copilot write a minimal fix for these tests. |
Agent-Logs-Url: https://github.com/canonical/craft-providers/sessions/897a05fc-d951-4e24-9a14-2f2cf4e510d8 Co-authored-by: lengau <4305943+lengau@users.noreply.github.com>
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reproducer for #447 and #757
Adds two failing tests that demonstrate instances are left running when
base_configuration.setup()raises an error.Root cause
In
_create_instance()inlauncher.py,instance.stop()/base_instance.stop()are only called whensetup()succeeds. Ifsetup()raises, the instance is left running.Failing tests
test_instance_stopped_when_setup_fails: regular instance path (issue craft-providers leaves base lxd instance running on error #757)test_base_instance_stopped_when_setup_fails: base instance path (issue Base instance does not stop when setup fails #447)Fix
Wrap the
setup()+stop()calls in_create_instance()in atry/finallyblock.Closes #447
Closes #757