test: cleanup resources in test_deploy_vm_iso, use base class tearDown#13136
test: cleanup resources in test_deploy_vm_iso, use base class tearDown#13136DaanHoogland wants to merge 3 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13136 +/- ##
============================================
+ Coverage 18.08% 18.37% +0.28%
- Complexity 16718 17202 +484
============================================
Files 6037 6037
Lines 542546 553023 +10477
Branches 66432 70560 +4128
============================================
+ Hits 98146 101631 +3485
- Misses 433378 440189 +6811
- Partials 11022 11203 +181
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR aims to ensure test_deploy_vm_iso properly cleans up created resources by relying on the base cloudstackTestCase tearDown/tearDownClass cleanup mechanisms, so test runs don’t leak ISOs/VMs/accounts into the environment.
Changes:
- Remove the test-specific
tearDown/tearDownClassand rely oncloudstackTestCasecleanup handling. - Standardize the class client attribute name to
cls.apiclientso base-class cleanup can find it. - Add newly created resources (ISO, VM) to
self.cleanupso they’re deleted after each test.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3a234d8 to
acf78ab
Compare
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: dahn <daan.hoogland@gmail.com>
|
@blueorangutan package |
|
@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 18037 |
|
|
@blueorangutan test keepEnv |
|
@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
|
||
| response = self.virtual_machine.getState( | ||
| self.apiclient, | ||
| VirtualMachine.RUNNING) | ||
| self.assertEqual(response[0], PASS, response[1]) | ||
|
|
| list_iso_response = Iso.list( | ||
| self.apiclient, | ||
| id=self.iso.id | ||
| ) | ||
| while not isinstance(list_iso_response, list): | ||
| list_iso_response = Iso.list( | ||
| self.apiclient, | ||
| id=self.iso.id | ||
| ) |
| # Validate the following: | ||
| # 1. deploy VM using ISO | ||
| # 2. listVM command should return the deployed VM. State of this VM | ||
| # should be "Running". | ||
| self.hypervisor = self.testClient.getHypervisorInfo() | ||
| if self.hypervisor.lower() in ['lxc']: | ||
| self.skipTest( | ||
| "vm deploy from ISO feature is not supported on %s" % | ||
| self.hypervisor.lower()) | ||
| # 1. Create an ISO | ||
| # 2. Deploy a VM from the ISO | ||
| # 3. VM should be in 'Running' state | ||
|
|
||
| self.iso = Iso.create( |
| isinstance(list_vm_response, list), | ||
| True, | ||
| "Check list response returns a valid list" | ||
| ) |



The test was creating an ISO and a VirtualMachine without adding them to self.cleanup, so they were never deleted after each test run.
Relates to #3693
Description
This PR...
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?