Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

[RFR] New test: test_reconfigure_vm_vmware_multiple #10236

Merged
merged 2 commits into from
Jul 10, 2020

Conversation

valaparthvi
Copy link
Contributor

@valaparthvi valaparthvi commented Jul 3, 2020

Purpose or Intent

  • Fixing
    1. InfraVmReconfigureView.is_displayed to work when reconfiguring multiple VMs.
  • Adding tests
    1. test_reconfigure_vm_vmware_multiple
      -Deleting tests
    2. test_reconfigure_vm_vmware_sockets_multiple
    3. test_vm_reconfigure_from_global_region
    4. test_reconfigure_add_disk_cold_controller_sas
    5. test_reconfigure_add_disk_cold

PRT Run

{{ pytest: cfme/tests/infrastructure/test_vm_reconfigure.py::test_reconfigure_vm_vmware_multiple --use-provider=vsphere67-nested --long-running -svvv }}

@valaparthvi valaparthvi added fix-framework test-cleanup Test removal, collection changes, re-organization test-automation To be applied on PR's which are automating existing manual cases labels Jul 3, 2020
@valaparthvi valaparthvi changed the title [WIPTEST] New test: test_reconfigure_vm_vmware_multiple [RFR] New test: test_reconfigure_vm_vmware_multiple Jul 8, 2020
full_vm.wait_for_vm_state_change(full_vm.STATE_ON)
else:
raise Exception("Unknown power state - unable to continue!")
raise Exception("Unknown power state - unable to continue!")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: Umn, I would rather used either AssertionError or ValueError here to be more specific.

view = navigate_to(reconfig_request.parent, "All")
# Get the latest request
request_id = max(
[
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The list is redundant here.

"""
vms = create_vms_modscope
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional:

I think you are expecting only one vm to get created here, but I am not sure. I like to do this:

vms, = create_vms_modscope

This makes clear the only single vm is expected. Also this statement has an advantage that it fails when there are more or less than expected vms returned by the fixture and I think it can be statically checked as well in many situations, so we may see a problem with static type checker.

Copy link
Contributor Author

@valaparthvi valaparthvi Jul 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am expecting 2 vms here, I need the whole vms list to get entities and navigate to the reconfiguration page. We already have tests to check reconfiguration for 1 VM, we're testing for multiple VMs here.
But to make sure I receive 2 vms, I added one more item({"num_vms": 2}) to the create_vms_modscope parametrization to ensure it creates 2 vms, incase someone changes default value in the fixture. So as long as there's no other change in the fixture, it will work just fine for me.

try:
reconfig_request.remove_request()
except (RequestException, NoSuchElementException):
# sometimes the delete button is not present on the page.
Copy link
Contributor

@jarovo jarovo Jul 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the comment! It is helpful for me as a reader of the code.

new_memory = current_memory + 1
else:
if current_memory < 1:
pytest.skip("Cannot test when the value is less than the minimum required.")
Copy link
Contributor

@jarovo jarovo Jul 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional nitpick:

The skip message seem to say something different than what the code seem to be doing. I think it should read
"Cannot decrease memory bellow 1".

I mean: I cannot find the code which gets the info about what is the minimum requirement. There is just an assumption the minimum is 1, but it could be something else, like 3, right?

new_processor = current_processors + 1
else:
if current_processors < 1:
pytest.skip("Cannot test when value is less than the minimum required.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is double space on this line.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sharp eye!

Copy link
Contributor

@jarovo jarovo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found just the double-space which I think should be fixed, otherwise I probably am just nitpicking.

@dajoRH
Copy link
Contributor

dajoRH commented Jul 9, 2020

I detected some fixture changes in commit 54cc0b5

The global fixture create_vms_modscope is used in the following files:

  • cfme/tests/infrastructure/test_vm_reconfigure.py
    • multiple_vm_state

The global fixture create_vms is used in the following files:

  • cfme/tests/cloud_infra_common/test_retirement.py
    • test_retirement_now_multiple
    • test_set_retirement_date_multiple
    • test_set_retirement_offset_multiple

The local fixture vm_state is used in the following files:

  • cfme/tests/infrastructure/test_vm_reconfigure.py
    • test_vm_reconfig_add_remove_disk
    • test_vm_reconfig_resize_disk

The local fixture multiple_vm_state is used in the following files:

  • cfme/tests/infrastructure/test_vm_reconfigure.py

Please, consider creating a PRT run to make sure your fixture changes do not break existing usage 😃

@valaparthvi
Copy link
Contributor Author

Thank you for the review @JaryN, your suggestion were good!

Copy link
Contributor

@niyazRedhat niyazRedhat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. thanks for automating :)

@pytest.mark.tier(2)
@pytest.mark.provider([VMwareProvider])
def test_reconfigure_vm_vmware_mem_multiple():
@pytest.mark.provider([VMwareProvider], selector=ONE_PER_TYPE, scope="module")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is effectively a ONE selector, as VMwareProvider is a single type.

@mshriver mshriver merged commit 82d0cf4 into ManageIQ:master Jul 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
fix-framework test-automation To be applied on PR's which are automating existing manual cases test-cleanup Test removal, collection changes, re-organization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants