-
Notifications
You must be signed in to change notification settings - Fork 165
[RFR] Parametrize Tower tests on API version #9888
[RFR] Parametrize Tower tests on API version #9888
Conversation
75299a6
to
7efa1b5
Compare
cfme/fixtures/ansible_tower.py
Outdated
|
||
@pytest.fixture | ||
def ansible_api_version_change(provider, ansible_api_version): | ||
"""Fixture to update Tower url to /api/v2 so that API v2 can be tested. |
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 the thorough docblock!
cfme/fixtures/ansible_tower.py
Outdated
|
||
if ansible_api_version == 'v2': | ||
updated_url = f'{parsed.scheme}://{parsed.netloc}/api/{ansible_api_version}' | ||
original_url = provider.url |
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.
Looking good, but I would do two things here:
- move this assignment of original_url outside of the logic blocks, so that we don't hit any UnboundLocals
- Make the url update regardless of
ansible_api_version
, so that its always explicitly set to what the test parameter is.
If we're not explicitly setting it, we risk running into situations where fixture/parameter scope, or the URL defined for the provider in the yaml, will result in the provider's configuration not matching the parametrized value for API.
This way we can remove the logic 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.
Done
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.
Two comments to consider - nice work though!
PRT failures look unrelated to the changes here - other than MIQ's lack of support for v2 API. |
I detected some fixture changes in commit 445388f The global fixture
The local fixture
The local fixture
Please, consider creating a PRT run to make sure your fixture changes do not break existing usage 😃 |
Purpose or Intent
PRT Run
{{ pytest: cfme/tests/services/test_config_provider_servicecatalogs.py cfme/tests/services/test_ansible_workflow_servicecatalogs.py --use-provider complete}}