iotedgedev 3.3.4__zip → 3.3.6__zip

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. s/.git/FETCH_HEAD +3 -1
  2. s/.git/HEAD +1 -1
  3. s/.git/hooks/fsmonitor-watchman.sample +3 -2
  4. s/.git/index +0 -0
  5. s/.git/logs/HEAD +1 -1
  6. s/.git/logs/refs/remotes/origin/EO +1 -1
  7. s/.git/logs/refs/remotes/origin/avagraw/security_fix +1 -1
  8. s/.git/logs/refs/remotes/origin/cherry-pick-rename +1 -1
  9. s/.git/logs/refs/remotes/origin/chyuan/fix-validation-not-fail-test +1 -1
  10. s/.git/logs/refs/remotes/origin/chyuan/update-linux-agent +1 -1
  11. s/.git/logs/refs/remotes/origin/dependabot/pip/cookiecutter-2.1.1 +1 -0
  12. s/.git/logs/refs/remotes/origin/dependabot/pip/pyyaml-5.4 +1 -1
  13. s/.git/logs/refs/remotes/origin/main +1 -1
  14. s/.git/logs/refs/remotes/origin/ray-deps +1 -1
  15. s/.git/logs/refs/remotes/origin/ray-dev-setup +1 -1
  16. s/.git/logs/refs/remotes/origin/ray-tox +1 -1
  17. s/.git/logs/refs/remotes/origin/release-pipeline-automation +1 -1
  18. s/.git/logs/refs/remotes/origin/revert-594-user/vikas_bug-pyopenssl +1 -0
  19. s/.git/logs/refs/remotes/origin/spmcdono/fix-pipeline-test-install +1 -1
  20. s/.git/logs/refs/remotes/origin/spmcdono/layered-deployments +1 -1
  21. s/.git/logs/refs/remotes/origin/spmcdono/pypi-package-test-pipeline +1 -1
  22. s/.git/logs/refs/remotes/origin/spmcdono/remove-py2 +1 -1
  23. s/.git/logs/refs/remotes/origin/spmcdono/remove-py2-dev +1 -1
  24. s/.git/logs/refs/remotes/origin/spmcdono/test-native-runtime-install +1 -1
  25. s/.git/logs/refs/remotes/origin/spmcdono/update-pipeline +1 -1
  26. s/.git/logs/refs/remotes/origin/user/marine/EliiseS/devcontainer +1 -1
  27. s/.git/logs/refs/remotes/origin/user/marine/fixsimver +1 -1
  28. s/.git/logs/refs/remotes/origin/user/marine/layereddeploymentsbuildtest +1 -1
  29. s/.git/logs/refs/remotes/origin/user/marine/master-to-main +1 -1
  30. s/.git/logs/refs/remotes/origin/user/marine/pipeline +1 -1
  31. s/.git/logs/refs/remotes/origin/user/vikas +1 -1
  32. s/.git/logs/refs/remotes/origin/user/vikas-bud-fix +1 -0
  33. s/.git/logs/refs/remotes/origin/user/vikas0212/verify-tests +1 -1
  34. s/.git/logs/refs/remotes/origin/user/vikas2 +1 -1
  35. s/.git/logs/refs/remotes/origin/user/vikas_bug-pyopenssl +1 -0
  36. s/.git/logs/refs/remotes/origin/user/vikas_pypi +1 -1
  37. s/.git/logs/refs/remotes/origin/user/vikas_pypi-1 +1 -1
  38. s/.git/logs/refs/remotes/origin/user/vikas_supplychain-issue1 +1 -0
  39. s/.git/logs/refs/remotes/origin/user/vikas_testing +1 -1
  40. s/.git/logs/refs/remotes/origin/user/vikas_trigger +1 -0
  41. s/.git/logs/refs/remotes/origin/user/vikas_trigger_new +1 -0
  42. s/.git/logs/refs/remotes/origin/user/xinzed/dps_conn_str +1 -1
  43. s/.git/logs/refs/remotes/origin/user/xinzed/update-python-docker +1 -1
  44. s/.git/logs/refs/remotes/origin/vikas/azure +1 -1
  45. s/.git/logs/refs/remotes/origin/vikas/dependebot +1 -1
  46. s/.git/logs/refs/remotes/origin/vikas-triggers +1 -0
  47. s/.git/logs/refs/remotes/origin/xinzed/3_1_0rc1 +1 -1
  48. s/.git/logs/refs/remotes/origin/xinzed/update-runtime +1 -1
  49. s/.git/objects/pack/pack-b6923255c7f7ef51c11dbd2c8db7ce310d4daf99.idx +0 -0
  50. s/.git/objects/pack/{pack-a8179feb7da51d11a42c37c5b3c8593cffe17075.pack → pack-b6923255c7f7ef51c11dbd2c8db7ce310d4daf99.pack} +0 -0
  51. s/.git/refs/remotes/origin/dependabot/pip/cookiecutter-2.1.1 +1 -0
  52. s/.git/refs/remotes/origin/main +1 -1
  53. s/.git/refs/remotes/origin/revert-594-user/vikas_bug-pyopenssl +1 -0
  54. s/.git/refs/remotes/origin/user/vikas-bud-fix +1 -0
  55. s/.git/refs/remotes/origin/user/vikas_bug-pyopenssl +1 -0
  56. s/.git/refs/remotes/origin/user/vikas_supplychain-issue1 +1 -0
  57. s/.git/refs/remotes/origin/user/vikas_trigger +1 -0
  58. s/.git/refs/remotes/origin/user/vikas_trigger_new +1 -0
  59. s/.git/refs/remotes/origin/vikas-triggers +1 -0
  60. s/.git/refs/tags/v3.3.5 +1 -0
  61. s/.git/refs/tags/v3.3.6 +1 -0
  62. s/.github/ISSUE_TEMPLATE/01_bug_report.yml +55 -0
  63. s/.github/ISSUE_TEMPLATE/02_feature_request.yml +14 -0
  64. s/.github/pull_request_template.md +35 -0
  65. s/.github/workflows/wiki.yml +1 -1
  66. s/.vscode/launch.json +2 -2
  67. s/.vscode/settings.json +2 -1
  68. s/CHANGELOG.md +68 -4
  69. s/CONTRIBUTING.md +30 -97
  70. s/Makefile +1 -2
  71. s/README.md +16 -169
  72. s/SECURITY.md +41 -0
  73. s/build/lib/iotedgedev/__init__.py +1 -1
  74. s/build/lib/iotedgedev/azurecli.py +47 -4
  75. s/build/lib/iotedgedev/cli.py +98 -52
  76. s/build/lib/iotedgedev/connectionstring.py +10 -8
  77. s/build/lib/iotedgedev/edge.py +1 -1
  78. s/build/lib/iotedgedev/envvars.py +1 -0
  79. s/build/lib/iotedgedev/output.py +4 -0
  80. s/dist/iotedgedev-3.3.6-py3-none-any.whl +0 -0
  81. s/docker/tool/build-docker.sh +3 -3
  82. s/docker/tool/deps.txt +1 -1
  83. s/docker/tool/linux/Dockerfile.base +7 -4
  84. s/docker/tool/windows/Dockerfile.base +1 -1
  85. s/docs/_Sidebar.md +5 -4
  86. s/docs/{Azure-Setup.md → azure-setup.md} +19 -18
  87. s/docs/{Command-List.md → command-list.md} +1 -0
  88. s/docs/{Edge-Device-Setup.md → edge-device-setup.md} +5 -4
  89. s/docs/environment-setup/install-docker.md +9 -0
  90. s/docs/environment-setup/manual-dev-machine-setup.md +79 -0
  91. s/docs/{Python-Virtual-Environment-Setup.md → environment-setup/python-virtual-environment-setup.md} +7 -8
  92. s/docs/environment-setup/run-devcontainer-docker.md +24 -0
  93. s/docs/home.md +10 -0
  94. s/docs/{Migration-Guides.md → migration-guides.md} +26 -26
  95. s/docs/quickstart.md +152 -0
  96. s/docs/run-modules-on-simulator.md +18 -0
  97. s/docs/run-modules-on-vm.md +54 -0
  98. s/docs/{Troubleshooting.md → troubleshooting.md} +5 -4
  99. s/docs/{Usage.md → usage.md} +19 -20
  100. s/iotedgedev/__init__.py +1 -1
  101. s/iotedgedev/azurecli.py +47 -4
  102. s/iotedgedev/cli.py +98 -52
  103. s/iotedgedev/connectionstring.py +10 -8
  104. s/iotedgedev/edge.py +1 -1
  105. s/iotedgedev/envvars.py +1 -0
  106. s/iotedgedev/output.py +4 -0
  107. s/iotedgedev.egg-info/PKG-INFO +1 -1
  108. s/iotedgedev.egg-info/SOURCES.txt +2 -1
  109. s/iotedgedev.egg-info/requires.txt +2 -2
  110. s/requirements.txt +3 -3
  111. s/setup.cfg +1 -1
  112. s/setup.py +5 -3
  113. s/tests/__init__.py +1 -1
  114. s/tests/assets/test_solution_shared_lib/deployment.template.json +1 -1
  115. s/tests/assets/test_solution_shared_lib/layered_deployment.flattened_props.template.json +43 -9
  116. s/tests/test_iotedgedev_iothub_deploy.py +0 -1
  117. s/tests/test_iotedgedev_solution.py +3 -4
  118. s/tests/test_iotedgedev_solution_build.py +0 -19
  119. s/tests/test_iotedgedev_solution_deploy.py +197 -0
  120. s/tests/test_iotedgedev_solution_init.py +34 -0
  121. s/.git/logs/refs/remotes/origin/eliises/add-device-tagging-docs +0 -1
  122. s/.git/objects/pack/pack-a8179feb7da51d11a42c37c5b3c8593cffe17075.idx +0 -0
  123. s/.git/refs/remotes/origin/eliises/add-device-tagging-docs +0 -1
  124. s/.github/ISSUE_TEMPLATE/bug_report.md +0 -16
  125. s/.github/ISSUE_TEMPLATE/feature_request.md +0 -7
  126. s/dist/iotedgedev-3.3.4-py3-none-any.whl +0 -0
  127. s/docs/Home.md +0 -10
  128. s/docs/Manual-Dev-Machine-Setup.md +0 -77
  129. s/docs/Quickstart-with-IoT-Edge-Dev-Container.md +0 -145
  130. s/pull_request_template.md +0 -9
  131. s/tests/assets/test_solution_shared_lib/layered_deployment.no_modules.template.json +0 -12
  132. /s/docs/{Command-Tips.md → command-tips.md} +0 -0
  133. /s/docs/{Overview.md → overview.md} +0 -0
  134. /s/docs/{Test-Coverage.md → test-coverage.md} +0 -0
@@ -59,6 +59,8 @@ tests/test_iotedgedev_iothub_deploy.py
59
59
  tests/test_iotedgedev_simulator.py
60
60
  tests/test_iotedgedev_solution.py
61
61
  tests/test_iotedgedev_solution_build.py
62
+ tests/test_iotedgedev_solution_deploy.py
63
+ tests/test_iotedgedev_solution_init.py
62
64
  tests/test_iotedgedev_solution_tag.py
63
65
  tests/test_utility.py
64
66
  tests/utility.py
@@ -79,7 +81,6 @@ tests/assets/test_solution_shared_lib/deployment.debug.template.json
79
81
  tests/assets/test_solution_shared_lib/deployment.escapedpath.template.json
80
82
  tests/assets/test_solution_shared_lib/deployment.template.json
81
83
  tests/assets/test_solution_shared_lib/layered_deployment.flattened_props.template.json
82
- tests/assets/test_solution_shared_lib/layered_deployment.no_modules.template.json
83
84
  tests/assets/test_solution_shared_lib/.vscode/launch.json
84
85
  tests/assets/test_solution_shared_lib/libs/sharedlib/Class1.cs
85
86
  tests/assets/test_solution_shared_lib/libs/sharedlib/sharedlib.csproj
@@ -4,8 +4,8 @@ docker>=3.7.0
4
4
  python-dotenv
5
5
  requests<=2.25.1,>=2.20.0
6
6
  fstrings
7
- azure-cli-core>=2.25.0
8
- iotedgehubdev==0.14.14
7
+ azure-cli-core<2.35.0,>=2.34.1
8
+ iotedgehubdev==0.14.16
9
9
  applicationinsights==0.11.9
10
10
  commentjson==0.9.0
11
11
  pyyaml>=5.4
s/requirements.txt CHANGED
@@ -3,10 +3,10 @@ docker==5.0.3
3
3
  python-dotenv==0.19.0
4
4
  requests==2.25.1
5
5
  fstrings==0.1.0
6
- msrestazure==0.4.34
7
- iotedgehubdev==0.14.14
6
+ msrestazure==0.6.4
7
+ iotedgehubdev==0.14.16
8
8
  applicationinsights==0.11.9
9
9
  commentjson==0.9.0
10
- azure-cli-core==2.25.0
10
+ azure-cli-core==2.34.1
11
11
  pypiwin32==219; sys_platform == 'win32' and python_version < '3.6'
12
12
  pypiwin32==223; sys_platform == 'win32' and python_version >= '3.6'
s/setup.cfg CHANGED
@@ -1,5 +1,5 @@
1
1
  [bumpversion]
2
- current_version = 3.3.4
2
+ current_version = 3.3.6
3
3
  commit = True
4
4
  tag = True
5
5
 
s/setup.py CHANGED
@@ -12,8 +12,10 @@ requirements = [
12
12
  'python-dotenv',
13
13
  'requests >= 2.20.0, <= 2.25.1',
14
14
  'fstrings',
15
- 'azure-cli-core >= 2.25.0',
16
- 'iotedgehubdev == 0.14.14',
15
+ # Note >=2.35.0 cannot be used as is not compatible with the docker dependency;
16
+ # docker requires websocket-client==0.56.0 and azure-cli-core>=2.35.0 requires websocket-client==1.31.1.
17
+ 'azure-cli-core >= 2.34.1, < 2.35.0',
18
+ 'iotedgehubdev == 0.14.16',
17
19
  'applicationinsights == 0.11.9',
18
20
  'commentjson == 0.9.0',
19
21
  'pyyaml>=5.4',
@@ -31,7 +33,7 @@ test_requirements = [
31
33
 
32
34
  setup(
33
35
  name='iotedgedev',
34
- version='3.3.4',
36
+ version='3.3.6',
35
37
  description='The Azure IoT Edge Dev Tool greatly simplifies the IoT Edge development process by automating many routine manual tasks, such as building, deploying, pushing modules and configuring the IoT Edge Runtime.',
36
38
  long_description='See https://github.com/azure/iotedgedev for usage instructions.',
37
39
  author='Microsoft Corporation',
s/tests/__init__.py CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  __author__ = 'Microsoft Corporation'
4
4
  __email__ = 'opencode@microsoft.com'
5
- __version__ = '3.3.4'
5
+ __version__ = '3.3.6'
@@ -13,7 +13,7 @@
13
13
  "testacr": {
14
14
  "username": "$USERNAME",
15
15
  "password": "$PASSWORD",
16
- "address": "$CONTAINER_REGISTRY_PASSWORD"
16
+ "address": "$CONTAINER_REGISTRY_SERVER"
17
17
  }
18
18
  }
19
19
  }
@@ -2,19 +2,53 @@
2
2
  "content": {
3
3
  "modulesContent": {
4
4
  "$edgeAgent": {
5
- "properties.desired.modules.sample_module": {
6
- "version": "1.0",
7
- "type": "docker",
8
- "status": "running",
9
- "restartPolicy": "always",
10
- "settings": {
11
- "image": "${MODULES.sample_module}",
12
- "createOptions": {}
5
+ "properties.desired": {
6
+ "schemaVersion": "${EDGEAGENT_SCHEMA_VERSION}",
7
+ "runtime": {
8
+ "type": "docker",
9
+ "settings": {
10
+ "minDockerVersion": "v1.25",
11
+ "loggingOptions": "",
12
+ "registryCredentials": {}
13
+ }
14
+ },
15
+ "modules": {
16
+ "sample_module": {
17
+ "version": "1.0",
18
+ "type": "docker",
19
+ "status": "running",
20
+ "restartPolicy": "always",
21
+ "settings": {
22
+ "image": "${MODULES.sample_module}",
23
+ "createOptions": {}
24
+ }
25
+ }
26
+ },
27
+ "systemModules": {
28
+ "edgeAgent": {
29
+ "type": "docker",
30
+ "settings": {
31
+ "image": "mcr.microsoft.com/azureiotedge-agent:${EDGE_RUNTIME_VERSION}"
32
+ }
33
+ },
34
+ "edgeHub": {
35
+ "type": "docker",
36
+ "status": "running",
37
+ "settings": {
38
+ "image": "mcr.microsoft.com/azureiotedge-hub:${EDGE_RUNTIME_VERSION}"
39
+ },
40
+ "restartPolicy": "always"
41
+ }
13
42
  }
14
43
  }
15
44
  },
16
45
  "$edgeHub": {
17
- "properties.desired.routes.upstream": "FROM /messages/* INTO $upstream"
46
+ "properties.desired": {
47
+ "schemaVersion": "${EDGEHUB_SCHEMA_VERSION}",
48
+ "routes": {
49
+ "route": "FROM /messages/* INTO $upstream"
50
+ }
51
+ }
18
52
  }
19
53
  }
20
54
  }
@@ -21,7 +21,6 @@ test_solution_shared_lib_dir = os.path.join(os.getcwd(), "tests", "assets", "tes
21
21
  "config, manifest",
22
22
  [
23
23
  ("layered_deployment.flattened_props.template.json", "layered_deployment.flattened_props.json"),
24
- ("layered_deployment.no_modules.template.json", "layered_deployment.no_modules.json"),
25
24
  ("deployment.template.json", f"deployment.{get_platform_type()}.json")
26
25
  ]
27
26
  )
@@ -201,7 +201,7 @@ def test_module_add_invalid_name(prepare_solution_with_env):
201
201
  assert "already exists under" in result.output
202
202
 
203
203
 
204
- @pytest.fixture
204
+ @ pytest.fixture
205
205
  def test_push_modules():
206
206
  result = runner_invoke(['push', '-P', get_platform_type()])
207
207
 
@@ -210,7 +210,7 @@ def test_push_modules():
210
210
  assert 'ERROR' not in result.output
211
211
 
212
212
 
213
- @pytest.fixture
213
+ @ pytest.fixture
214
214
  def test_deploy_modules():
215
215
  if get_docker_os_type() == "windows":
216
216
  result = runner_invoke(['deploy', '-f', os.path.join('config', 'deployment.' + get_platform_type() + '.json')])
@@ -221,7 +221,7 @@ def test_deploy_modules():
221
221
  assert 'ERROR' not in result.output.replace('ERROR: Error while checking for extension', '')
222
222
 
223
223
 
224
- @pytest.fixture
224
+ @ pytest.fixture
225
225
  def test_monitor(capfd):
226
226
  runner_invoke(['monitor', '--timeout', '5'])
227
227
 
@@ -371,7 +371,6 @@ def test_validate_deployment_template_and_manifest_success():
371
371
  result = runner_invoke(['genconfig', '-f', deployment_file_name])
372
372
 
373
373
  assert "ERROR" not in result.output
374
- assert "Deployment manifest schema validation passed" in result.output
375
374
  assert "Warning: Deployment manifest schema validation failed" not in result.output
376
375
  assert "Validation for all createOptions passed" in result.output
377
376
  assert "Warning: Errors found during createOptions validation" not in result.output
@@ -69,25 +69,6 @@ def test_solution_build_and_push_with_layered_deployment():
69
69
  assert 'ERROR' not in result.output
70
70
 
71
71
 
72
- def test_solution_build_and_push_with_layered_deployment_no_modules():
73
- # Arrange
74
- os.chdir(test_solution_shared_lib_dir)
75
- new_config_deployment_path = os.path.join(test_solution_shared_lib_dir, 'config', 'layered_deployment.no_modules.json')
76
-
77
- # Act
78
- result = runner_invoke(['build', '--push', '-f', "layered_deployment.no_modules.template.json", '-P', get_platform_type()])
79
-
80
- # Assert
81
-
82
- with open(new_config_deployment_path, "r") as f:
83
- content = json.load(f)
84
-
85
- set_property = content["content"]["modulesContent"]["exampleModule"]["properties.desired"]["foo"]
86
-
87
- assert 'ERROR' not in result.output
88
- assert 'bar-1.2' == set_property
89
-
90
-
91
72
  def test_solution_build_and_push_with_platform():
92
73
  os.chdir(test_solution_shared_lib_dir)
93
74
 
@@ -0,0 +1,197 @@
1
+ import json
2
+ import os
3
+ import shutil
4
+ import time
5
+ from unittest import mock
6
+
7
+ import pytest
8
+ from iotedgedev.envvars import EnvVars
9
+ from iotedgedev.output import Output
10
+ from iotedgedev.version import PY35
11
+
12
+ from .utility import (get_docker_os_type,
13
+ get_platform_type, runner_invoke)
14
+
15
+ pytestmark = pytest.mark.e2e
16
+
17
+ output = Output()
18
+ envvars = EnvVars(output)
19
+
20
+ root_dir = os.getcwd()
21
+ tests_dir = os.path.join(root_dir, "tests")
22
+ tests_assets_dir = os.path.join(tests_dir, "assets")
23
+
24
+ env_file_name = envvars.get_dotenv_file()
25
+ env_file_path = envvars.get_dotenv_path(env_file_name)
26
+
27
+ launch_json_file = os.path.join(tests_dir, "assets", "launch.json")
28
+ launch_json_file_without_nodejs = os.path.join(tests_dir, "assets", "launch_without_nodejs.json")
29
+
30
+ test_solution = "test_solution"
31
+ test_solution_dir = os.path.join(tests_dir, test_solution)
32
+
33
+ test_solution_shared_lib = "test_solution_shared_lib"
34
+ test_solution_shared_lib_dir = os.path.join(tests_dir, "assets", test_solution_shared_lib)
35
+
36
+ templates = ["c", "csharp", "java", "nodejs", "python", "csharpfunction"]
37
+
38
+
39
+ def create_solution(template, custom_module_name=None):
40
+ if custom_module_name is None:
41
+ module_name = template + "module"
42
+ else:
43
+ module_name = custom_module_name
44
+ result = runner_invoke(['new', test_solution, '-m', module_name, '-t', template])
45
+
46
+ return result
47
+
48
+
49
+ def clean_folder(folder_path):
50
+ os.chdir(tests_dir)
51
+ time.sleep(5)
52
+ shutil.rmtree(folder_path, ignore_errors=True)
53
+
54
+
55
+ @pytest.fixture
56
+ def prepare_solution_with_env():
57
+ os.chdir(tests_dir)
58
+
59
+ template = "csharp"
60
+ module_name = "filtermodule"
61
+ result = create_solution(template, module_name)
62
+ if 'AZURE IOT EDGE SOLUTION CREATED' not in result.output:
63
+ raise Exception(result.stdout)
64
+
65
+ shutil.copyfile(env_file_path, os.path.join(test_solution_dir, env_file_name))
66
+
67
+ os.chdir(test_solution_dir)
68
+
69
+ yield prepare_solution_with_env
70
+ clean_folder(test_solution_dir)
71
+
72
+ return
73
+
74
+
75
+ def assert_solution_folder_structure(template):
76
+ module_name = template + "module"
77
+
78
+ expected_files = [".env", "deployment.template.json", "deployment.debug.template.json",
79
+ os.path.join(".vscode", "launch.json"),
80
+ os.path.join("modules", module_name, "Dockerfile.amd64"),
81
+ os.path.join("modules", module_name, "Dockerfile.amd64.debug"),
82
+ os.path.join("modules", module_name, "Dockerfile.arm32v7"),
83
+ os.path.join("modules", module_name, "module.json")]
84
+ for expected_file in expected_files:
85
+ assert os.path.exists(os.path.join(test_solution_dir, expected_file))
86
+
87
+ expected_template_files = [os.environ["DEPLOYMENT_CONFIG_TEMPLATE_FILE"], os.environ["DEPLOYMENT_CONFIG_DEBUG_TEMPLATE_FILE"]]
88
+
89
+ for expected_template_file in expected_template_files:
90
+ with open(os.path.join(test_solution_dir, expected_template_file)) as f:
91
+ content = json.load(f)
92
+
93
+ assert module_name in content["modulesContent"]["$edgeAgent"]["properties.desired"]["modules"]
94
+ assert module_name in content["modulesContent"]["$edgeAgent"]["properties.desired"]["modules"][module_name]["settings"]["image"]
95
+ assert module_name in content["modulesContent"]["$edgeHub"]["properties.desired"]["routes"]["sensorTo" + module_name]
96
+ assert module_name in content["modulesContent"]["$edgeHub"]["properties.desired"]["routes"][module_name + "ToIoTHub"]
97
+
98
+
99
+ def assert_module_folder_structure(template):
100
+ module_name = template + "module"
101
+ expected_template_files = [os.environ["DEPLOYMENT_CONFIG_TEMPLATE_FILE"], os.environ["DEPLOYMENT_CONFIG_DEBUG_TEMPLATE_FILE"]]
102
+
103
+ for expected_template_file in expected_template_files:
104
+ with open(expected_template_file) as f:
105
+ content = json.load(f)
106
+
107
+ assert module_name in content["modulesContent"]["$edgeAgent"]["properties.desired"]["modules"]
108
+ assert module_name in content["modulesContent"]["$edgeAgent"]["properties.desired"]["modules"][module_name]["settings"]["image"]
109
+ assert module_name in content["modulesContent"]["$edgeHub"]["properties.desired"]["routes"][module_name + "ToIoTHub"]
110
+
111
+ if expected_template_file == os.environ["DEPLOYMENT_CONFIG_DEBUG_TEMPLATE_FILE"]:
112
+ if module_name in ["cmodule", "pythonmodule", "nodejsmodule", "javamodule"]:
113
+ assert "HostConfig" in content["modulesContent"]["$edgeAgent"]["properties.desired"]["modules"][module_name]["settings"]["createOptions"]
114
+
115
+
116
+ @pytest.fixture
117
+ def test_push_modules():
118
+ result = runner_invoke(['push', '-P', get_platform_type()])
119
+
120
+ assert 'BUILD COMPLETE' in result.output
121
+ assert 'PUSH COMPLETE' in result.output
122
+ assert 'ERROR' not in result.output
123
+
124
+
125
+ @pytest.fixture
126
+ def test_deploy_modules():
127
+ if get_docker_os_type() == "windows":
128
+ result = runner_invoke(['deploy', '-f', os.path.join('config', 'deployment.' + get_platform_type() + '.json')])
129
+ else:
130
+ result = runner_invoke(['deploy'])
131
+
132
+ assert 'DEPLOYMENT COMPLETE' in result.output
133
+ assert 'ERROR' not in result.output.replace('ERROR: Error while checking for extension', '')
134
+
135
+
136
+ @pytest.fixture
137
+ def test_monitor(capfd):
138
+ runner_invoke(['monitor', '--timeout', '5'])
139
+
140
+ out, err = capfd.readouterr()
141
+ if not PY35:
142
+ assert 'Monitoring events from device' in out
143
+ else:
144
+ assert not err
145
+
146
+
147
+ def get_connection_string_value(key: str) -> str:
148
+
149
+ connection_string_values = os.environ["DEVICE_CONNECTION_STRING"].split(';')
150
+ device_id = None
151
+
152
+ for item in connection_string_values:
153
+ if key in item:
154
+ device_id = item.split('=')[1]
155
+
156
+ return device_id
157
+
158
+
159
+ @ mock.patch.dict(os.environ, {"DEVICE_CONNECTION_STRING": f"HostName={get_connection_string_value('HostName')};DeviceId={get_connection_string_value('DeviceId')};=testaccesskey"})
160
+ def test_solution_deploy_with_sas_connection_string():
161
+ # Arrange
162
+ os.chdir(test_solution_shared_lib_dir)
163
+
164
+ # Act
165
+ result = runner_invoke(['solution', 'deploy'])
166
+
167
+ # Assert
168
+ assert 'DEPLOYMENT COMPLETE' in result.output
169
+ assert 'ERROR' not in result.output
170
+
171
+
172
+ @ mock.patch.dict(os.environ, {"DEVICE_CONNECTION_STRING": f"HostName={get_connection_string_value('HostName')};DeviceId={get_connection_string_value('DeviceId')};x509=true;"})
173
+ def test_solution_deploy_with_x509_connection_string():
174
+ # Arrange
175
+ os.chdir(test_solution_shared_lib_dir)
176
+
177
+ # Act
178
+ runner_invoke(['build', '-f', "deployment.template.json", '-P', get_platform_type()])
179
+ result = runner_invoke(['solution', 'deploy'])
180
+
181
+ # Assert
182
+ assert 'DEPLOYMENT COMPLETE' in result.output
183
+ assert 'ERROR' not in result.output
184
+
185
+
186
+ @ mock.patch.dict(os.environ, {"DEVICE_CONNECTION_STRING": "HostName=test-iothub.azure-devices.net;SharedAccessKey=testaccesskey"})
187
+ def test_connection_string_no_device_id_throws_env_error():
188
+ # Arrange
189
+ os.chdir(test_solution_shared_lib_dir)
190
+
191
+ # Act
192
+ runner_invoke(['build', '-f', "deployment.template.json", '-P', get_platform_type()])
193
+ with pytest.raises(Exception) as context:
194
+ runner_invoke(['solution', 'deploy'])
195
+
196
+ # Assert
197
+ assert "ERROR: Environment Variable EDGE_DEVICE_ID not set." in str(context.value)
@@ -0,0 +1,34 @@
1
+ import os
2
+ import shutil
3
+ import uuid
4
+ from unittest import mock
5
+ from .utility import (runner_invoke)
6
+
7
+
8
+ def test_solution_init_without_name():
9
+ result = runner_invoke(['solution', 'init'], True)
10
+
11
+ assert "Directory is not empty" in result.output
12
+
13
+
14
+ def test_solution_init_with_invalid_name_non_empty_dir():
15
+ dirname = f'test-{uuid.uuid4()}'
16
+ os.makedirs(f'{dirname}/empty_dir')
17
+
18
+ result = runner_invoke(['solution', 'init', dirname], True)
19
+
20
+ assert "Directory is not empty" in result.output
21
+ shutil.rmtree(dirname, ignore_errors=True)
22
+
23
+
24
+ def test_solution_init_with_valid_name():
25
+ dirname = f'test-{uuid.uuid4()}'
26
+
27
+ # Mock calls to additional commands, to avoid triggering user prompts
28
+ with mock.patch('iotedgedev.utility.Utility.call_proc') as mock_call_proc:
29
+ result = runner_invoke(['solution', 'init', dirname], True)
30
+
31
+ assert 'AZURE IOT EDGE SOLUTION CREATED' in result.output
32
+ mock_call_proc.assert_called_with(["iotedgedev", "iothub", "setup", "--update-dotenv"])
33
+ assert mock_call_proc.call_count == 2
34
+ shutil.rmtree(dirname, ignore_errors=True)
@@ -1 +0,0 @@
1
- 0000000000000000000000000000000000000000 89935ca2b03964ef69cbccb1b8e5815ca25ec62d Ubuntu <cloudtest@fd6fd2d8c000000.p5rt4sl1n0gu1ozd445c4dptsd.bx.internal.cloudapp.net> 1648752750 +0000 fetch --force --tags --prune --prune-tags --progress --no-recurse-submodules origin: storing head
@@ -1 +0,0 @@
1
- 89935ca2b03964ef69cbccb1b8e5815ca25ec62d
@@ -1,16 +0,0 @@
1
- ---
2
- name: Bug report
3
- about: Create a issue to help us improve
4
- ---
5
-
6
- <!-- Fill in the information needed -->
7
- - iotedgedev Version:
8
- - Python Version:
9
- - Pip Version:
10
- - Development machine OS Version:
11
- - IoT Edge device OS Version:
12
-
13
- Steps to Reproduce:
14
-
15
- 1.
16
- 2.
@@ -1,7 +0,0 @@
1
- ---
2
- name: Feature request
3
- about: Suggest an idea for IoT Edge and IoT Edge development tools
4
-
5
- ---
6
-
7
- <!-- Describe the feature you'd like. -->
Binary file
s/docs/Home.md DELETED
@@ -1,10 +0,0 @@
1
- Welcome to the IoT Edge Dev Tool wiki!
2
-
3
- The **IoT Edge Dev Tool** greatly simplifies [Azure IoT Edge](https:/azure.microsoft.com/en-us/services/iot-edge/) development down to simple commands driven by environment variables.
4
-
5
- - It gets you started with IoT Edge development with the [IoT Edge Dev Container](quickstart-with-iot-edge-dev-container) and IoT Edge solution scaffolding that contains a default module and all the required configuration files.
6
- - It speeds up your inner-loop dev (dev, debug, test) by reducing multi-step build & deploy processes into one-line CLI commands as well as drives your outer-loop CI/CD pipeline. _You can use all the same commands in both stages of your development life-cycle._
7
-
8
- ## Issues
9
-
10
- Please use the [GitHub issues page](https://github.com/azure/iotedgedev/issues) to report any issues.
@@ -1,77 +0,0 @@
1
- Here is what you need to do to get Azure IoT Edge Dev Tool (aka `iotedgedev`) running on your dev machine manually instead of using the IoT Edge Dev Container.
2
-
3
- If you are using a separate Edge device, like a Raspberry Pi, you do not need to run all of these steps on your IoT Edge device, you can install and setup Edge runtime directly on the device. See the [Edge Device Setup](edge-device-setup) wiki page for more information on setting up your Edge device.
4
-
5
- > Note: See the ["Test Coverage"](test-coverage) wiki page to see what the IoT Edge Dev Tool has been tested with.
6
-
7
- 1. Install **[Docker](https://docs.docker.com/engine/installation/)**
8
- - Windows
9
- - Be sure to check whether you are running in Linux container mode or Windows container mode.
10
- - Linux
11
- - We've seen some issues with docker.io. If Edge doesn't run for you, then try installing Docker CE directly instead of via docker.io. Use the [CE install steps](https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/#install-docker-ce), or use the [convenience script](https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/#install-using-the-convenience-script).
12
- - By default, you need `sudo` to run `docker` commands. If you want to avoid this, please follow the [post-installation steps for Linux](https://docs.docker.com/install/linux/linux-postinstall/#manage-docker-as-a-non-root-user).
13
-
14
- 1. Install **Python 2.7+ or Python 3.6+** and **pip** (Python 3.6 is recommended)
15
- - Windows: [Install from Python's website](https://www.python.org/downloads/)
16
- - Linux: `sudo apt install python-pip` or `sudo apt install python3-pip`
17
- - macOS: The OpenSSL used by the system built-in Python is old and vulnerable. Please use Python installed with [Homebrew](https://docs.brew.sh/Homebrew-and-Python)
18
-
19
- 1. Install **[Azure CLI 2.0](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest)**
20
-
21
- 1. Install **[Azure CLI IoT extension](https://github.com/Azure/azure-iot-cli-extension/)**
22
-
23
- - New Install: `az extension add --name azure-iot`
24
- - Update Install: `az extension update --name azure-iot`
25
-
26
- 1. (Python < 3.5 only) Install **[Node.js](https://nodejs.org/en/download/)** and the **`iothub-explorer`** package
27
-
28
- - uamqp, which is needed by Azure CLI IoT extension for monitoring messages, is not supported in Python < 3.5. For Python < 3.5 users, please install [Node.js](https://nodejs.org/en/download/) and the `iothub-explorer` Node.js package: `npm i -g iothub-explorer`
29
-
30
- 1. (Raspberry Pi only) Install extra system dependencies
31
-
32
- ```
33
- sudo apt-get install python2.7-dev libffi-dev libssl-dev -y
34
- ```
35
-
36
- 1. (Linux only) Install [Docker Compose](https://docs.docker.com/compose/)
37
-
38
- ```
39
- pip install -U docker-compose
40
- ```
41
-
42
- 1. Install **`iotedgedev`**
43
-
44
- > You do not need to run this on the Edge device. See the [Edge Device Setup](edge-device-setup) page for more information on setting up your Edge device.
45
-
46
- > You can also run under a Python Virtual Environment. See the [Python Virtual Environment Setup](python-virtual-environment-setup) instructions page for details on how to set that up.
47
-
48
- > There is a known dependency conflict between `iotedgedev` and now-deprecated `azure-iot-edge-runtime-ctl`. Please make sure you have uninstalled `azure-iot-edge-runtime-ctl` before installing `iotedgedev`: `pip uninstall azure-iot-edge-runtime-ctl `, or use a clean virtual environment.
49
-
50
- ```
51
- pip install -U iotedgedev
52
- ```
53
-
54
- 1. Install module dependencies
55
- ##### C# module and C# Azure Functions module
56
- Install **[.NET Core SDK](https://www.microsoft.com/net/download)**.
57
- > You need .NET Core SDK 2.1 or later to run it on ARM. There is no official document on installing .NET Core SDK on ARM yet, but you can follow the [ARM32v7 Dockerfile](https://github.com/dotnet/dotnet-docker/blob/master/src/sdk/3.1/buster/arm32v7/Dockerfile).
58
-
59
- ##### Python module
60
- 1. Install **[Git](https://git-scm.com/)**
61
- 2. Install **[Cookiecutter](https://github.com/audreyr/cookiecutter)**
62
- ```
63
- pip install -U cookiecutter
64
- ```
65
-
66
- ##### Node.js module
67
- 1. Install **[Node.js](https://nodejs.org/en/download/)**
68
- 2. Install **[Yeoman](http://yeoman.io/)** and **[Azure IoT Edge Node.js module generator](https://github.com/Azure/generator-azure-iot-edge-module)** packages
69
- ```
70
- npm i -g yo generator-azure-iot-edge-module
71
- ```
72
-
73
- ##### Java module
74
- 1. Install **[JDK](https://www.oracle.com/technetwork/java/javase/downloads/index.html)**
75
- 1. Install **[Maven](https://maven.apache.org/)**
76
-
77
- 1. Follow the [Usage Wiki](usage) to learn the usage of IoT Edge Dev Tool