Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set of testing tweaks & min CLI increment #643

Merged
merged 9 commits into from
Mar 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .azure-devops/templates/set-testenv-sentinel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ steps:
f.writelines(envvars_sentinel)
f.write("markers =\n")
f.write(" adu_infrastructure:\n")
f.write(" hub_infrastructure:\n")
f.close()

env:
Expand Down
16 changes: 14 additions & 2 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,25 @@
Release History
===============


unreleased
+++++++++++++++


0.20.1
+++++++++++++++

**General updates**

* The Azure IoT CLI extension min core CLI version incremented to `2.37.0`.

**Digital Twins updates**

* Addition of new parameter `--max-models-per-batch` for `az dt model create` to let user adjust batch size when directory exceeds
250 models. The parameter will be removed once the DTDLParserError is fixed when models created exceed single page API limit in ubuntu.
* Fix to ensure policy key retreival during Digital Twin endpoint creation works. Affected commands are: - `az dt endpoint create *`.

* Addition of new temporary experimental parameter `--max-models-per-batch` for `az dt model create` to let user adjust batch size when directory exceeds
250 models.


0.20.0
+++++++++++++++
Expand Down
2 changes: 1 addition & 1 deletion azext_iot/azext_metadata.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"azext.minCliCoreVersion": "2.32.0"
"azext.minCliCoreVersion": "2.37.0"
}
2 changes: 1 addition & 1 deletion azext_iot/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import os

VERSION = "0.20.0"
VERSION = "0.20.1"
EXTENSION_NAME = "azure-iot"
EXTENSION_ROOT = os.path.dirname(os.path.abspath(__file__))
EXTENSION_CONFIG_ROOT_KEY = "iotext"
Expand Down
2 changes: 1 addition & 1 deletion azext_iot/tests/deviceupdate/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

ACCOUNT_RG = settings.env.azext_iot_testrg
VALID_IDENTITY_MAP = {"system": 1, "user": 1}
DEFAULT_ADU_RBAC_SLEEP_SEC = 105
DEFAULT_ADU_RBAC_SLEEP_SEC = 90

# Manifest v4 will work with deviceUpdateModel;[1|2] but v5 only with deviceUpdateModel;2
ADU_CLIENT_DTMI = "dtmi:azure:iot:deviceUpdateModel;2"
Expand Down
9 changes: 8 additions & 1 deletion azext_iot/tests/deviceupdate/test_adu_update_int.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,14 @@ def test_instance_update_lifecycle(provisioned_instances_module: Dict[str, dict]
f"--group-id {device_group_id} --start-time {start_date_time_iso} --update-name {simple_manifest_id['name']} "
f"--update-provider {simple_manifest_id['provider']} --update-version {simple_manifest_id['version']}").as_json()
assert basic_create_deployment["deploymentId"] == basic_deployment_id
assert basic_create_deployment["update"]["updateId"] == simple_manifest_id

assert basic_create_deployment["update"]["updateId"]
for update_kpi in ["name", "provider", "version"]:
assert (
update_kpi in basic_create_deployment["update"]["updateId"]
and basic_create_deployment["update"]["updateId"][update_kpi] == simple_manifest_id[update_kpi]
)

assert device_class_id in basic_create_deployment["deviceClassSubgroups"]
assert basic_create_deployment["groupId"] == device_group_id
assert basic_create_deployment["isRetried"] is None
Expand Down
16 changes: 9 additions & 7 deletions azext_iot/tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from azext_iot.common.utility import ensure_azure_namespace_path
from azext_iot.common.utility import read_file_content
from azext_iot.tests.settings import DynamoSettings
from typing import TypeVar
from typing import TypeVar, Optional

ensure_azure_namespace_path()

Expand Down Expand Up @@ -189,8 +189,8 @@ def assign_role_assignment(
scope: str,
assignee: str,
max_tries=10,
wait=10
):
wait=10,
) -> Optional[EmbeddedCLI]:
"""
Assign rbac permissions to resource.
"""
Expand All @@ -199,16 +199,18 @@ def assign_role_assignment(
while tries < max_tries:
role_assignments = get_role_assignments(scope=scope, role=role)
role_assignment_principal_ids = [assignment["principalId"] for assignment in role_assignments]
if assignee in role_assignment_principal_ids:
break
role_assignment_principal_names = [assignment["principalName"] for assignment in role_assignments]
if assignee in role_assignment_principal_ids or assignee in role_assignment_principal_names:
return
# else assign role to scope and check again
output = cli.invoke(
digimaun marked this conversation as resolved.
Show resolved Hide resolved
f'role assignment create --assignee "{assignee}" --role "{role}" --scope "{scope}"'
)
if not output.success():
raise RuntimeError(f"Failed to assign '{assignee}' the role of '{role}' against scope '{scope}'.")

sleep(wait)
tries += 1
if not output.success():
logger.warning(f"Failed to assign '{assignee}' the role of '{role}' against scope '{scope}'.")

return output

Expand Down
1 change: 1 addition & 0 deletions pytest.ini.example
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ env =

markers =
adu_infrastructure: desired customizations for ADU integration tests.
hub_infrastructure: desired customizations for IoT Hub integration tests.