-
Notifications
You must be signed in to change notification settings - Fork 165
[1LP][RFR] Automating retire bundle with multiple VM test #10092
Conversation
It passing locally every time. |
|
||
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"]) |
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.
These can be changed to f-strings.
|
||
cat_list.append(catalog_item) | ||
request.addfinalizer(cat_list[i].delete_if_exists) | ||
|
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.
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) |
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.
Does this need to be in the for
loop?
|
||
|
||
@pytest.fixture(scope="function") | ||
def catalog_item_setups(appliance, provider, provisioning, request, catalog, dialog): |
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.
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):
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.
Thanks for pointing the issue
Moving to WIPTEST based on @tpapaioa's comments. |
b4e1072
to
ee81aba
Compare
I detected some fixture changes in commit ee81aba1e6b3857889d684aa32473cdf3b492e83 The local fixture
Please, consider creating a PRT run to make sure your fixture changes do not break existing usage 😃 |
vm2 = collection.instantiate(f"{vm_name2}", provider) | ||
|
||
yield catalog_item, cat_list, vm1, vm2 | ||
|
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'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") |
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.
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], |
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.
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) |
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 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.
8e3b652
to
f2e90c0
Compare
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): |
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.
Why do you need this catalog_item
if catalog_item_setups
already creates catalog items?
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) |
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.
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() |
{{pytest: cfme/tests/services/test_service_catalogs_bundles.py::test_retire_service_and_bundle_vms --long-running -svvvv }}