-
Notifications
You must be signed in to change notification settings - Fork 1.2k
use cleanup mechs on TestNetworkMigration #11945
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 4.20
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -109,12 +109,14 @@ def setUpClass(cls): | |||
| cls.api_client, | ||||
| cls.test_data["service_offerings"]["tiny"] | ||||
| ) | ||||
| cls._cleanup.append(cls.service_offering) | ||||
|
|
||||
| # Create Network offering without userdata | ||||
| cls.network_offering_nouserdata = NetworkOffering.create( | ||||
| cls.api_client, | ||||
| cls.test_data["network_offering"] | ||||
| ) | ||||
| cls._cleanup.append(cls.network_offering_nouserdata) | ||||
| # Enable Network offering | ||||
| cls.network_offering_nouserdata.update(cls.api_client, | ||||
| state='Enabled') | ||||
|
|
@@ -124,54 +126,39 @@ def setUpClass(cls): | |||
| cls.api_client, | ||||
| cls.test_data["isolated_network_offering"] | ||||
| ) | ||||
| cls._cleanup.append(cls.network_offering_all) | ||||
| # Enable Network offering | ||||
| cls.network_offering_all.update(cls.api_client, state='Enabled') | ||||
|
|
||||
| cls.native_vpc_network_offering = NetworkOffering.create( | ||||
| cls.api_client, | ||||
| cls.test_data["nw_offering_isolated_vpc"], | ||||
| conservemode=False) | ||||
| cls._cleanup.append(cls.native_vpc_network_offering) | ||||
| cls.native_vpc_network_offering.update(cls.api_client, | ||||
| state='Enabled') | ||||
|
|
||||
| cls._cleanup = [ | ||||
| cls.service_offering, | ||||
| cls.network_offering_nouserdata, | ||||
| cls.network_offering_all, | ||||
| cls.native_vpc_network_offering | ||||
| ] | ||||
|
|
||||
| def setUp(self): | ||||
| self.apiclient = self.testClient.getApiClient() | ||||
| self.hypervisor = self.testClient.getHypervisorInfo() | ||||
| self.dbclient = self.testClient.getDbConnection() | ||||
| self.cleanup = [] | ||||
| if not self.hypervisorNotSupported: | ||||
| self.account = Account.create( | ||||
| self.apiclient, | ||||
| self.test_data["account"], | ||||
| admin=True, | ||||
| domainid=self.domain.id | ||||
| ) | ||||
| self.cleanup = [] | ||||
| self.cleanup.append(self.account) | ||||
| return | ||||
|
|
||||
| def tearDown(self): | ||||
| try: | ||||
| if not self.hypervisorNotSupported: | ||||
| self.account.delete(self.apiclient) | ||||
| cleanup_resources(self.apiclient, self.cleanup) | ||||
| except Exception as e: | ||||
| raise Exception("Warning: Exception during cleanup : %s" % e) | ||||
| return | ||||
| super(TestNetworkMigration, self).tearDown() | ||||
|
|
||||
| @classmethod | ||||
| def tearDownClass(cls): | ||||
| try: | ||||
| # Cleanup resources used | ||||
| cleanup_resources(cls.api_client, cls._cleanup) | ||||
|
|
||||
| except Exception as e: | ||||
| raise Exception("Warning: Exception during cleanup : %s" % e) | ||||
| super(TestNetworkMigration, cls).tearDownClass() | ||||
|
|
||||
| def migrate_network(self, nw_off, network, resume=False): | ||||
| return network.migrate(self.api_client, nw_off.id, resume) | ||||
|
|
@@ -204,14 +191,17 @@ def test_01_native_to_native_network_migration(self): | |||
| networkofferingid=self.network_offering_all.id, | ||||
| zoneid=self.zone.id | ||||
| ) | ||||
| self.cleanup.append(isolated_network) | ||||
|
|
||||
| self.migrate_network( | ||||
| self.network_offering_nouserdata, | ||||
| isolated_network, resume=False) | ||||
| self.network_offering_nouserdata, | ||||
| isolated_network, | ||||
| resume=False) | ||||
|
|
||||
| self.migrate_network( | ||||
| self.network_offering_all, | ||||
| isolated_network, resume=False) | ||||
| self.network_offering_all, | ||||
| isolated_network, | ||||
| resume=False) | ||||
|
|
||||
| deployVmResponse = VirtualMachine.create( | ||||
| self.apiclient, | ||||
|
|
@@ -221,14 +211,14 @@ def test_01_native_to_native_network_migration(self): | |||
| serviceofferingid=self.service_offering.id, | ||||
| networkids=[str(isolated_network.id)], | ||||
| templateid=self.template.id, | ||||
| zoneid=self.zone.id | ||||
| ) | ||||
| zoneid=self.zone.id) | ||||
| self.cleanup.append(deployVmResponse) | ||||
|
|
||||
|
||||
Copilot
AI
Oct 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Similar to the previous comment, there's an extra blank line after appending vpc to the cleanup list. This inconsistency in spacing should be addressed to maintain uniform code style throughout the file.
Uh oh!
There was an error while loading. Please reload this page.