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

[1LP][RFR] Add test coverage for BZ-1734629 and BZ-1734630 #10281

Merged
merged 1 commit into from
Aug 17, 2020

Conversation

Gauravtalreja1
Copy link
Contributor

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 }}

@Gauravtalreja1 Gauravtalreja1 changed the title [WIPTEST] Add test coverage for BZ-1734629 and BZ-1734630 [RFR] Add test coverage for BZ-1734629 and BZ-1734630 Jul 31, 2020
@mshriver mshriver added customer-case test-automation To be applied on PR's which are automating existing manual cases labels Aug 4, 2020
Copy link
Member

@mshriver mshriver left a 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!

@mshriver mshriver changed the title [RFR] Add test coverage for BZ-1734629 and BZ-1734630 [WIPTEST] Add test coverage for BZ-1734629 and BZ-1734630 Aug 4, 2020
@Gauravtalreja1 Gauravtalreja1 changed the title [WIPTEST] Add test coverage for BZ-1734629 and BZ-1734630 [RFR] Add test coverage for BZ-1734629 and BZ-1734630 Aug 5, 2020
@valaparthvi valaparthvi changed the title [RFR] Add test coverage for BZ-1734629 and BZ-1734630 [1LP][RFR] Add test coverage for BZ-1734629 and BZ-1734630 Aug 6, 2020
Copy link
Contributor

@digitronik digitronik left a 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}",
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Member

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}",
Copy link
Contributor

Choose a reason for hiding this comment

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

same ^^

Copy link
Contributor Author

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":
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 we are iterating over two instances [CatalogItemInitialization_29, CatalogItemInitialization_30] so just if-else will work.

Copy link
Contributor Author

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
Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Member

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.

Copy link
Contributor Author

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?

Copy link
Member

@mshriver mshriver left a 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.

@mshriver mshriver changed the title [1LP][RFR] Add test coverage for BZ-1734629 and BZ-1734630 [1LP][WIP] Add test coverage for BZ-1734629 and BZ-1734630 Aug 10, 2020
@Gauravtalreja1 Gauravtalreja1 force-pushed the automate-bz-2930 branch 2 times, most recently from 2179c9d to 71ef937 Compare August 11, 2020 18:04
@Gauravtalreja1 Gauravtalreja1 changed the title [1LP][WIP] Add test coverage for BZ-1734629 and BZ-1734630 [1LP][RFR] Add test coverage for BZ-1734629 and BZ-1734630 Aug 13, 2020
Copy link
Contributor

@jawatts jawatts left a 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

@jawatts jawatts changed the title [1LP][RFR] Add test coverage for BZ-1734629 and BZ-1734630 [1LP][WIPTEST] Add test coverage for BZ-1734629 and BZ-1734630 Aug 13, 2020
@Gauravtalreja1 Gauravtalreja1 changed the title [1LP][WIPTEST] Add test coverage for BZ-1734629 and BZ-1734630 [1LP][RFR] Add test coverage for BZ-1734629 and BZ-1734630 Aug 17, 2020
@mshriver mshriver merged commit dd75a0a into ManageIQ:master Aug 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
customer-case test-automation To be applied on PR's which are automating existing manual cases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants