This repository was archived by the owner on Apr 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 163
[RFR] Remove local VM fixtures and replace usage with global create_vm fixture. #10229
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
9fa15ee
Remove new_vm fixture and replace usage with create_vm in test_vm_mig…
prichard77 3d61c3b
Update test_vm_ownership.py to use create_vm
prichard77 4eaaac6
Update TestControlOnQuadicons in test_vm_power_control.py for create_…
prichard77 ccd2cbd
Update vm_name fixture to use create_vm.name
prichard77 6eb2dc6
Update the rest of test_vm_power_control.py to use create_vm
prichard77 e5e2f17
Update the rest of test_vm_reconfigure.py to use create_vm
prichard77 9e7bb41
Add create_vm back where rebase removed it
prichard77 405ed89
Update _create_vm to handle exception thrown by provider.refresh_prov…
prichard77 449b522
Update except so exceptions other than Provider collection empty will…
prichard77 7b27c29
Update refresh_provider_relationships to use LookupError instead of E…
prichard77 08ac103
Catch TimeOutError in cleanup_on_provider and log it
prichard77 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,6 @@ | |
| from cfme.infrastructure.provider.rhevm import RHEVMProvider | ||
| from cfme.infrastructure.provider.virtualcenter import VMwareProvider | ||
| from cfme.utils.appliance.implementations.ui import navigate_to | ||
| from cfme.utils.generators import random_vm_name | ||
| from cfme.utils.log_validator import LogValidator | ||
|
|
||
|
|
||
|
|
@@ -17,25 +16,7 @@ | |
| ] | ||
|
|
||
|
|
||
| @pytest.fixture() | ||
| def new_vm(setup_provider, provider): | ||
| """Fixture to provision appliance to the provider being tested if necessary""" | ||
| vm_name = random_vm_name(context='migrate') | ||
| try: | ||
| template_name = provider.data.templates.small_template.name | ||
| except AttributeError: | ||
| pytest.skip('Could not find templates.small_template.name in provider yaml: {}' | ||
| .format(provider.data)) | ||
|
|
||
| vm = provider.appliance.collections.infra_vms.instantiate(vm_name, provider, template_name) | ||
|
|
||
| if not provider.mgmt.does_vm_exist(vm_name): | ||
| vm.create_on_provider(find_in_cfme=True, allow_skip="default") | ||
| yield vm | ||
| vm.cleanup_on_provider() | ||
|
|
||
|
|
||
| def test_vm_migrate(appliance, new_vm, provider): | ||
| def test_vm_migrate(appliance, create_vm, provider): | ||
| """Tests migration of a vm | ||
|
|
||
| Metadata: | ||
|
|
@@ -47,15 +28,15 @@ def test_vm_migrate(appliance, new_vm, provider): | |
| initialEstimate: 1/4h | ||
| """ | ||
| # auto_test_services should exist to test migrate VM | ||
| view = navigate_to(new_vm, 'Details') | ||
| view = navigate_to(create_vm, 'Details') | ||
| vm_host = view.entities.summary('Relationships').get_text_of('Host') | ||
| hosts = [vds.name for vds in provider.hosts.all() if vds.name not in vm_host] | ||
| if hosts: | ||
| migrate_to = hosts[0] | ||
| else: | ||
| pytest.skip("There is only one host in the provider") | ||
| new_vm.migrate_vm("[email protected]", "first", "last", host=migrate_to) | ||
| request_description = new_vm.name | ||
| create_vm.migrate_vm("[email protected]", "first", "last", host=migrate_to) | ||
| request_description = create_vm.name | ||
| cells = {'Description': request_description, 'Request Type': 'Migrate'} | ||
| migrate_request = appliance.collections.requests.instantiate(request_description, cells=cells, | ||
| partial_check=True) | ||
|
|
||
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
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
Exceptionrisen.Optional:
I would suggest to include this and change accordingly.:
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.