-
Notifications
You must be signed in to change notification settings - Fork 165
[RFR] Remove local VM fixtures and replace usage with global create_vm fixture. #10229
Conversation
test_vm_migrate did previously use a fixture that put "migrate" into the vm name. I don't believe we have support for altering the name in create_vm but I'll double check. Should we even worry about adding "migrate' to the name? |
49d239e
to
e5e2f17
Compare
Some of these are failing and I am going thru and trying to determine if the tests were failing initially. |
making RFR so I can see in active PRs on Ostriz |
test_vm_ownership.py - test_rename_vm[virtualcenter] fails in cleanup. Is this related to the fact we did rename? |
Here is the rest of my notes from retesting the last PRT run. I am including the ones I put above so they will be in one place.
|
i believe the orphan tests are failing teardown because they are orphans. We are getting failures for an empty Provider collection and I believe this would be expected for orphans. Still looking for confirmation. |
…ider_relationships() when using orphaned VMs
I updated _cleaup in _create_vm to catch the "Provider collection empty" exception. |
I do believe |
provider.refresh_provider_relationships() | ||
try: | ||
provider.refresh_provider_relationships() | ||
except Exception as e: |
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.
Hey! Good job matching the args when we only have the too-broad Exception
risen.
Optional:
I would suggest to include this and change accordingly.:
diff --git a/cfme/common/provider.py b/cfme/common/provider.py
index 11933a7c2..a3d0cd792 100644
--- a/cfme/common/provider.py
+++ b/cfme/common/provider.py
@@ -801,9 +801,10 @@ class BaseProvider(Taggable, Updateable, Navigatable, BaseEntity, CustomButtonEv
col = self.appliance.rest_api.collections.providers.find_by(name=name)
try:
col[0].action.refresh()
- self.wait_for_relationship_refresh(wait, delay, refresh_delta)
except IndexError:
- raise Exception("Provider collection empty")
+ raise LookupError("Provider collection empty")
+ else:
+ self.wait_for_relationship_refresh(wait, delay, refresh_delta)
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.
Sure. And then also catch the more specific LookupError instead of just an Exception in _cleanup().
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.
I don't know why we'd want the else clause, however.
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.
Changing exception but not adding else.
I updated cleanup_on_provider to catch TimeOutError and log it. This fixes the failure on cleanup for test_rename_vm. |
I detected some fixture changes in commit 08ac103 Show fixturesThe local fixture
The local fixture
The local fixture
The local fixture
The local fixture
The local fixture
The local fixture
The local fixture
Please, consider creating a PRT run to make sure your fixture changes do not break existing usage 😃 |
…m fixture. (ManageIQ#10229) * Remove new_vm fixture and replace usage with create_vm in test_vm_migrate.py * Update test_vm_ownership.py to use create_vm * Update TestControlOnQuadicons in test_vm_power_control.py for create_vm usage * Update vm_name fixture to use create_vm.name * Update the rest of test_vm_power_control.py to use create_vm * Update the rest of test_vm_reconfigure.py to use create_vm * Add create_vm back where rebase removed it * Update _create_vm to handle exception thrown by provider.refresh_provider_relationships() when using orphaned VMs * Update except so exceptions other than Provider collection empty will get raised * Update refresh_provider_relationships to use LookupError instead of Exception * Catch TimeOutError in cleanup_on_provider and log it
Purpose or Intent
PRT Run
{{ pytest: --long-running cfme/tests/infrastructure/test_vm_migrate.py::test_vm_migrate cfme/tests/infrastructure/test_vm_ownership.py::test_rename_vm --long-running cfme/tests/infrastructure/test_vm_power_control.py cfme/tests/infrastructure/test_vm_reconfigure.py }}