-
Notifications
You must be signed in to change notification settings - Fork 165
[1LP][RFR] Add test coverage for BZ-1734629 and BZ-1734630 #10281
Conversation
9767ac9
to
4b41691
Compare
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.
Test looks good - just need to shuffle the finalizer to the top of the test function. Thanks!
4b41691
to
2431bea
Compare
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.
LGTM 👍 few questions.
""" | ||
entry_point = ( | ||
"Datastore", | ||
f"{import_datastore.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.
do we really need f-string here?
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.
@digitronik Yes, it is needed here, as the variable import_datastore.name
is from a fixture call import_datastore
which set this variable.
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 think what @digitronik is getting at here is that the name
attribute will resolve to a string at this line. Its redundant, but I wouldn't call it a blocker.
"Provisioning", | ||
"StateMachines", | ||
"ServiceProvision_Template", | ||
f"{instance}", |
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.
same ^^
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.
@digitronik Same here, as this instance
variable is used to iterate two instances [CatalogItemInitialization_29, CatalogItemInitialization_30], passed through pytest parameteres.
'.*status = "Warn".*', | ||
'.*"config_info"=>{"active"=>true}.*' | ||
] | ||
elif instance == "CatalogItemInitialization_30": |
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:
I think we are iterating over two instances [CatalogItemInitialization_29, CatalogItemInitialization_30] so just if-else will work.
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.
Yes, it will definitely work, but it is intended to use elif
to specify a condition to iterate over 2nd instance, as it is optional, can we use elif
here?
def _finalize(): | ||
if catalog.exists: | ||
catalog.delete() | ||
catalog_item.catalog = None |
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.
Q: is it required? means manually setting catalog attribute to None.
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.
Yes @digitronik , It is required too, as catatlog_item will be added to some catalog, and if one is deleting a catalog, then, in that case, a catalog_item has some catalog assigned, so it can't be deleted directly, and in the same way, dialog can't be deleted, because it's assigned to some 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.
@Gauravtalreja1 I question that logic, because setting this instance attribute on the framework doesn't change anything on MIQ itself. Its only changing the instance within the pytest session/python context. An update method would have to be called to actually modify MIQ's catalog/catalog item association.
Were you actually finding an exception during test teardown without this line? I don't see anything in the catalog_item.delete
method that is checking for catalog associations.
The global fixture for catalog_item
in cfme.fixtures.service_fixtures
isn't making any modifications to any linked catalogs before it calls 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.
@mshriver Yes, without this line, it will fail in teardown while deleting a dialog with some AssertionError
, I guess there is something, which is checking for catalog/catalog_items associations while deleting a dialog with dialog.delete_if_exists
.
E AssertionError: assert_no_error: ['error:Dialog "HbIA5yO3Yr": Error during delete: Dialog cannot be deleted because it is connected to other components: ["ServiceTemplate:1 - cat_item_mjOTMB", "ServiceTemplate:1 - cat_item_mjOTMB"]']
Can you try running this test or maybe this finalizer definition? or suggest anything to workaround?
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.
Review actions on teardown, originally pointed out by @digitronik.
One request to use f-strings, otherwise the test content and structure look good, should be a quick merge after small updates.
2179c9d
to
71ef937
Compare
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.
PRT failing, please check the failures out
71ef937
to
198c44b
Compare
Purpose or Intent
Automated test for BZ's
PRT Run
{{ pytest: cfme/tests/ansible/test_embedded_ansible_automate.py::test_automate_ansible_playbook_set_stats --long-running }}