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

[1LP][RFR] Automating retire bundle with multiple VM test #10092

Merged
merged 1 commit into from
Jun 19, 2020

Conversation

niyazRedhat
Copy link
Contributor

@niyazRedhat niyazRedhat commented May 5, 2020

{{pytest: cfme/tests/services/test_service_catalogs_bundles.py::test_retire_service_and_bundle_vms --long-running -svvvv }}

@niyazRedhat niyazRedhat changed the title [WIPTEST] Automating retire bundle with multiple VM test [RFR] Automating retire bundle with multiple VM test May 6, 2020
@niyazRedhat
Copy link
Contributor Author

It passing locally every time.

@dajoRH dajoRH removed the WIP-testing label May 6, 2020
@valaparthvi valaparthvi added the test-automation To be applied on PR's which are automating existing manual cases label May 7, 2020

collection = provider.appliance.provider_based_collection(provider)
vm_name1 = "{}0001".format(catalog_item.prov_data["catalog"]["vm_name"])
vm_name2 = "{}0002".format(catalog_item.prov_data["catalog"]["vm_name"])
Copy link
Contributor

Choose a reason for hiding this comment

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

These can be changed to f-strings.


cat_list.append(catalog_item)
request.addfinalizer(cat_list[i].delete_if_exists)

Copy link
Contributor

Choose a reason for hiding this comment

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

Optional: Is there a need for the index i here? Something like the following would maybe be simpler:

for _ in range(2):
[...]
    cat_list.append(catalog_item)
    request.addfinalizer(catalog_item.delete_if_exists)

prov_data=provisioning_data
)

collection = provider.appliance.provider_based_collection(provider)
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need to be in the for loop?



@pytest.fixture(scope="function")
def catalog_item_setups(appliance, provider, provisioning, request, catalog, dialog):
Copy link
Contributor

Choose a reason for hiding this comment

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

The test is failing in PRT because the provider is not set up in the appliance before catalog item creation. Add the setup_provider_modscope fixture:

def catalog_item_setups(appliance, provider, setup_provider_modscope, provisioning, request, catalog, dialog):

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointing the issue

@john-dupuy john-dupuy changed the title [RFR] Automating retire bundle with multiple VM test [WIPTEST] Automating retire bundle with multiple VM test May 7, 2020
@john-dupuy
Copy link
Contributor

Moving to WIPTEST based on @tpapaioa's comments.

@niyazRedhat niyazRedhat force-pushed the bundle-test branch 2 times, most recently from b4e1072 to ee81aba Compare May 8, 2020 08:19
@dajoRH
Copy link
Contributor

dajoRH commented May 8, 2020

I detected some fixture changes in commit ee81aba1e6b3857889d684aa32473cdf3b492e83

The local fixture catalog_item_setups is used in the following files:

  • cfme/tests/services/test_service_catalogs_bundles.py
    • test_retire_service_and_bundle_vms

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

@niyazRedhat niyazRedhat changed the title [WIPTEST] Automating retire bundle with multiple VM test [RFR] Automating retire bundle with multiple VM test May 8, 2020
@dajoRH dajoRH removed the WIP-testing label May 8, 2020
vm2 = collection.instantiate(f"{vm_name2}", provider)

yield catalog_item, cat_list, vm1, vm2

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure I understand why the fixture is yielding this group of objects. catalog_item is the last catalog item created in the loop, and is also the last entry in cat_list, so it seems redundant to include catalog_item along with the list. Also, the instantiation of vm1 and vm2 has nothing to do with creating the catalog items. I think L55-L60 would make more sense if they were in the test function, right before L143. The fixture could just yield cat_list, and references to catalog_item in the test could be cat_list[0] or cat_list[1].

Also, the f-strings f"{vm_nameX}" are equivalent to vm_nameX.


provision_request = appliance.collections.requests.instantiate(request_description)
provision_request.wait_for_request(method='ui')
provision_request.is_succeeded(method="ui")
Copy link
Contributor

Choose a reason for hiding this comment

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

The return value of is_succeeded() isn't being checked.

display_in=True,
catalog=catalog_item.catalog,
dialog=catalog_item.dialog,
catalog_items=[cat_list[0].name, cat_list[1].name],
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest changing this to:

catalog_items=[c.name for c in cat_list],

)

cat_list.append(catalog_item)
request.addfinalizer(catalog_item.delete_if_exists)
Copy link
Contributor

Choose a reason for hiding this comment

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

I would rather seen this right after the catalog_item is being assigned. The append on #52 probably won't fail, but I think it is good habit to have and it may mitigate chance of inserting some code between the object creation and deletion scheduling statement.

@john-dupuy john-dupuy changed the title [RFR] Automating retire bundle with multiple VM test [WIPTEST] Automating retire bundle with multiple VM test May 19, 2020
@niyazRedhat niyazRedhat force-pushed the bundle-test branch 2 times, most recently from 8e3b652 to f2e90c0 Compare June 17, 2020 06:24
@niyazRedhat niyazRedhat changed the title [WIPTEST] Automating retire bundle with multiple VM test [RFR] Automating retire bundle with multiple VM test Jun 17, 2020
@tpapaioa
Copy link
Contributor

Looks good to me.

@pytest.mark.tier(2)
@pytest.mark.customer_scenario
def test_retire_service_and_bundle_vms(provider, request, appliance, catalog_item_setups,
catalog_item):
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you need this catalog_item if catalog_item_setups already creates catalog items?

Comment on lines 107 to 115
service_catalogs = ServiceCatalogs(
appliance, catalog_bundle.catalog, catalog_bundle.name
)
service_catalogs.order()
request_description = (
f'Provisioning Service [{catalog_bundle.name}] from [{catalog_bundle.name}]'
)

provision_request = appliance.collections.requests.instantiate(request_description)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
service_catalogs = ServiceCatalogs(
appliance, catalog_bundle.catalog, catalog_bundle.name
)
service_catalogs.order()
request_description = (
f'Provisioning Service [{catalog_bundle.name}] from [{catalog_bundle.name}]'
)
provision_request = appliance.collections.requests.instantiate(request_description)
provision_request = ServiceCatalogs(
appliance, catalog_bundle.catalog, catalog_bundle.name
).order()

@valaparthvi valaparthvi changed the title [RFR] Automating retire bundle with multiple VM test [WIPTEST] Automating retire bundle with multiple VM test Jun 18, 2020
@niyazRedhat niyazRedhat changed the title [WIPTEST] Automating retire bundle with multiple VM test [RFR] Automating retire bundle with multiple VM test Jun 19, 2020
@valaparthvi valaparthvi changed the title [RFR] Automating retire bundle with multiple VM test [1LP][RFR] Automating retire bundle with multiple VM test Jun 19, 2020
@jawatts jawatts merged commit f378b0b into ManageIQ:master Jun 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lint-ok test-automation To be applied on PR's which are automating existing manual cases WIP-testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants