integration_tests icon indicating copy to clipboard operation
integration_tests copied to clipboard

pytest collect-only against azure provider returns both azure-common and azure-msdn tests

Open jeffreyluo0428 opened this issue 4 years ago • 2 comments

Add the azure info in data.yaml as follows:

    azure:
      name: ms azure
      type: azure
      server_zone: default
      region: East US
      region_name: East US
      tenant_id: xxxxxxxx
      subscription_id: xxxxxxx
      endpoints:
          default:
              credentials: azure
      tags:
          - default

Run "pytest --collect-only --use-provider azure cfme/tests/cloud/test_providers.py". returns both common and msdn tests:

collected 49 items / 7 deselected / 42 selected                                                                 
<Package /root/repos/integration_tests/cfme/tests/cloud>
  <Module test_providers.py>
    <Function test_cloud_provider_crud[azure-common]>
    <Function test_cloud_provider_crud[azure-msdn]>
    <Function test_add_cancelled_validation_cloud>
    <Function test_cloud_provider_add_with_bad_credentials[azure-common]>
    <Function test_cloud_provider_add_with_bad_credentials[azure-msdn]>
    <Function test_type_required_validation_cloud>
    <Function test_name_required_validation_cloud>
    <Function test_region_required_validation>
    <Function test_host_name_required_validation_cloud>
    <Function test_api_port_blank_validation>
    <Function test_name_max_character_validation_cloud>
    <Function test_hostname_max_character_validation_cloud>
    <Function test_api_port_max_character_validation_cloud>
    <Function test_azure_subscription_required[azure-common]>
    <Function test_azure_subscription_required[azure-msdn]>
    <Function test_azure_multiple_subscription[azure-msdn-azure]>
    <Function test_refresh_with_empty_iot_hub_azure[azure]>
    <Function test_regions_gov_azure[azure]>
    <Function test_openstack_provider_has_api_version>
    <Function test_openstack_provider_has_dashboard>
    <Function test_azure_instance_password_requirements[azure-common]>
    <Function test_azure_instance_password_requirements[azure-msdn]>
    <Function test_cloud_names_grid_floating_ips>
    <Function test_display_network_topology>
    <Class TestProvidersRESTAPI>
        <Function test_cloud_networks_query[azure-common-from_detail]>
        <Function test_security_groups_query[azure-common]>
        <Function test_cloud_networks_query[azure-common-from_collection]>
        <Function test_security_groups_query[azure-msdn]>
        <Function test_cloud_networks_query[azure-msdn-from_detail]>
        <Function test_cloud_networks_query[azure-msdn-from_collection]>
    <Function test_tagvis_provision_fields[cloud]>
    <Function test_vpc_env_selection[azure]>
    <Function test_add_ec2_provider_with_sts_assume_role>

============================================= 7 deselected in 0.67s =============================================
collecting artifacts                                             

Expect to see only azure-common testcases collected

jeffreyluo0428 avatar Mar 04 '20 22:03 jeffreyluo0428

The string passed to --use-provider is used to match on either the provider key or on one of its tags. This behavior is due to the fact that there is also a provider tag named 'azure' in the yaml file, on both the azure and azure_msdn providers. A workaround/fix would be either to remove/change the name of the tag, or to change the provider key for 'azure' to something unique, e.g., 'azure-common'.

tpapaioa avatar Jun 10 '20 13:06 tpapaioa

@jeffreyluo0428 Thanks for reporting your test collection issue!

Can you confirm that you only have one azure provider defined in your cfme_data.yaml when you run the test collection? I think @tpapaioa is assuming you have multiple providers that include the azure tag.

mshriver avatar Jun 10 '20 14:06 mshriver