зеркало из https://github.com/Azure/iotedgedev.git
Remove redundancies
This commit is contained in:
Родитель
2841d7b8e9
Коммит
6892852749
4
.env.tmp
4
.env.tmp
|
@ -74,8 +74,8 @@ LOGS_PATH="logs"
|
||||||
DEVICE_TAGS=""
|
DEVICE_TAGS=""
|
||||||
# To specifiy the tags for an edge device
|
# To specifiy the tags for an edge device
|
||||||
# Examples:
|
# Examples:
|
||||||
# DEVICE_TAGS="{"environment":"dev"}
|
# DEVICE_TAGS="{"environment":"dev"}"
|
||||||
# DEVICE_TAGS="{"environment":"dev", "building":"9"}
|
# DEVICE_TAGS="{"environment":"dev", "building":"9"}"
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -271,7 +271,6 @@ main.add_command(deploy)
|
||||||
@click.option("--target-condition",
|
@click.option("--target-condition",
|
||||||
"--tc",
|
"--tc",
|
||||||
"-t",
|
"-t",
|
||||||
"target_condition",
|
|
||||||
default=envvars.get_envvar("IOTHUB_DEPLOYMENT_TARGET_CONDITION"),
|
default=envvars.get_envvar("IOTHUB_DEPLOYMENT_TARGET_CONDITION"),
|
||||||
show_default=True,
|
show_default=True,
|
||||||
required=True,
|
required=True,
|
||||||
|
@ -281,7 +280,6 @@ main.add_command(deploy)
|
||||||
"This property can be set via this parameter or in the .env under 'IOTHUB_DEPLOYMENT_TARGET_CONDITION'"))
|
"This property can be set via this parameter or in the .env under 'IOTHUB_DEPLOYMENT_TARGET_CONDITION'"))
|
||||||
@click.option("--device-tag",
|
@click.option("--device-tag",
|
||||||
"-dt",
|
"-dt",
|
||||||
"device_tag",
|
|
||||||
default=envvars.get_envvar("DEVICE_TAGS"),
|
default=envvars.get_envvar("DEVICE_TAGS"),
|
||||||
required=False,
|
required=False,
|
||||||
help="Specify the tags to be added to the device twin")
|
help="Specify the tags to be added to the device twin")
|
||||||
|
@ -301,7 +299,7 @@ def iothub_deploy(manifest_file, name, priority, target_condition, device_tag):
|
||||||
@click.option("--tags",
|
@click.option("--tags",
|
||||||
"-t",
|
"-t",
|
||||||
"tags",
|
"tags",
|
||||||
required=False,
|
required=True,
|
||||||
default=envvars.get_envvar("DEVICE_TAGS"),
|
default=envvars.get_envvar("DEVICE_TAGS"),
|
||||||
show_default=True,
|
show_default=True,
|
||||||
help="Specify the tags to be added to the device twin")
|
help="Specify the tags to be added to the device twin")
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
{}
|
|
|
@ -1,5 +1,6 @@
|
||||||
import os
|
import os
|
||||||
import uuid
|
import uuid
|
||||||
|
import json
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -142,13 +143,13 @@ def test_iothub_deploy_and_add_tags():
|
||||||
|
|
||||||
assert azure_cli.invoke_az_cli_outproc(["iot", "edge", "deployment", "delete", "-d", deployment_name, "-l", envvars.get_envvar("IOTHUB_CONNECTION_STRING")])
|
assert azure_cli.invoke_az_cli_outproc(["iot", "edge", "deployment", "delete", "-d", deployment_name, "-l", envvars.get_envvar("IOTHUB_CONNECTION_STRING")])
|
||||||
assert azure_cli.invoke_az_cli_outproc(["iot", "hub", "device-twin", "replace", "-d", DeviceConnectionString(envvars.get_envvar("DEVICE_CONNECTION_STRING")).device_id,
|
assert azure_cli.invoke_az_cli_outproc(["iot", "hub", "device-twin", "replace", "-d", DeviceConnectionString(envvars.get_envvar("DEVICE_CONNECTION_STRING")).device_id,
|
||||||
"-l", envvars.get_envvar("IOTHUB_CONNECTION_STRING"), "--json", "tag_overwrite.json"])
|
"-l", envvars.get_envvar("IOTHUB_CONNECTION_STRING"), "--json", json.dumps({})])
|
||||||
|
|
||||||
|
|
||||||
def test_iothub_deploy_and_add_tags_retry_after_invalid_tag():
|
def test_iothub_deploy_and_add_tags_retry_after_invalid_tag():
|
||||||
# GIVEN: `iothub deploy` run fails
|
# GIVEN: `iothub deploy` run fails
|
||||||
# WHEN: Device tag has an invalid format
|
# WHEN: Device tag has an invalid format
|
||||||
# THAN: Rerunning the command will lead to a failed deploy part,
|
# THEN: Rerunning the command will lead to a failed deploy part,
|
||||||
# as the deployment already exists from the previous run,
|
# as the deployment already exists from the previous run,
|
||||||
# but it will succeed in adding the new and correct device tags.
|
# but it will succeed in adding the new and correct device tags.
|
||||||
# Leaving the iothub and device in the initially desired end state again.
|
# Leaving the iothub and device in the initially desired end state again.
|
||||||
|
@ -192,4 +193,4 @@ def test_iothub_deploy_and_add_tags_retry_after_invalid_tag():
|
||||||
|
|
||||||
assert azure_cli.invoke_az_cli_outproc(["iot", "edge", "deployment", "delete", "-d", deployment_name, "-l", envvars.get_envvar("IOTHUB_CONNECTION_STRING")])
|
assert azure_cli.invoke_az_cli_outproc(["iot", "edge", "deployment", "delete", "-d", deployment_name, "-l", envvars.get_envvar("IOTHUB_CONNECTION_STRING")])
|
||||||
assert azure_cli.invoke_az_cli_outproc(["iot", "hub", "device-twin", "replace", "-d", DeviceConnectionString(envvars.get_envvar("DEVICE_CONNECTION_STRING")).device_id,
|
assert azure_cli.invoke_az_cli_outproc(["iot", "hub", "device-twin", "replace", "-d", DeviceConnectionString(envvars.get_envvar("DEVICE_CONNECTION_STRING")).device_id,
|
||||||
"-l", envvars.get_envvar("IOTHUB_CONNECTION_STRING"), "--json", "tag_overwrite.json"])
|
"-l", envvars.get_envvar("IOTHUB_CONNECTION_STRING"), "--json", json.dumps({})])
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import os
|
import os
|
||||||
import pytest
|
import pytest
|
||||||
|
import json
|
||||||
from .utility import (
|
from .utility import (
|
||||||
runner_invoke,
|
runner_invoke,
|
||||||
)
|
)
|
||||||
|
@ -33,7 +34,7 @@ def test_add_tags():
|
||||||
azure_cli = AzureCli(output, envvars)
|
azure_cli = AzureCli(output, envvars)
|
||||||
|
|
||||||
assert azure_cli.invoke_az_cli_outproc(["iot", "hub", "device-twin", "replace", "-d", DeviceConnectionString(envvars.get_envvar("DEVICE_CONNECTION_STRING")).device_id,
|
assert azure_cli.invoke_az_cli_outproc(["iot", "hub", "device-twin", "replace", "-d", DeviceConnectionString(envvars.get_envvar("DEVICE_CONNECTION_STRING")).device_id,
|
||||||
"-l", envvars.get_envvar("IOTHUB_CONNECTION_STRING"), "--json", "tag_overwrite.json"])
|
"-l", envvars.get_envvar("IOTHUB_CONNECTION_STRING"), "--json", json.dumps({})])
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
|
@ -82,7 +83,7 @@ def test_default_tag_from_env():
|
||||||
azure_cli = AzureCli(output, envvars)
|
azure_cli = AzureCli(output, envvars)
|
||||||
|
|
||||||
assert azure_cli.invoke_az_cli_outproc(["iot", "hub", "device-twin", "replace", "-d", DeviceConnectionString(envvars.get_envvar("DEVICE_CONNECTION_STRING")).device_id,
|
assert azure_cli.invoke_az_cli_outproc(["iot", "hub", "device-twin", "replace", "-d", DeviceConnectionString(envvars.get_envvar("DEVICE_CONNECTION_STRING")).device_id,
|
||||||
"-l", envvars.get_envvar("IOTHUB_CONNECTION_STRING"), "--json", "tag_overwrite.json"])
|
"-l", envvars.get_envvar("IOTHUB_CONNECTION_STRING"), "--json", json.dumps({})])
|
||||||
|
|
||||||
|
|
||||||
def test_missing_default_tag_from_env():
|
def test_missing_default_tag_from_env():
|
||||||
|
|
Загрузка…
Ссылка в новой задаче