-
Notifications
You must be signed in to change notification settings - Fork 165
[RFR] Automate BZ 1819310 - The special chars in AWX #10314
Conversation
initialEstimate: 1/20h | ||
caseimportance: high | ||
""" | ||
provider_with_special_characters.setup() |
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 am not sure should I add a finalizer to remove the 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.
Not necessary, the setup_provider
fixture will enforce the provider-limit
option and remove providers from the appliance as necessary when running any tests that run after this.
to make it work with code for adding the provider I am not sure how to 100% reproduce this, but the traceback was: ``` 2020-09-04 00:48:40,891 [E] [cfme] def validate(self, timeout=1000, delay=5): refresh_timer = RefreshTimer(time_for_refresh=300) try: wait_for(self.is_refreshed, [refresh_timer], message="is_refreshed", timeout=timeout, delay=delay, > handle_exception=True) E wait_for.TimedOutError: Could not do 'is_refreshed' at /home/jhenner/work/miq/bad_awx_template_bz/.cfme_venv3/lib64/python3.7/site-packages/varmeth/__init__.py:79 in time cfme/common/provider.py:743: TimedOutError During handling of the above exception, another exception occurred: @pytest.mark.provider([AnsibleTowerProvider], selector=ONE_PER_VERSION, scope="function") @pytest.mark.meta(automates=[1819310]) def test_awx_with_special_chars_refreshes(appliance: IPAppliance, provider: AnsibleTowerProvider, add_special_characters): """ Tests whether provider with special characters in template definition refreshes in CFME :param appliance: :param provider: :param add_special_characters: :return: Polarion: assignee initialEstimate """ # TODO Fill this add_special_characters(provider) > provider.setup() cfme/tests/infrastructure/test_providers.py:578: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cfme/common/provider.py:715: in setup return self.create_rest(check_existing=True, validate_inventory=True) cfme/infrastructure/config_management/__init__.py:468: in create_rest self.validate(timeout=300) cfme/common/provider.py:746: in validate self.load_details(refresh=True) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ def load_details(self, refresh=False): """To be compatible with the Taggable and PolicyProfileAssignable mixins. Returns: ProviderDetails view """ view = navigate_to(self, 'Details') if refresh: > view.toolbar.reload.click() E AttributeError: 'ConfigManagementToolbar' object has no attribute 'reload' ```
|
||
|
||
@pytest.mark.meta(automates=[1819310]) | ||
@pytest.mark.provider(gen_func=providers, |
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 this mark, with the required_fields
filter, should be decorating the fixture, not this test function.
The provider_with_special_characters
fixture requires the special_chars_template
field on the provider, and its current mark does not ensure that.
This probably functions fine - but any other test using provider_with_special_characters
would have to include this provider mark as well.
I think that the mark can be simplified as well, since providers_by_class
default gen func should work.
@pytest.mark.provider([AnsibleTowerProvider], selector=ONE_PER_VERSION, required_fields=['special_chars_template'])
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.
It seems it doesn't work when the marker is only on the fixture. It has to be on the test. You can take look on the tests history and commits I made.
I detected some fixture changes in commit 9454503 The local fixture
Please, consider creating a PRT run to make sure your fixture changes do not break existing usage 😃 |
""")} | ||
empty_extra_vars = {'extra_vars': ""} | ||
|
||
with closing(session): |
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.
Nice solution! Simple, even using requests directly and not awxkit.
* Automate BZ 1819310 - The special chars in AWX * Add conf-based provider selection and some docs. * Rename attribute refresh to reload to make it work with code for adding the provider I am not sure how to 100% reproduce this, but the traceback was: ``` 2020-09-04 00:48:40,891 [E] [cfme] def validate(self, timeout=1000, delay=5): refresh_timer = RefreshTimer(time_for_refresh=300) try: wait_for(self.is_refreshed, [refresh_timer], message="is_refreshed", timeout=timeout, delay=delay, > handle_exception=True) E wait_for.TimedOutError: Could not do 'is_refreshed' at /home/jhenner/work/miq/bad_awx_template_bz/.cfme_venv3/lib64/python3.7/site-packages/varmeth/__init__.py:79 in time cfme/common/provider.py:743: TimedOutError During handling of the above exception, another exception occurred: @pytest.mark.provider([AnsibleTowerProvider], selector=ONE_PER_VERSION, scope="function") @pytest.mark.meta(automates=[1819310]) def test_awx_with_special_chars_refreshes(appliance: IPAppliance, provider: AnsibleTowerProvider, add_special_characters): """ Tests whether provider with special characters in template definition refreshes in CFME :param appliance: :param provider: :param add_special_characters: :return: Polarion: assignee initialEstimate """ # TODO Fill this add_special_characters(provider) > provider.setup() cfme/tests/infrastructure/test_providers.py:578: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cfme/common/provider.py:715: in setup return self.create_rest(check_existing=True, validate_inventory=True) cfme/infrastructure/config_management/__init__.py:468: in create_rest self.validate(timeout=300) cfme/common/provider.py:746: in validate self.load_details(refresh=True) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ def load_details(self, refresh=False): """To be compatible with the Taggable and PolicyProfileAssignable mixins. Returns: ProviderDetails view """ view = navigate_to(self, 'Details') if refresh: > view.toolbar.reload.click() E AttributeError: 'ConfigManagementToolbar' object has no attribute 'reload' ``` * Only mark the fixture with the provider marker. * Use providers_by_class * put provider marker on the test only
Purpose or Intent
PRT Run
needs PR !939 to yamls merged
{{pytest: --use-provider complete --long-running -v cfme/tests/infrastructure/test_providers.py::test_awx_with_special_chars_refreshes}}