Azure / azure-iot-cli-extension

Azure IoT extension for Azure CLI
Other
82 stars 65 forks source link

[bug] IotCentral integration test failing trying execute app show -n {} command when test configuration has app id #603

Closed gtrifonov closed 1 year ago

gtrifonov commented 1 year ago

Describe the bug azext_iot/tests/central/init.py line 200:

else:
            self.app_rg = self.cmd(
                "iot central app show -n {}".format(
                    self.app_id,
                )
            ).get_output_in_json()["resourceGroup"]

iot central app show command expect application name to be passed. Currently according to documents settings.env.azext_iot_central_app_id can be populated by user either with application id or application name. Error happens when pytest.ini has azext_iot_central_app_id populated with application id value and doesn't have value in azext_iot_testrg and in azext_iot_central_token

To Reproduce Steps to reproduce the behavior:

  1. Go to pytest.ini
  2. Paste value of application id into azext_iot_central_app_id
  3. Make sure that settings azext_iot_testrg and azext_iot_central_token are empty
  4. Run pytest azext_iot/tests/central/test_iot_central_int.py
  5. Tests are failing with message
    No IoT Central application found with name {{application id from config}} in current subscription

    Expected behavior User should be able to use app id in test configuration otherwise setting need to be renamed to application name if going forward only name is acceptable

Environment (please complete the following information):

Additional context Add any other context about the problem here.

digimaun commented 1 year ago

@HangyiWang , do you have cycles to take a look at this?

HangyiWang commented 1 year ago

@HangyiWang , do you have cycles to take a look at this?

Sure

digimaun commented 1 year ago

Excellent, thank you.

HangyiWang commented 1 year ago

https://github.com/Azure/azure-iot-cli-extension/pull/621