iotedgedev 3.3.4__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.
- s/.devcontainer/Dockerfile +75 -0
- s/.devcontainer/devcontainer.json +40 -0
- s/.devcontainer/library-scripts/docker-in-docker-debian.sh +236 -0
- s/.env.tmp +108 -0
- s/.git/FETCH_HEAD +61 -0
- s/.git/HEAD +1 -0
- s/.git/config +12 -0
- s/.git/description +1 -0
- s/.git/hooks/applypatch-msg.sample +15 -0
- s/.git/hooks/commit-msg.sample +24 -0
- s/.git/hooks/fsmonitor-watchman.sample +173 -0
- s/.git/hooks/post-update.sample +8 -0
- s/.git/hooks/pre-applypatch.sample +14 -0
- s/.git/hooks/pre-commit.sample +49 -0
- s/.git/hooks/pre-merge-commit.sample +13 -0
- s/.git/hooks/pre-push.sample +53 -0
- s/.git/hooks/pre-rebase.sample +169 -0
- s/.git/hooks/pre-receive.sample +24 -0
- s/.git/hooks/prepare-commit-msg.sample +42 -0
- s/.git/hooks/push-to-checkout.sample +78 -0
- s/.git/hooks/update.sample +128 -0
- s/.git/index +0 -0
- s/.git/info/exclude +6 -0
- s/.git/logs/HEAD +1 -0
- s/.git/logs/refs/remotes/origin/EO +1 -0
- s/.git/logs/refs/remotes/origin/avagraw/security_fix +1 -0
- s/.git/logs/refs/remotes/origin/cherry-pick-rename +1 -0
- s/.git/logs/refs/remotes/origin/chyuan/fix-validation-not-fail-test +1 -0
- s/.git/logs/refs/remotes/origin/chyuan/update-linux-agent +1 -0
- s/.git/logs/refs/remotes/origin/dependabot/pip/pyyaml-5.4 +1 -0
- s/.git/logs/refs/remotes/origin/eliises/add-device-tagging-docs +1 -0
- s/.git/logs/refs/remotes/origin/main +1 -0
- s/.git/logs/refs/remotes/origin/ray-deps +1 -0
- s/.git/logs/refs/remotes/origin/ray-dev-setup +1 -0
- s/.git/logs/refs/remotes/origin/ray-tox +1 -0
- s/.git/logs/refs/remotes/origin/release-pipeline-automation +1 -0
- s/.git/logs/refs/remotes/origin/spmcdono/fix-pipeline-test-install +1 -0
- s/.git/logs/refs/remotes/origin/spmcdono/layered-deployments +1 -0
- s/.git/logs/refs/remotes/origin/spmcdono/pypi-package-test-pipeline +1 -0
- s/.git/logs/refs/remotes/origin/spmcdono/remove-py2 +1 -0
- s/.git/logs/refs/remotes/origin/spmcdono/remove-py2-dev +1 -0
- s/.git/logs/refs/remotes/origin/spmcdono/test-native-runtime-install +1 -0
- s/.git/logs/refs/remotes/origin/spmcdono/update-pipeline +1 -0
- s/.git/logs/refs/remotes/origin/user/marine/EliiseS/devcontainer +1 -0
- s/.git/logs/refs/remotes/origin/user/marine/fixsimver +1 -0
- s/.git/logs/refs/remotes/origin/user/marine/layereddeploymentsbuildtest +1 -0
- s/.git/logs/refs/remotes/origin/user/marine/master-to-main +1 -0
- s/.git/logs/refs/remotes/origin/user/marine/pipeline +1 -0
- s/.git/logs/refs/remotes/origin/user/vikas +1 -0
- s/.git/logs/refs/remotes/origin/user/vikas0212/verify-tests +1 -0
- s/.git/logs/refs/remotes/origin/user/vikas2 +1 -0
- s/.git/logs/refs/remotes/origin/user/vikas_pypi +1 -0
- s/.git/logs/refs/remotes/origin/user/vikas_pypi-1 +1 -0
- s/.git/logs/refs/remotes/origin/user/vikas_testing +1 -0
- s/.git/logs/refs/remotes/origin/user/xinzed/dps_conn_str +1 -0
- s/.git/logs/refs/remotes/origin/user/xinzed/update-python-docker +1 -0
- s/.git/logs/refs/remotes/origin/vikas/azure +1 -0
- s/.git/logs/refs/remotes/origin/vikas/dependebot +1 -0
- s/.git/logs/refs/remotes/origin/xinzed/3_1_0rc1 +1 -0
- s/.git/logs/refs/remotes/origin/xinzed/update-runtime +1 -0
- s/.git/objects/pack/pack-a8179feb7da51d11a42c37c5b3c8593cffe17075.idx +0 -0
- s/.git/objects/pack/pack-a8179feb7da51d11a42c37c5b3c8593cffe17075.pack +0 -0
- s/.git/refs/remotes/origin/EO +1 -0
- s/.git/refs/remotes/origin/avagraw/security_fix +1 -0
- s/.git/refs/remotes/origin/cherry-pick-rename +1 -0
- s/.git/refs/remotes/origin/chyuan/fix-validation-not-fail-test +1 -0
- s/.git/refs/remotes/origin/chyuan/update-linux-agent +1 -0
- s/.git/refs/remotes/origin/dependabot/pip/pyyaml-5.4 +1 -0
- s/.git/refs/remotes/origin/eliises/add-device-tagging-docs +1 -0
- s/.git/refs/remotes/origin/main +1 -0
- s/.git/refs/remotes/origin/ray-deps +1 -0
- s/.git/refs/remotes/origin/ray-dev-setup +1 -0
- s/.git/refs/remotes/origin/ray-tox +1 -0
- s/.git/refs/remotes/origin/release-pipeline-automation +1 -0
- s/.git/refs/remotes/origin/spmcdono/fix-pipeline-test-install +1 -0
- s/.git/refs/remotes/origin/spmcdono/layered-deployments +1 -0
- s/.git/refs/remotes/origin/spmcdono/pypi-package-test-pipeline +1 -0
- s/.git/refs/remotes/origin/spmcdono/remove-py2 +1 -0
- s/.git/refs/remotes/origin/spmcdono/remove-py2-dev +1 -0
- s/.git/refs/remotes/origin/spmcdono/test-native-runtime-install +1 -0
- s/.git/refs/remotes/origin/spmcdono/update-pipeline +1 -0
- s/.git/refs/remotes/origin/user/marine/EliiseS/devcontainer +1 -0
- s/.git/refs/remotes/origin/user/marine/fixsimver +1 -0
- s/.git/refs/remotes/origin/user/marine/layereddeploymentsbuildtest +1 -0
- s/.git/refs/remotes/origin/user/marine/master-to-main +1 -0
- s/.git/refs/remotes/origin/user/marine/pipeline +1 -0
- s/.git/refs/remotes/origin/user/vikas +1 -0
- s/.git/refs/remotes/origin/user/vikas0212/verify-tests +1 -0
- s/.git/refs/remotes/origin/user/vikas2 +1 -0
- s/.git/refs/remotes/origin/user/vikas_pypi +1 -0
- s/.git/refs/remotes/origin/user/vikas_pypi-1 +1 -0
- s/.git/refs/remotes/origin/user/vikas_testing +1 -0
- s/.git/refs/remotes/origin/user/xinzed/dps_conn_str +1 -0
- s/.git/refs/remotes/origin/user/xinzed/update-python-docker +1 -0
- s/.git/refs/remotes/origin/vikas/azure +1 -0
- s/.git/refs/remotes/origin/vikas/dependebot +1 -0
- s/.git/refs/remotes/origin/xinzed/3_1_0rc1 +1 -0
- s/.git/refs/remotes/origin/xinzed/update-runtime +1 -0
- s/.git/refs/tags/v0.49.0 +1 -0
- s/.git/refs/tags/v0.50.0 +1 -0
- s/.git/refs/tags/v0.51.0 +1 -0
- s/.git/refs/tags/v0.52.0 +1 -0
- s/.git/refs/tags/v0.53.0 +1 -0
- s/.git/refs/tags/v0.54.0 +1 -0
- s/.git/refs/tags/v0.55.0 +1 -0
- s/.git/refs/tags/v0.56.0 +1 -0
- s/.git/refs/tags/v0.57.0 +1 -0
- s/.git/refs/tags/v0.58.0 +1 -0
- s/.git/refs/tags/v0.59.0 +1 -0
- s/.git/refs/tags/v0.60.0 +1 -0
- s/.git/refs/tags/v0.61.0 +1 -0
- s/.git/refs/tags/v0.62.0 +1 -0
- s/.git/refs/tags/v0.63.0 +1 -0
- s/.git/refs/tags/v0.64.0 +1 -0
- s/.git/refs/tags/v0.65.0 +1 -0
- s/.git/refs/tags/v0.66.0 +1 -0
- s/.git/refs/tags/v0.67.0 +1 -0
- s/.git/refs/tags/v0.68.0 +1 -0
- s/.git/refs/tags/v0.69.0 +1 -0
- s/.git/refs/tags/v0.70.0 +1 -0
- s/.git/refs/tags/v0.71.0 +1 -0
- s/.git/refs/tags/v0.72.0 +1 -0
- s/.git/refs/tags/v0.73.0 +1 -0
- s/.git/refs/tags/v0.74.0 +1 -0
- s/.git/refs/tags/v0.75.0 +1 -0
- s/.git/refs/tags/v0.76.0 +1 -0
- s/.git/refs/tags/v0.77.0 +1 -0
- s/.git/refs/tags/v0.78.0 +1 -0
- s/.git/refs/tags/v0.79.0 +1 -0
- s/.git/refs/tags/v0.82.0 +1 -0
- s/.git/refs/tags/v0.82.0-container +1 -0
- s/.git/refs/tags/v1.0.0 +1 -0
- s/.git/refs/tags/v1.1.0 +1 -0
- s/.git/refs/tags/v1.2.0 +1 -0
- s/.git/refs/tags/v1.3.0 +1 -0
- s/.git/refs/tags/v2.0.0 +1 -0
- s/.git/refs/tags/v2.0.1 +1 -0
- s/.git/refs/tags/v2.0.2 +1 -0
- s/.git/refs/tags/v2.1.0 +1 -0
- s/.git/refs/tags/v2.1.1 +1 -0
- s/.git/refs/tags/v2.1.2 +1 -0
- s/.git/refs/tags/v2.1.3 +1 -0
- s/.git/refs/tags/v2.1.4 +1 -0
- s/.git/refs/tags/v2.1.6 +1 -0
- s/.git/refs/tags/v2.2.0 +1 -0
- s/.git/refs/tags/v3.0.0 +1 -0
- s/.git/refs/tags/v3.0.0-rc +1 -0
- s/.git/refs/tags/v3.1.0 +1 -0
- s/.git/refs/tags/v3.1.1 +1 -0
- s/.git/refs/tags/v3.1.2 +1 -0
- s/.git/refs/tags/v3.2.0 +1 -0
- s/.git/refs/tags/v3.2.0rc0 +1 -0
- s/.git/refs/tags/v3.3.0 +1 -0
- s/.git/refs/tags/v3.3.1 +1 -0
- s/.git/refs/tags/v3.3.2 +1 -0
- s/.git/refs/tags/v3.3.3 +1 -0
- s/.git/refs/tags/v3.3.3-rc0 +1 -0
- s/.git/refs/tags/v3.3.4 +1 -0
- s/.github/ISSUE_TEMPLATE/bug_report.md +16 -0
- s/.github/ISSUE_TEMPLATE/feature_request.md +7 -0
- s/.github/workflows/wiki.yml +54 -0
- s/.gitignore +103 -0
- s/.vscode/launch.json +26 -0
- s/.vscode/settings.json +30 -0
- s/CHANGELOG.md +156 -0
- s/CODE_OF_CONDUCT.md +1 -0
- s/CONTRIBUTING.md +122 -0
- s/LICENSE +14 -0
- s/MANIFEST.in +7 -0
- s/Makefile +87 -0
- s/README.md +204 -0
- s/assets/armdeployment.png +0 -0
- s/assets/armoutputs.png +0 -0
- s/assets/deploy/ARMDeployment/ARMDeployment.deployproj +36 -0
- s/assets/deploy/ARMDeployment/Deploy-AzureResourceGroup.ps1 +118 -0
- s/assets/deploy/ARMDeployment/azuredeploy.json +145 -0
- s/assets/deploy/ARMDeployment/azuredeploy.parameters.json +6 -0
- s/assets/deploy/ARMDeployment.sln +25 -0
- s/assets/edgedevtool2mins.png +0 -0
- s/assets/edgedevtoolintro.png +0 -0
- s/assets/edgedevtoolquickstartlarge.png +0 -0
- s/assets/edgedevtoolquickstartsmall.png +0 -0
- s/assets/edgedevtoolwsl.png +0 -0
- s/azure-pipelines.yml +144 -0
- s/build/lib/iotedgedev/__init__.py +6 -0
- s/build/lib/iotedgedev/args.py +18 -0
- s/build/lib/iotedgedev/azurecli.py +542 -0
- s/build/lib/iotedgedev/buildoptionsparser.py +151 -0
- s/build/lib/iotedgedev/buildprofile.py +5 -0
- s/build/lib/iotedgedev/cli.py +830 -0
- s/build/lib/iotedgedev/connectionstring.py +58 -0
- s/build/lib/iotedgedev/constants.py +12 -0
- s/build/lib/iotedgedev/containerregistry.py +5 -0
- s/build/lib/iotedgedev/decorators.py +116 -0
- s/build/lib/iotedgedev/deploymentmanifest.py +313 -0
- s/build/lib/iotedgedev/dockercls.py +255 -0
- s/build/lib/iotedgedev/dotnet.py +31 -0
- s/build/lib/iotedgedev/edge.py +33 -0
- s/build/lib/iotedgedev/envvars.py +240 -0
- s/build/lib/iotedgedev/iothub.py +65 -0
- s/build/lib/iotedgedev/module.py +62 -0
- s/build/lib/iotedgedev/modules.py +332 -0
- s/build/lib/iotedgedev/organizedgroup.py +48 -0
- s/build/lib/iotedgedev/output.py +57 -0
- s/build/lib/iotedgedev/simulator.py +58 -0
- s/build/lib/iotedgedev/solution.py +48 -0
- s/build/lib/iotedgedev/telemetry.py +155 -0
- s/build/lib/iotedgedev/telemetryconfig.py +85 -0
- s/build/lib/iotedgedev/telemetryuploader.py +53 -0
- s/build/lib/iotedgedev/template/.env.tmp +87 -0
- s/build/lib/iotedgedev/template/.gitignore +10 -0
- s/build/lib/iotedgedev/template/deployment.template.json +79 -0
- s/build/lib/iotedgedev/template/launch_c.json +50 -0
- s/build/lib/iotedgedev/template/launch_csharp.json +43 -0
- s/build/lib/iotedgedev/template/launch_java.json +27 -0
- s/build/lib/iotedgedev/template/launch_node.json +36 -0
- s/build/lib/iotedgedev/template/launch_python.json +22 -0
- s/build/lib/iotedgedev/utility.py +179 -0
- s/build/lib/iotedgedev/version.py +4 -0
- s/build.sh +150 -0
- s/cleanup.sh +7 -0
- s/dist/iotedgedev-3.3.4-py3-none-any.whl +0 -0
- s/docker/tool/build-docker.sh +168 -0
- s/docker/tool/deps.txt +7 -0
- s/docker/tool/linux/Dockerfile +7 -0
- s/docker/tool/linux/Dockerfile.base +61 -0
- s/docker/tool/linux/install-dev.sh +8 -0
- s/docker/tool/linux/run.ps1 +5 -0
- s/docker/tool/linux/run.sh +5 -0
- s/docker/tool/push-docker.sh +35 -0
- s/docker/tool/windows/Dockerfile +4 -0
- s/docker/tool/windows/Dockerfile.base +63 -0
- s/docker/tool/windows/install-dev.bat +4 -0
- s/docker/tool/windows/run.ps1 +30 -0
- s/docs/Azure-Setup.md +102 -0
- s/docs/Command-List.md +564 -0
- s/docs/Command-Tips.md +51 -0
- s/docs/Edge-Device-Setup.md +23 -0
- s/docs/Home.md +10 -0
- s/docs/Manual-Dev-Machine-Setup.md +77 -0
- s/docs/Migration-Guides.md +131 -0
- s/docs/Overview.md +66 -0
- s/docs/Python-Virtual-Environment-Setup.md +35 -0
- s/docs/Quickstart-with-IoT-Edge-Dev-Container.md +145 -0
- s/docs/Test-Coverage.md +7 -0
- s/docs/Troubleshooting.md +21 -0
- s/docs/Usage.md +123 -0
- s/docs/_Sidebar.md +13 -0
- s/iotedgedev/__init__.py +6 -0
- s/iotedgedev/args.py +18 -0
- s/iotedgedev/azurecli.py +542 -0
- s/iotedgedev/buildoptionsparser.py +151 -0
- s/iotedgedev/buildprofile.py +5 -0
- s/iotedgedev/cli.py +830 -0
- s/iotedgedev/connectionstring.py +58 -0
- s/iotedgedev/constants.py +12 -0
- s/iotedgedev/containerregistry.py +5 -0
- s/iotedgedev/decorators.py +116 -0
- s/iotedgedev/deploymentmanifest.py +313 -0
- s/iotedgedev/dockercls.py +255 -0
- s/iotedgedev/dotnet.py +31 -0
- s/iotedgedev/edge.py +33 -0
- s/iotedgedev/envvars.py +240 -0
- s/iotedgedev/iothub.py +65 -0
- s/iotedgedev/module.py +62 -0
- s/iotedgedev/modules.py +332 -0
- s/iotedgedev/organizedgroup.py +48 -0
- s/iotedgedev/output.py +57 -0
- s/iotedgedev/simulator.py +58 -0
- s/iotedgedev/solution.py +48 -0
- s/iotedgedev/telemetry.py +155 -0
- s/iotedgedev/telemetryconfig.py +85 -0
- s/iotedgedev/telemetryuploader.py +53 -0
- s/iotedgedev/template/.env.tmp +87 -0
- s/iotedgedev/template/.gitignore +10 -0
- s/iotedgedev/template/deployment.template.json +79 -0
- s/iotedgedev/template/launch_c.json +50 -0
- s/iotedgedev/template/launch_csharp.json +43 -0
- s/iotedgedev/template/launch_java.json +27 -0
- s/iotedgedev/template/launch_node.json +36 -0
- s/iotedgedev/template/launch_python.json +22 -0
- s/iotedgedev/utility.py +179 -0
- s/iotedgedev/version.py +4 -0
- s/iotedgedev.egg-info/PKG-INFO +21 -0
- s/iotedgedev.egg-info/SOURCES.txt +100 -0
- s/iotedgedev.egg-info/dependency_links.txt +1 -0
- s/iotedgedev.egg-info/entry_points.txt +3 -0
- s/iotedgedev.egg-info/not-zip-safe +1 -0
- s/iotedgedev.egg-info/requires.txt +18 -0
- s/iotedgedev.egg-info/top_level.txt +1 -0
- s/pull_request_template.md +9 -0
- s/pytest.ini +4 -0
- s/requirements.txt +12 -0
- s/requirements_dev.txt +17 -0
- s/scripts/gen-help-markdown.bat +177 -0
- s/scripts/install-pip.sh +1 -0
- s/scripts/setup-wsl.sh +7 -0
- s/setup.cfg +18 -0
- s/setup.py +66 -0
- s/tests/__init__.py +5 -0
- s/tests/assets/deployment.manifest_invalid.json +106 -0
- s/tests/assets/deployment.manifest_invalid_createoptions.json +102 -0
- s/tests/assets/deployment.manifest_invalid_schema.json +69 -0
- s/tests/assets/deployment.template.non_str_placeholder.json +79 -0
- s/tests/assets/deployment.template_1.json +163 -0
- s/tests/assets/deployment.template_2.json +163 -0
- s/tests/assets/deployment.template_3.json +174 -0
- s/tests/assets/deployment.template_4.json +79 -0
- s/tests/assets/deployment.template_invalidresult.json +183 -0
- s/tests/assets/deployment.template_without_schema_template.json +99 -0
- s/tests/assets/launch.json +225 -0
- s/tests/assets/launch_without_nodejs.json +194 -0
- s/tests/assets/test_solution_shared_lib/.gitignore +2 -0
- s/tests/assets/test_solution_shared_lib/.vscode/launch.json +43 -0
- s/tests/assets/test_solution_shared_lib/deployment.debug.template.json +100 -0
- s/tests/assets/test_solution_shared_lib/deployment.escapedpath.template.json +90 -0
- s/tests/assets/test_solution_shared_lib/deployment.template.json +106 -0
- s/tests/assets/test_solution_shared_lib/layered_deployment.flattened_props.template.json +21 -0
- s/tests/assets/test_solution_shared_lib/layered_deployment.no_modules.template.json +12 -0
- s/tests/assets/test_solution_shared_lib/libs/sharedlib/Class1.cs +12 -0
- s/tests/assets/test_solution_shared_lib/libs/sharedlib/sharedlib.csproj +7 -0
- s/tests/assets/test_solution_shared_lib/modules/non_module_project/placeholder.txt +0 -0
- s/tests/assets/test_solution_shared_lib/modules/sample_module/.gitignore +34 -0
- s/tests/assets/test_solution_shared_lib/modules/sample_module/Dockerfile.amd64 +18 -0
- s/tests/assets/test_solution_shared_lib/modules/sample_module/Dockerfile.amd64.debug +25 -0
- s/tests/assets/test_solution_shared_lib/modules/sample_module/Dockerfile.windows-amd64 +15 -0
- s/tests/assets/test_solution_shared_lib/modules/sample_module/Program.cs +91 -0
- s/tests/assets/test_solution_shared_lib/modules/sample_module/module.json +18 -0
- s/tests/assets/test_solution_shared_lib/modules/sample_module/sample_module.csproj +26 -0
- s/tests/assets/test_solution_shared_lib/sample_module_2/.gitignore +34 -0
- s/tests/assets/test_solution_shared_lib/sample_module_2/Dockerfile.amd64 +18 -0
- s/tests/assets/test_solution_shared_lib/sample_module_2/Dockerfile.amd64.debug +25 -0
- s/tests/assets/test_solution_shared_lib/sample_module_2/Dockerfile.windows-amd64 +15 -0
- s/tests/assets/test_solution_shared_lib/sample_module_2/Program.cs +91 -0
- s/tests/assets/test_solution_shared_lib/sample_module_2/module.json +18 -0
- s/tests/assets/test_solution_shared_lib/sample_module_2/sample_module_2.csproj +26 -0
- s/tests/test_azurecli.py +33 -0
- s/tests/test_buildoptionsparser.py +155 -0
- s/tests/test_cli.py +55 -0
- s/tests/test_config.py +28 -0
- s/tests/test_connectionstring.py +87 -0
- s/tests/test_decorators.py +44 -0
- s/tests/test_deploymentmanifest.py +106 -0
- s/tests/test_envvars.py +169 -0
- s/tests/test_iotedgedev_iothub_deploy.py +199 -0
- s/tests/test_iotedgedev_simulator.py +133 -0
- s/tests/test_iotedgedev_solution.py +457 -0
- s/tests/test_iotedgedev_solution_build.py +246 -0
- s/tests/test_iotedgedev_solution_tag.py +99 -0
- s/tests/test_utility.py +132 -0
- s/tests/utility.py +132 -0
- s/tox.ini +29 -0
- s/vsts_ci/.vsts-ci.yml +93 -0
- s/vsts_ci/darwin/continuous-build-darwin.yml +54 -0
- s/vsts_ci/linux/continuous-build-linux.yml +28 -0
- s/vsts_ci/win32/continuous-build-win32.yml +26 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema-version": "0.0.1",
|
|
3
|
+
"description": "",
|
|
4
|
+
"image": {
|
|
5
|
+
"repository": "${CONTAINER_REGISTRY_SERVER}/sample_module_2",
|
|
6
|
+
"tag": {
|
|
7
|
+
"version": "0.0.1-RC",
|
|
8
|
+
"platforms": {
|
|
9
|
+
"amd64": "./Dockerfile.amd64",
|
|
10
|
+
"amd64.debug": "./Dockerfile.amd64.debug",
|
|
11
|
+
"windows-amd64": "./Dockerfile.windows-amd64"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"buildOptions": [],
|
|
15
|
+
"contextPath": "../"
|
|
16
|
+
},
|
|
17
|
+
"language": "csharp"
|
|
18
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
|
2
|
+
<PropertyGroup>
|
|
3
|
+
<OutputType>Exe</OutputType>
|
|
4
|
+
<TargetFramework>netcoreapp2.1</TargetFramework>
|
|
5
|
+
</PropertyGroup>
|
|
6
|
+
|
|
7
|
+
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netcoreapp2.1|AnyCPU'">
|
|
8
|
+
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
|
|
9
|
+
<TreatSpecificWarningsAsErrors />
|
|
10
|
+
</PropertyGroup>
|
|
11
|
+
|
|
12
|
+
<ItemGroup>
|
|
13
|
+
<PackageReference Include="Microsoft.Azure.Devices.Client" Version="1.40.0" />
|
|
14
|
+
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.0.0" />
|
|
15
|
+
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="2.0.0" />
|
|
16
|
+
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="2.0.0" />
|
|
17
|
+
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.0.0" />
|
|
18
|
+
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="2.0.0" />
|
|
19
|
+
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.0.0" />
|
|
20
|
+
<PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
|
|
21
|
+
</ItemGroup>
|
|
22
|
+
|
|
23
|
+
<ItemGroup>
|
|
24
|
+
<ProjectReference Include="..\libs\sharedlib\sharedlib.csproj" />
|
|
25
|
+
</ItemGroup>
|
|
26
|
+
</Project>
|
s/tests/test_azurecli.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from iotedgedev.azurecli import get_query_argument_for_id_and_name
|
|
4
|
+
|
|
5
|
+
pytestmark = pytest.mark.unit
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def get_terms(query):
|
|
9
|
+
# These tests are all asserting that the query contains two terms enclosed in
|
|
10
|
+
# [?], separated by ||
|
|
11
|
+
# They don't care about the order. Tests will fail if the square brackets and ||
|
|
12
|
+
# contract is violated, but we'd want them to fail in that case.
|
|
13
|
+
return query[2:len(query)-1].split(" || ")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def test_lowercase_token_should_be_lowercase_for_name_and_id():
|
|
17
|
+
token = "abc123"
|
|
18
|
+
query = get_query_argument_for_id_and_name(token)
|
|
19
|
+
terms = get_terms(query)
|
|
20
|
+
|
|
21
|
+
assert len(terms) == 2
|
|
22
|
+
assert "starts_with(@.id,'abc123')" in terms
|
|
23
|
+
assert "contains(@.name,'abc123')" in terms
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def test_mixedcase_token_should_be_lowercase_for_id_but_unmodified_for_name():
|
|
27
|
+
token = "AbC123"
|
|
28
|
+
query = get_query_argument_for_id_and_name(token)
|
|
29
|
+
terms = get_terms(query)
|
|
30
|
+
|
|
31
|
+
assert len(terms) == 2
|
|
32
|
+
assert "starts_with(@.id,'abc123')" in terms
|
|
33
|
+
assert "contains(@.name,'AbC123')" in terms
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from iotedgedev.buildoptionsparser import BuildOptionsParser
|
|
3
|
+
|
|
4
|
+
pytestmark = pytest.mark.unit
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def test_filter_build_options():
|
|
8
|
+
build_options = [
|
|
9
|
+
"--rm",
|
|
10
|
+
"-f test",
|
|
11
|
+
"--file test",
|
|
12
|
+
"-t image",
|
|
13
|
+
"--tag image"
|
|
14
|
+
]
|
|
15
|
+
build_options_parser = BuildOptionsParser(build_options)
|
|
16
|
+
assert not build_options_parser.parse_build_options()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def test_parse_to_dict():
|
|
20
|
+
build_options = [
|
|
21
|
+
"--add-host=github.com:192.30.255.112",
|
|
22
|
+
"--add-host=ports.ubuntu.com:91.189.88.150",
|
|
23
|
+
"--build-arg a=b",
|
|
24
|
+
"--build-arg c=d",
|
|
25
|
+
"--label e=f",
|
|
26
|
+
"--label g"
|
|
27
|
+
]
|
|
28
|
+
sdk_options = {
|
|
29
|
+
'extra_hosts': {
|
|
30
|
+
'github.com': '192.30.255.112',
|
|
31
|
+
'ports.ubuntu.com': '91.189.88.150'
|
|
32
|
+
},
|
|
33
|
+
'buildargs': {
|
|
34
|
+
'a': 'b',
|
|
35
|
+
'c': 'd'
|
|
36
|
+
},
|
|
37
|
+
'labels': {
|
|
38
|
+
'e': 'f',
|
|
39
|
+
'g': ''
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
build_options_parser = BuildOptionsParser(build_options)
|
|
43
|
+
assert sdk_options == build_options_parser.parse_build_options()
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def test_parse_to_list():
|
|
47
|
+
build_options = [
|
|
48
|
+
"--cache-from a",
|
|
49
|
+
"--cache-from b"
|
|
50
|
+
]
|
|
51
|
+
sdk_options = {
|
|
52
|
+
'cache_from': ['a', 'b']
|
|
53
|
+
}
|
|
54
|
+
build_options_parser = BuildOptionsParser(build_options)
|
|
55
|
+
assert sdk_options == build_options_parser.parse_build_options()
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def test_parse_val():
|
|
59
|
+
build_options = [
|
|
60
|
+
"--network bridge",
|
|
61
|
+
"--platform Linux",
|
|
62
|
+
"--shm-size 1000000",
|
|
63
|
+
"--target target"
|
|
64
|
+
]
|
|
65
|
+
sdk_options = {
|
|
66
|
+
'network_mode': 'bridge',
|
|
67
|
+
'platform': 'Linux',
|
|
68
|
+
'shmsize': '1000000',
|
|
69
|
+
'target': 'target'
|
|
70
|
+
}
|
|
71
|
+
build_options_parser = BuildOptionsParser(build_options)
|
|
72
|
+
assert sdk_options == build_options_parser.parse_build_options()
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def test_parse_container_limits():
|
|
76
|
+
build_options = [
|
|
77
|
+
"--cpu-shares 50",
|
|
78
|
+
"--cpuset-cpus 0-1",
|
|
79
|
+
"--memory 10000000",
|
|
80
|
+
"--memory-swap 2000000"
|
|
81
|
+
]
|
|
82
|
+
sdk_options = {
|
|
83
|
+
'container_limits': {
|
|
84
|
+
'cpushares': '50',
|
|
85
|
+
'cpusetcpus': '0-1',
|
|
86
|
+
'memory': '10000000',
|
|
87
|
+
'memswap': '2000000'
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
build_options_parser = BuildOptionsParser(build_options)
|
|
91
|
+
assert sdk_options == build_options_parser.parse_build_options()
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def test_parse_flag():
|
|
95
|
+
build_options = [
|
|
96
|
+
"--pull=true",
|
|
97
|
+
"-q=false",
|
|
98
|
+
"--no-cache"
|
|
99
|
+
]
|
|
100
|
+
sdk_options = {
|
|
101
|
+
'pull': True,
|
|
102
|
+
'quiet': False,
|
|
103
|
+
'nocache': True
|
|
104
|
+
}
|
|
105
|
+
build_options_parser = BuildOptionsParser(build_options)
|
|
106
|
+
assert sdk_options == build_options_parser.parse_build_options()
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def test_invalid_build_options():
|
|
110
|
+
with pytest.raises(KeyError):
|
|
111
|
+
build_options = [
|
|
112
|
+
"--cgroup-parent",
|
|
113
|
+
"--compress",
|
|
114
|
+
"--cpu-period",
|
|
115
|
+
"--cpuset-mems 10",
|
|
116
|
+
]
|
|
117
|
+
build_options_parser = BuildOptionsParser(build_options)
|
|
118
|
+
build_options_parser.parse_build_options()
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def test_filtered_valid_build_options():
|
|
122
|
+
build_options = [
|
|
123
|
+
"--rm",
|
|
124
|
+
"--file test",
|
|
125
|
+
"--tag image",
|
|
126
|
+
"--add-host=github.com:192.30.255.112",
|
|
127
|
+
"--add-host=ports.ubuntu.com:91.189.88.150",
|
|
128
|
+
"--cache-from a",
|
|
129
|
+
"--cache-from b",
|
|
130
|
+
"--network bridge",
|
|
131
|
+
"--platform Linux",
|
|
132
|
+
"--cpu-shares 50",
|
|
133
|
+
"--memory 10000000",
|
|
134
|
+
"--pull=true",
|
|
135
|
+
"-q=false",
|
|
136
|
+
"--no-cache"
|
|
137
|
+
]
|
|
138
|
+
sdk_options = {
|
|
139
|
+
'extra_hosts': {
|
|
140
|
+
'github.com': '192.30.255.112',
|
|
141
|
+
'ports.ubuntu.com': '91.189.88.150'
|
|
142
|
+
},
|
|
143
|
+
'cache_from': ['a', 'b'],
|
|
144
|
+
'network_mode': 'bridge',
|
|
145
|
+
'platform': 'Linux',
|
|
146
|
+
'container_limits': {
|
|
147
|
+
'cpushares': '50',
|
|
148
|
+
'memory': '10000000',
|
|
149
|
+
},
|
|
150
|
+
'pull': True,
|
|
151
|
+
'quiet': False,
|
|
152
|
+
'nocache': True
|
|
153
|
+
}
|
|
154
|
+
build_options_parser = BuildOptionsParser(build_options)
|
|
155
|
+
assert sdk_options == build_options_parser.parse_build_options()
|
s/tests/test_cli.py
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
from iotedgedev.cli import main
|
|
2
|
+
from .utility import get_cli_command_structure
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
pytestmark = pytest.mark.unit
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def test_cli_structure():
|
|
9
|
+
# Arrange
|
|
10
|
+
expected_structure = {
|
|
11
|
+
"solution": {
|
|
12
|
+
"new": None,
|
|
13
|
+
"init": None,
|
|
14
|
+
"e2e": None,
|
|
15
|
+
"add": None,
|
|
16
|
+
"build": None,
|
|
17
|
+
"push": None,
|
|
18
|
+
"deploy": None,
|
|
19
|
+
"tag": None,
|
|
20
|
+
"genconfig": None
|
|
21
|
+
},
|
|
22
|
+
"simulator": {
|
|
23
|
+
"setup": None,
|
|
24
|
+
"start": None,
|
|
25
|
+
"stop": None,
|
|
26
|
+
"modulecred": None
|
|
27
|
+
},
|
|
28
|
+
"iothub": {
|
|
29
|
+
"deploy": None,
|
|
30
|
+
"monitor": None,
|
|
31
|
+
"setup": None
|
|
32
|
+
},
|
|
33
|
+
"docker": {
|
|
34
|
+
"setup": None,
|
|
35
|
+
"clean": None,
|
|
36
|
+
"log": None
|
|
37
|
+
},
|
|
38
|
+
"new": None,
|
|
39
|
+
"init": None,
|
|
40
|
+
"add": None,
|
|
41
|
+
"build": None,
|
|
42
|
+
"push": None,
|
|
43
|
+
"deploy": None,
|
|
44
|
+
"genconfig": None,
|
|
45
|
+
"setup": None,
|
|
46
|
+
"start": None,
|
|
47
|
+
"stop": None,
|
|
48
|
+
"monitor": None,
|
|
49
|
+
"log": None
|
|
50
|
+
}
|
|
51
|
+
# Act
|
|
52
|
+
structure = get_cli_command_structure(main)
|
|
53
|
+
|
|
54
|
+
# Assert
|
|
55
|
+
assert structure == expected_structure
|
s/tests/test_config.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
from iotedgedev.telemetryconfig import TelemetryConfig
|
|
6
|
+
|
|
7
|
+
pytestmark = pytest.mark.unit
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def test_firsttime(request):
|
|
11
|
+
config = TelemetryConfig()
|
|
12
|
+
|
|
13
|
+
def clean():
|
|
14
|
+
config_path = config.get_config_path()
|
|
15
|
+
if os.path.exists(config_path):
|
|
16
|
+
os.remove(config_path)
|
|
17
|
+
request.addfinalizer(clean)
|
|
18
|
+
|
|
19
|
+
clean()
|
|
20
|
+
config = TelemetryConfig()
|
|
21
|
+
|
|
22
|
+
assert config.get(config.DEFAULT_DIRECT, config.FIRSTTIME_SECTION) == 'yes'
|
|
23
|
+
assert config.get(config.DEFAULT_DIRECT, config.TELEMETRY_SECTION) is None
|
|
24
|
+
|
|
25
|
+
config.check_firsttime()
|
|
26
|
+
|
|
27
|
+
assert config.get(config.DEFAULT_DIRECT, config.FIRSTTIME_SECTION) == 'no'
|
|
28
|
+
assert config.get(config.DEFAULT_DIRECT, config.TELEMETRY_SECTION) == 'yes'
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from iotedgedev.connectionstring import (ConnectionString,
|
|
4
|
+
DeviceConnectionString,
|
|
5
|
+
IoTHubConnectionString)
|
|
6
|
+
|
|
7
|
+
pytestmark = pytest.mark.unit
|
|
8
|
+
|
|
9
|
+
emptystring = ""
|
|
10
|
+
valid_connectionstring = "HostName=testhub.azure-devices.net;SharedAccessKey=gibberish"
|
|
11
|
+
valid_iothub_connectionstring = "HostName=ChaoyiTestIoT.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=moregibberish"
|
|
12
|
+
valid_device_connectionstring = "HostName=testhub.azure-devices.net;DeviceId=testdevice;SharedAccessKey=othergibberish"
|
|
13
|
+
invalid_connectionstring = "HostName=azure-devices.net;SharedAccessKey=gibberish"
|
|
14
|
+
invalid_iothub_connectionstring = "HostName=testhub.azure-devices.net;SharedAccessKey=moregibberish"
|
|
15
|
+
invalid_device_connectionstring = "HostName=testhub.azure-devices.net;DeviceId=;SharedAccessKey=othergibberish"
|
|
16
|
+
empty_hostname_iothub_connectionstring = "HostName=;SharedAccessKeyName=iothubowner;SharedAccessKey=moregibberish"
|
|
17
|
+
non_sas_connectionstring = "HostName=testhub.azure-devices.net;DeviceId=testdevice;x509=true"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def test_non_sas_connectionstring():
|
|
21
|
+
connStr = ConnectionString(non_sas_connectionstring)
|
|
22
|
+
assert not connStr.connection_string
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def test_empty_connectionstring():
|
|
26
|
+
connectionstring = ConnectionString(emptystring)
|
|
27
|
+
assert not connectionstring.data
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def test_empty_hostname_iothub_connectionstring():
|
|
31
|
+
connectionstring = ConnectionString(empty_hostname_iothub_connectionstring)
|
|
32
|
+
assert connectionstring.iothub_host.name == ""
|
|
33
|
+
assert connectionstring.iothub_host.hub_name == ""
|
|
34
|
+
assert connectionstring.shared_access_key == "moregibberish"
|
|
35
|
+
assert connectionstring.iothub_host.name_hash == ""
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def test_empty_iothub_connectionstring():
|
|
39
|
+
connectionstring = IoTHubConnectionString(emptystring)
|
|
40
|
+
assert not connectionstring.data
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def test_empty_device_connectionstring():
|
|
44
|
+
connectionstring = DeviceConnectionString(emptystring)
|
|
45
|
+
assert not connectionstring.data
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def test_valid_connectionstring():
|
|
49
|
+
connectionstring = ConnectionString(valid_connectionstring)
|
|
50
|
+
assert connectionstring.iothub_host.name == "testhub.azure-devices.net"
|
|
51
|
+
assert connectionstring.iothub_host.hub_name == "testhub"
|
|
52
|
+
assert connectionstring.shared_access_key == "gibberish"
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def test_valid_iothub_connectionstring():
|
|
56
|
+
connectionstring = IoTHubConnectionString(valid_iothub_connectionstring)
|
|
57
|
+
assert connectionstring.iothub_host.name == "ChaoyiTestIoT.azure-devices.net"
|
|
58
|
+
assert connectionstring.iothub_host.hub_name == "ChaoyiTestIoT"
|
|
59
|
+
assert connectionstring.shared_access_key_name == "iothubowner"
|
|
60
|
+
assert connectionstring.shared_access_key == "moregibberish"
|
|
61
|
+
assert connectionstring.iothub_host.name_hash == "6b8fcfea09003d5f104771e83bd9ff54c592ec2277ec1815df91dd64d1633778"
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def test_valid_devicehub_connectionstring():
|
|
65
|
+
connectionstring = DeviceConnectionString(valid_device_connectionstring)
|
|
66
|
+
assert connectionstring.iothub_host.name == "testhub.azure-devices.net"
|
|
67
|
+
assert connectionstring.iothub_host.hub_name == "testhub"
|
|
68
|
+
assert connectionstring.device_id == "testdevice"
|
|
69
|
+
assert connectionstring.shared_access_key == "othergibberish"
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def test_invalid_connectionstring():
|
|
73
|
+
connectionstring = ConnectionString(invalid_connectionstring)
|
|
74
|
+
assert connectionstring.iothub_host.hub_name != "testhub"
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def test_invalid_iothub_connectionstring():
|
|
78
|
+
with pytest.raises(KeyError):
|
|
79
|
+
IoTHubConnectionString(invalid_iothub_connectionstring)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def test_invalid_devicehub_connectionstring():
|
|
83
|
+
connectionstring = DeviceConnectionString(invalid_device_connectionstring)
|
|
84
|
+
assert connectionstring.iothub_host.name == "testhub.azure-devices.net"
|
|
85
|
+
assert connectionstring.iothub_host.hub_name == "testhub"
|
|
86
|
+
assert not connectionstring.device_id
|
|
87
|
+
assert connectionstring.shared_access_key == "othergibberish"
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import hashlib
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
from iotedgedev.decorators import hash256_result, suppress_all_exceptions
|
|
6
|
+
|
|
7
|
+
pytestmark = pytest.mark.unit
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def test_suppress_all_exceptions():
|
|
11
|
+
@suppress_all_exceptions()
|
|
12
|
+
def test_valid():
|
|
13
|
+
return 'Everything is OK'
|
|
14
|
+
assert test_valid() == 'Everything is OK'
|
|
15
|
+
|
|
16
|
+
@suppress_all_exceptions('fallback')
|
|
17
|
+
def test_exception_fallback():
|
|
18
|
+
raise Exception
|
|
19
|
+
assert test_exception_fallback() == 'fallback'
|
|
20
|
+
|
|
21
|
+
@suppress_all_exceptions()
|
|
22
|
+
def test_exception_nofallback():
|
|
23
|
+
raise Exception
|
|
24
|
+
assert not test_exception_nofallback()
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def test_hash256_result():
|
|
28
|
+
@hash256_result
|
|
29
|
+
def test_valid():
|
|
30
|
+
return "test"
|
|
31
|
+
expect_hash = hashlib.sha256("test".encode('utf-8'))
|
|
32
|
+
assert str(expect_hash.hexdigest()) == test_valid()
|
|
33
|
+
|
|
34
|
+
@hash256_result
|
|
35
|
+
def test_none():
|
|
36
|
+
return None
|
|
37
|
+
with pytest.raises(ValueError):
|
|
38
|
+
test_none()
|
|
39
|
+
|
|
40
|
+
@hash256_result
|
|
41
|
+
def test_nostring():
|
|
42
|
+
return 0
|
|
43
|
+
with pytest.raises(ValueError):
|
|
44
|
+
test_nostring()
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
import pytest
|
|
5
|
+
|
|
6
|
+
from iotedgedev.deploymentmanifest import DeploymentManifest
|
|
7
|
+
from iotedgedev.envvars import EnvVars
|
|
8
|
+
from iotedgedev.output import Output
|
|
9
|
+
from iotedgedev.utility import Utility
|
|
10
|
+
|
|
11
|
+
from .utility import assert_list_equal
|
|
12
|
+
|
|
13
|
+
pytestmark = pytest.mark.unit
|
|
14
|
+
|
|
15
|
+
tests_dir = os.path.join(os.getcwd(), "tests")
|
|
16
|
+
test_assets_dir = os.path.join(tests_dir, "assets")
|
|
17
|
+
test_file_1 = os.path.join(test_assets_dir, "deployment.template_1.json")
|
|
18
|
+
test_file_2 = os.path.join(test_assets_dir, "deployment.template_2.json")
|
|
19
|
+
test_file_3 = os.path.join(test_assets_dir, "deployment.template_3.json")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@pytest.fixture
|
|
23
|
+
def deployment_manifest():
|
|
24
|
+
output = Output()
|
|
25
|
+
envvars = EnvVars(output)
|
|
26
|
+
envvars.load()
|
|
27
|
+
utility = Utility(envvars, output)
|
|
28
|
+
|
|
29
|
+
def _deployment_manifest(path):
|
|
30
|
+
return DeploymentManifest(envvars, output, utility, path, True)
|
|
31
|
+
|
|
32
|
+
return _deployment_manifest
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def test_get_desired_property(deployment_manifest):
|
|
36
|
+
deployment_manifest = deployment_manifest(test_file_1)
|
|
37
|
+
props = deployment_manifest.get_desired_property("$edgeHub", "schemaVersion")
|
|
38
|
+
assert props == deployment_manifest.envvars.EDGEHUB_SCHEMA_VERSION
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def test_get_desired_property_nonexistent_module(deployment_manifest):
|
|
42
|
+
deployment_manifest = deployment_manifest(test_file_1)
|
|
43
|
+
with pytest.raises(KeyError):
|
|
44
|
+
deployment_manifest.get_desired_property("nonexistentModule", "schemaVersion")
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def test_get_desired_property_nonexistent_prop(deployment_manifest):
|
|
48
|
+
deployment_manifest = deployment_manifest(test_file_1)
|
|
49
|
+
with pytest.raises(KeyError):
|
|
50
|
+
deployment_manifest.get_desired_property("$edgeHub", "nonexistentProp")
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def test_get_user_modules(deployment_manifest):
|
|
54
|
+
deployment_manifest = deployment_manifest(test_file_1)
|
|
55
|
+
user_modules = list(deployment_manifest.get_user_modules().keys())
|
|
56
|
+
assert_list_equal(user_modules, ["tempSensor", "csharpmodule", "csharpfunction"])
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def test_get_system_modules(deployment_manifest):
|
|
60
|
+
deployment_manifest = deployment_manifest(test_file_1)
|
|
61
|
+
system_modules = list(deployment_manifest.get_system_modules().keys())
|
|
62
|
+
assert_list_equal(system_modules, ["edgeAgent", "edgeHub"])
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def test_get_all_modules(deployment_manifest):
|
|
66
|
+
deployment_manifest = deployment_manifest(test_file_1)
|
|
67
|
+
system_modules = list(deployment_manifest.get_all_modules().keys())
|
|
68
|
+
assert_list_equal(system_modules, ["edgeAgent", "edgeHub", "tempSensor", "csharpmodule", "csharpfunction"])
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def test_add_module_template(deployment_manifest):
|
|
72
|
+
deployment_manifest = deployment_manifest(test_file_1)
|
|
73
|
+
deployment_manifest.add_module_template("csharpmodule2")
|
|
74
|
+
expected = json.loads(Utility.get_file_contents(test_file_3, expandvars=True))
|
|
75
|
+
assert deployment_manifest.json == expected
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def test_convert_create_options(deployment_manifest):
|
|
79
|
+
deployment_manifest = deployment_manifest(test_file_1)
|
|
80
|
+
|
|
81
|
+
temp_sensor_settings = deployment_manifest.json["modulesContent"]["$edgeAgent"]["properties.desired"]["modules"]["tempSensor"]["settings"]
|
|
82
|
+
temp_sensor_create_options_copy = json.loads(json.dumps(temp_sensor_settings["createOptions"]))
|
|
83
|
+
|
|
84
|
+
deployment_manifest.convert_create_options()
|
|
85
|
+
assert deployment_manifest.json["modulesContent"]["$edgeAgent"]["properties.desired"]["systemModules"]["edgeAgent"]["settings"][
|
|
86
|
+
"createOptions"] == ""
|
|
87
|
+
assert json.loads(deployment_manifest.json["modulesContent"]["$edgeAgent"]["properties.desired"]["systemModules"]["edgeHub"]["settings"][
|
|
88
|
+
"createOptions"]) == json.loads("{\"HostConfig\":{\"PortBindings\":{\"5671/tcp\":[{\"HostPort\":\"5671\"}],\"8883/tcp\":[{\"HostPort\":\"8883\"}],\"443/tcp\":[{\"HostPort\":\"443\"}]}}}")
|
|
89
|
+
|
|
90
|
+
assert "createOptions" in temp_sensor_settings
|
|
91
|
+
assert "createOptions01" in temp_sensor_settings
|
|
92
|
+
assert "createOptions02" in temp_sensor_settings
|
|
93
|
+
|
|
94
|
+
create_options_str = temp_sensor_settings["createOptions"] + temp_sensor_settings["createOptions01"] + temp_sensor_settings["createOptions02"]
|
|
95
|
+
assert json.loads(create_options_str) == temp_sensor_create_options_copy
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def test_expand_image_placeholders(deployment_manifest):
|
|
99
|
+
deployment_manifest = deployment_manifest(test_file_1)
|
|
100
|
+
deployment_manifest.expand_image_placeholders({"csharpmodule": "localhost:5000/csharpmodule:0.0.1-amd64"})
|
|
101
|
+
assert deployment_manifest.json["modulesContent"]["$edgeAgent"]["properties.desired"]["modules"]["csharpmodule"]["settings"]["image"] == "localhost:5000/csharpmodule:0.0.1-amd64"
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def test_get_image_placeholder():
|
|
105
|
+
assert DeploymentManifest.get_image_placeholder("filtermodule") == "${MODULES.filtermodule}"
|
|
106
|
+
assert DeploymentManifest.get_image_placeholder("filtermodule", True) == "${MODULES.filtermodule.debug}"
|