зеркало из https://github.com/Azure/iotedgedev.git
enable e2e test case for iotedgedev
This commit is contained in:
Родитель
b9340d7654
Коммит
a4e067a224
|
@ -14,5 +14,7 @@
|
|||
"python.formatting.autopep8Args": [
|
||||
"--max-line-length",
|
||||
"200"
|
||||
]
|
||||
],
|
||||
"python.unitTest.unittestEnabled": true,
|
||||
"python.unitTest.pyTestEnabled": true
|
||||
}
|
39
.vsts-ci.yml
39
.vsts-ci.yml
|
@ -1,39 +0,0 @@
|
|||
# Python package
|
||||
# Create and test a Python package on multiple Python versions.
|
||||
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
|
||||
# https://docs.microsoft.com/vsts/pipelines/languages/python
|
||||
|
||||
jobs:
|
||||
|
||||
- job: 'Test'
|
||||
pool:
|
||||
vmImage: 'ubuntu-16.04'
|
||||
strategy:
|
||||
maxParallel: 4
|
||||
matrix:
|
||||
Python27:
|
||||
python.version: '2.7'
|
||||
Python35:
|
||||
python.version: '3.5'
|
||||
Python36:
|
||||
python.version: '3.6'
|
||||
Python37:
|
||||
python.version: '3.7'
|
||||
|
||||
steps:
|
||||
- task: UsePythonVersion@0
|
||||
inputs:
|
||||
versionSpec: '$(python.version)'
|
||||
architecture: 'x64'
|
||||
|
||||
- script: python -m pip install --upgrade pip && pip install -r requirements_dev.txt
|
||||
displayName: 'Install dependencies'
|
||||
|
||||
- script: |
|
||||
pytest -m unit --junitxml=junit/test-results.xml
|
||||
displayName: 'pytest'
|
||||
- task: PublishTestResults@2
|
||||
inputs:
|
||||
testResultsFiles: '**/test-results.xml'
|
||||
testRunTitle: 'Python $(python.version)'
|
||||
condition: succeededOrFailed()
|
|
@ -0,0 +1,194 @@
|
|||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"processId": "${command:pickRemoteProcess}",
|
||||
"name": "filtermodule Remote Debug (.NET Core)",
|
||||
"sourceFileMap": {
|
||||
"/app": "${workspaceFolder}/modules/filtermodule"
|
||||
},
|
||||
"request": "attach",
|
||||
"pipeTransport": {
|
||||
"quoteArgs": true,
|
||||
"pipeArgs": [
|
||||
"exec",
|
||||
"-i",
|
||||
"filtermodule",
|
||||
"sh",
|
||||
"-c"
|
||||
],
|
||||
"debuggerPath": "~/vsdbg/vsdbg",
|
||||
"pipeCwd": "${workspaceFolder}",
|
||||
"pipeProgram": "docker"
|
||||
},
|
||||
"type": "coreclr",
|
||||
"justMyCode": true
|
||||
},
|
||||
{
|
||||
"console": "internalConsole",
|
||||
"name": "filtermodule Local Debug (.NET Core)",
|
||||
"args": [],
|
||||
"request": "launch",
|
||||
"internalConsoleOptions": "openOnSessionStart",
|
||||
"stopAtEntry": false,
|
||||
"program": "${workspaceRoot}/modules/filtermodule/bin/Debug/netcoreapp2.1/filtermodule.dll",
|
||||
"env": {
|
||||
"EdgeHubConnectionString": "${config:azure-iot-edge.EdgeHubConnectionString}",
|
||||
"EdgeModuleCACertificateFile": "${config:azure-iot-edge.EdgeModuleCACertificateFile}"
|
||||
},
|
||||
"type": "coreclr",
|
||||
"cwd": "${workspaceRoot}/modules/filtermodule"
|
||||
},
|
||||
{
|
||||
"processId": "${command:pickRemoteProcess}",
|
||||
"name": "cmodule Remote Debug (C)",
|
||||
"osx": {
|
||||
"MIMode": "lldb"
|
||||
},
|
||||
"windows": {
|
||||
"setupCommands": [
|
||||
{
|
||||
"text": "-enable-pretty-printing",
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
],
|
||||
"MIMode": "gdb"
|
||||
},
|
||||
"sourceFileMap": {
|
||||
"/app": "${workspaceFolder}/modules/cmodule"
|
||||
},
|
||||
"request": "attach",
|
||||
"pipeTransport": {
|
||||
"pipeArgs": [
|
||||
"exec",
|
||||
"-i",
|
||||
"cmodule",
|
||||
"sh",
|
||||
"-c"
|
||||
],
|
||||
"debuggerPath": "/usr/bin/gdb",
|
||||
"pipeCwd": "${workspaceFolder}",
|
||||
"pipeProgram": "docker"
|
||||
},
|
||||
"program": "./main",
|
||||
"linux": {
|
||||
"setupCommands": [
|
||||
{
|
||||
"text": "-enable-pretty-printing",
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
],
|
||||
"MIMode": "gdb"
|
||||
},
|
||||
"type": "cppdbg"
|
||||
},
|
||||
{
|
||||
"processId": "${command:pickRemoteProcess}",
|
||||
"name": "csharpmodule Remote Debug (.NET Core)",
|
||||
"sourceFileMap": {
|
||||
"/app": "${workspaceFolder}/modules/csharpmodule"
|
||||
},
|
||||
"request": "attach",
|
||||
"pipeTransport": {
|
||||
"quoteArgs": true,
|
||||
"pipeArgs": [
|
||||
"exec",
|
||||
"-i",
|
||||
"csharpmodule",
|
||||
"sh",
|
||||
"-c"
|
||||
],
|
||||
"debuggerPath": "~/vsdbg/vsdbg",
|
||||
"pipeCwd": "${workspaceFolder}",
|
||||
"pipeProgram": "docker"
|
||||
},
|
||||
"type": "coreclr",
|
||||
"justMyCode": true
|
||||
},
|
||||
{
|
||||
"console": "internalConsole",
|
||||
"name": "csharpmodule Local Debug (.NET Core)",
|
||||
"args": [],
|
||||
"request": "launch",
|
||||
"internalConsoleOptions": "openOnSessionStart",
|
||||
"stopAtEntry": false,
|
||||
"program": "${workspaceRoot}/modules/csharpmodule/bin/Debug/netcoreapp2.1/csharpmodule.dll",
|
||||
"env": {
|
||||
"EdgeHubConnectionString": "${config:azure-iot-edge.EdgeHubConnectionString}",
|
||||
"EdgeModuleCACertificateFile": "${config:azure-iot-edge.EdgeModuleCACertificateFile}"
|
||||
},
|
||||
"type": "coreclr",
|
||||
"cwd": "${workspaceRoot}/modules/csharpmodule"
|
||||
},
|
||||
{
|
||||
"console": "internalConsole",
|
||||
"name": "javamodule Local Debug (java)",
|
||||
"projectName": "javamodule",
|
||||
"args": "",
|
||||
"request": "launch",
|
||||
"mainClass": "com.edgemodule.App",
|
||||
"env": {
|
||||
"EdgeHubConnectionString": "${config:azure-iot-edge.EdgeHubConnectionString}",
|
||||
"EdgeModuleCACertificateFile": "${config:azure-iot-edge.EdgeModuleCACertificateFile}"
|
||||
},
|
||||
"type": "java",
|
||||
"cwd": "${workspaceRoot}/modules/javamodule",
|
||||
"stopOnEntry": false
|
||||
},
|
||||
{
|
||||
"request": "attach",
|
||||
"hostName": "localhost",
|
||||
"type": "java",
|
||||
"name": "javamodule Remote Debug (java)",
|
||||
"port": 5005
|
||||
},
|
||||
{
|
||||
"pathMappings": [
|
||||
{
|
||||
"localRoot": "${workspaceFolder}/modules/pythonmodule",
|
||||
"remoteRoot": "/app"
|
||||
}
|
||||
],
|
||||
"name": "pythonmodule Remote Debug (Python)",
|
||||
"windows": {
|
||||
"pathMappings": [
|
||||
{
|
||||
"localRoot": "${workspaceFolder}\\modules\\pythonmodule",
|
||||
"remoteRoot": "/app"
|
||||
}
|
||||
]
|
||||
},
|
||||
"logToFile": true,
|
||||
"request": "attach",
|
||||
"host": "localhost",
|
||||
"redirectOutput": true,
|
||||
"type": "python",
|
||||
"port": 5678
|
||||
},
|
||||
{
|
||||
"processId": "${command:pickRemoteProcess}",
|
||||
"name": "csharpfunctionmodule Remote Debug (.NET Core)",
|
||||
"type": "coreclr",
|
||||
"request": "attach",
|
||||
"pipeTransport": {
|
||||
"pipeArgs": [
|
||||
"exec",
|
||||
"-i",
|
||||
"csharpfunctionmodule",
|
||||
"sh",
|
||||
"-c"
|
||||
],
|
||||
"quoteArgs": true,
|
||||
"pipeProgram": "docker",
|
||||
"debuggerPath": "~/vsdbg/vsdbg",
|
||||
"pipeCwd": "${workspaceFolder}"
|
||||
},
|
||||
"sourceFileMap": {
|
||||
"/app": "${workspaceFolder}/modules/csharpfunctionmodule"
|
||||
},
|
||||
"justMyCode": true
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"$schema-template": "1.0.0",
|
||||
"modulesContent": {
|
||||
"$edgeAgent": {
|
||||
"properties.desired": {
|
||||
|
@ -66,7 +67,7 @@
|
|||
"status": "running",
|
||||
"restartPolicy": "always",
|
||||
"settings": {
|
||||
"image": "${MODULES.sample_module.amd64}",
|
||||
"image": "${MODULES.sample_module}",
|
||||
"createOptions": {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
FROM microsoft/dotnet:2.1-sdk AS build-env
|
||||
|
||||
COPY ./libs /app/libs
|
||||
COPY ./modules/sample_module/*.csproj /app/modules/sample_module/
|
||||
COPY ./modules/sample_module /app/modules/sample_module
|
||||
|
||||
WORKDIR /app/modules/sample_module
|
||||
RUN dotnet restore
|
||||
RUN dotnet publish -c Release -o /app/out
|
||||
|
||||
FROM microsoft/dotnet:2.1-runtime-nanoserver-1803
|
||||
WORKDIR /app
|
||||
COPY --from=build-env /app/out ./
|
||||
|
||||
ENTRYPOINT ["dotnet", "sample_module.dll"]
|
|
@ -6,7 +6,8 @@
|
|||
"tag": {
|
||||
"version": "0.0.1",
|
||||
"platforms": {
|
||||
"amd64": "./Dockerfile.amd64"
|
||||
"amd64": "./Dockerfile.amd64",
|
||||
"windows-amd64": "./Dockerfile.windows-amd64"
|
||||
}
|
||||
},
|
||||
"buildOptions": [],
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import json
|
||||
import os
|
||||
import shutil
|
||||
import platform
|
||||
|
||||
import pytest
|
||||
from click.testing import CliRunner
|
||||
|
@ -12,24 +13,27 @@ from iotedgedev.envvars import EnvVars
|
|||
from iotedgedev.output import Output
|
||||
|
||||
from .utility import assert_json_file_equal
|
||||
from .utility import get_platform_type
|
||||
|
||||
pytestmark = pytest.mark.e2e
|
||||
|
||||
root_dir = os.getcwd()
|
||||
tests_dir = os.path.join(root_dir, "tests")
|
||||
envvars = EnvVars(Output())
|
||||
output = Output()
|
||||
envvars = EnvVars(output)
|
||||
env_file_name = envvars.get_dotenv_file()
|
||||
env_file_path = envvars.get_dotenv_path(env_file_name)
|
||||
|
||||
test_solution = "test_solution"
|
||||
test_solution_dir = os.path.join(tests_dir, test_solution)
|
||||
launch_json_file = os.path.join(tests_dir, "assets", "launch.json")
|
||||
launch_json_file_without_nodejs = os.path.join(tests_dir, "assets", "launch_without_nodejs.json")
|
||||
|
||||
test_solution_shared_lib = "test_solution_shared_lib"
|
||||
test_solution_shared_lib_dir = os.path.join(tests_dir, "assets", test_solution_shared_lib)
|
||||
|
||||
|
||||
@pytest.fixture(scope="module", autouse=True)
|
||||
@pytest.fixture(scope="function", autouse=True)
|
||||
def create_solution(request):
|
||||
def clean():
|
||||
os.chdir(root_dir)
|
||||
|
@ -125,11 +129,20 @@ def test_module_add():
|
|||
add_module_and_verify(cli.main, runner, "c")
|
||||
add_module_and_verify(cli.main, runner, "csharp")
|
||||
add_module_and_verify(cli.main, runner, "java")
|
||||
add_module_and_verify(cli.main, runner, "nodejs")
|
||||
|
||||
# Node.js modules is skipped on non-Windows for known issue.
|
||||
# See more details: https://github.com/Azure/iotedgedev/issues/312
|
||||
# See more details: https://github.com/Azure/iotedgedev/issues/346
|
||||
if (platform.system().lower() == 'windows'):
|
||||
add_module_and_verify(cli.main, runner, "nodejs")
|
||||
launch_file = launch_json_file
|
||||
else:
|
||||
launch_file = launch_json_file_without_nodejs
|
||||
|
||||
add_module_and_verify(cli.main, runner, "python")
|
||||
add_module_and_verify(cli.main, runner, "csharpfunction")
|
||||
|
||||
assert_json_file_equal(os.path.join(os.getcwd(), ".vscode", "launch.json"), launch_json_file)
|
||||
assert_json_file_equal(os.path.join(os.getcwd(), ".vscode", "launch.json"), launch_file)
|
||||
|
||||
|
||||
def test_module_add_invalid_name():
|
||||
|
@ -162,8 +175,9 @@ def test_push_modules(request):
|
|||
|
||||
cli = __import__("iotedgedev.cli", fromlist=['main'])
|
||||
runner = CliRunner()
|
||||
result = runner.invoke(cli.main, ['push'])
|
||||
result = runner.invoke(cli.main, ['push', '-P', get_platform_type()])
|
||||
print(result.output)
|
||||
print(result.exception)
|
||||
|
||||
assert 'BUILD COMPLETE' in result.output
|
||||
assert 'PUSH COMPLETE' in result.output
|
||||
|
@ -177,7 +191,8 @@ def test_deploy_modules(request):
|
|||
|
||||
cli = __import__("iotedgedev.cli", fromlist=['main'])
|
||||
runner = CliRunner()
|
||||
result = runner.invoke(cli.main, ['deploy'])
|
||||
|
||||
result = runner.invoke(cli.main, ['deploy', '-f', os.path.join('config', 'deployment.' + get_platform_type() + '.json')])
|
||||
print(result.output)
|
||||
|
||||
assert 'DEPLOYMENT COMPLETE' in result.output
|
||||
|
@ -195,6 +210,7 @@ def test_monitor(request, capfd):
|
|||
print(out)
|
||||
print(err)
|
||||
print(result.output)
|
||||
print(result.exception)
|
||||
|
||||
if not PY35:
|
||||
assert 'Monitoring events from device' in out
|
||||
|
@ -232,8 +248,9 @@ def test_shared_lib():
|
|||
|
||||
cli = __import__("iotedgedev.cli", fromlist=['main'])
|
||||
runner = CliRunner()
|
||||
result = runner.invoke(cli.main, ['build'])
|
||||
result = runner.invoke(cli.main, ['build', '-P', get_platform_type()])
|
||||
print(result.output)
|
||||
print(result.exception)
|
||||
|
||||
assert 'BUILD COMPLETE' in result.output
|
||||
assert 'ERROR' not in result.output
|
||||
|
@ -243,6 +260,7 @@ def add_module_and_verify(main, runner, template):
|
|||
module_name = template + "module"
|
||||
result = runner.invoke(main, ["solution", "add", module_name, '--template', template])
|
||||
print(result.output)
|
||||
print(result.exception)
|
||||
assert 'ADD COMPLETE' in result.output
|
||||
assert os.path.exists(os.path.join(os.environ["MODULES_PATH"], module_name))
|
||||
assert module_name in json.load(open(os.environ["DEPLOYMENT_CONFIG_TEMPLATE_FILE"]))["modulesContent"]["$edgeAgent"]["properties.desired"]["modules"]
|
||||
|
|
|
@ -8,11 +8,14 @@ from iotedgedev.compat import PY35
|
|||
from iotedgedev.envvars import EnvVars
|
||||
from iotedgedev.output import Output
|
||||
|
||||
from .utility import get_docker_os_type
|
||||
|
||||
pytestmark = pytest.mark.e2e
|
||||
|
||||
root_dir = os.getcwd()
|
||||
tests_dir = os.path.join(root_dir, 'tests')
|
||||
envvars = EnvVars(Output())
|
||||
output = Output()
|
||||
envvars = EnvVars(output)
|
||||
env_file_name = envvars.get_dotenv_file()
|
||||
env_file_path = envvars.get_dotenv_path(env_file_name)
|
||||
|
||||
|
@ -44,6 +47,7 @@ def create_solution(request):
|
|||
return
|
||||
|
||||
|
||||
@pytest.mark.skipif(get_docker_os_type() == 'windows', reason='Simulator does not support windows container')
|
||||
def test_setup():
|
||||
cli = __import__('iotedgedev.cli', fromlist=['main'])
|
||||
runner = CliRunner()
|
||||
|
@ -54,6 +58,7 @@ def test_setup():
|
|||
assert 'Setup IoT Edge Simulator successfully.' in result.output
|
||||
|
||||
|
||||
@pytest.mark.skipif(get_docker_os_type() == 'windows', reason='Simulator does not support windows container')
|
||||
def test_start_single():
|
||||
cli = __import__('iotedgedev.cli', fromlist=['main'])
|
||||
runner = CliRunner()
|
||||
|
@ -64,6 +69,7 @@ def test_start_single():
|
|||
assert 'IoT Edge Simulator has been started in single module mode.' in result.output
|
||||
|
||||
|
||||
@pytest.mark.skipif(get_docker_os_type() == 'windows', reason='Simulator does not support windows container')
|
||||
def test_modulecred():
|
||||
cli = __import__('iotedgedev.cli', fromlist=['main'])
|
||||
runner = CliRunner()
|
||||
|
@ -75,6 +81,7 @@ def test_modulecred():
|
|||
assert 'EdgeModuleCACertificateFile=' in result.output
|
||||
|
||||
|
||||
@pytest.mark.skipif(get_docker_os_type() == 'windows', reason='Simulator does not support windows container')
|
||||
def test_stop(capfd):
|
||||
cli = __import__('iotedgedev.cli', fromlist=['main'])
|
||||
runner = CliRunner()
|
||||
|
@ -88,12 +95,14 @@ def test_stop(capfd):
|
|||
assert 'IoT Edge Simulator has been stopped successfully.' in out
|
||||
|
||||
|
||||
@pytest.mark.skipif(get_docker_os_type() == 'windows', reason='Simulator does not support windows container')
|
||||
def test_start_solution(capfd):
|
||||
cli = __import__('iotedgedev.cli', fromlist=['main'])
|
||||
runner = CliRunner()
|
||||
|
||||
result = runner.invoke(cli.main, ['simulator', 'start', '-s', '-b', '-f', 'deployment.template.json'])
|
||||
print(result.output)
|
||||
print(result.exception)
|
||||
out, err = capfd.readouterr()
|
||||
print(out)
|
||||
print(err)
|
||||
|
@ -102,6 +111,7 @@ def test_start_solution(capfd):
|
|||
assert 'IoT Edge Simulator has been started in solution mode.' in out
|
||||
|
||||
|
||||
@pytest.mark.skipif(get_docker_os_type() == 'windows', reason='Simulator does not support windows container')
|
||||
def test_monitor(capfd):
|
||||
cli = __import__('iotedgedev.cli', fromlist=['main'])
|
||||
runner = CliRunner()
|
||||
|
@ -110,6 +120,7 @@ def test_monitor(capfd):
|
|||
print(out)
|
||||
print(err)
|
||||
print(result.output)
|
||||
print(result.exception)
|
||||
|
||||
# Assert output from simulator
|
||||
sim_match = 'timeCreated'
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
import json
|
||||
|
||||
from iotedgedev.dockercls import Docker
|
||||
from iotedgedev.envvars import EnvVars
|
||||
from iotedgedev.output import Output
|
||||
from iotedgedev.utility import Utility
|
||||
|
||||
output = Output()
|
||||
envvars = EnvVars(output)
|
||||
|
||||
|
||||
def assert_list_equal(list1, list2):
|
||||
assert len(list1) == len(list2) and sorted(list1) == sorted(list2)
|
||||
|
@ -15,3 +23,23 @@ def assert_json_file_equal(file1, file2):
|
|||
with open(file1, "r") as f1:
|
||||
with open(file2, "r") as f2:
|
||||
assert json.load(f1) == json.load(f2)
|
||||
|
||||
|
||||
def get_docker_client():
|
||||
envvars.load()
|
||||
utility = Utility(envvars, output)
|
||||
docker_client = Docker(envvars, utility, output)
|
||||
return docker_client
|
||||
|
||||
|
||||
def get_docker_os_type():
|
||||
os_type = get_docker_client().get_os_type().lower()
|
||||
return os_type
|
||||
|
||||
|
||||
def get_platform_type():
|
||||
if get_docker_os_type() == 'windows':
|
||||
platform_type = 'windows-amd64'
|
||||
else:
|
||||
platform_type = 'amd64'
|
||||
return platform_type
|
||||
|
|
8
tox.ini
8
tox.ini
|
@ -1,5 +1,5 @@
|
|||
[tox]
|
||||
envlist = py27, py36
|
||||
envlist = py27, py36, py37
|
||||
|
||||
#[travis]
|
||||
#python =
|
||||
|
@ -12,7 +12,9 @@ envlist = py27, py36
|
|||
#commands=flake8 iotedgedev
|
||||
|
||||
[testenv]
|
||||
deps = pytest
|
||||
deps =
|
||||
pytest
|
||||
-rrequirements_dev.txt
|
||||
commands = pytest -s -v
|
||||
#setenv =
|
||||
# PYTHONPATH = {toxinidir}
|
||||
|
@ -20,7 +22,7 @@ commands = pytest -s -v
|
|||
#commands =
|
||||
# python setup.py test
|
||||
|
||||
passenv = APPDATA ProgramFiles USERPROFILE PROGRAMDATA DOTENV_FILE LOCALAPPDATA DOTNET_CLI_HOME HOME
|
||||
passenv = *
|
||||
|
||||
; If you want to make tox run the tests with the same versions, create a
|
||||
; requirements.txt with the pinned versions and uncomment the following lines:
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
# Python package
|
||||
# Create and test a Python package on multiple Python versions.
|
||||
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
|
||||
# https://docs.microsoft.com/vsts/pipelines/languages/python
|
||||
|
||||
jobs:
|
||||
- job: Windows
|
||||
pool:
|
||||
vmImage: win1803
|
||||
steps:
|
||||
- template: win32/continuous-build-win32.yml
|
||||
|
||||
- job: MacOS
|
||||
pool:
|
||||
vmImage: macOS-10.13
|
||||
strategy:
|
||||
matrix:
|
||||
Python27:
|
||||
python.version: "2.7"
|
||||
TOXENV: "py27"
|
||||
Python36:
|
||||
python.version: "3.6"
|
||||
TOXENV: "py36"
|
||||
Python37:
|
||||
python.version: "3.7"
|
||||
TOXENV: "py37"
|
||||
maxParallel: 1
|
||||
steps:
|
||||
- template: darwin/continuous-build-darwin.yml
|
||||
|
||||
- job: Linux
|
||||
pool:
|
||||
vmImage: ubuntu-16.04
|
||||
strategy:
|
||||
matrix:
|
||||
Python27:
|
||||
python.version: "2.7"
|
||||
TOXENV: "py27"
|
||||
Python36:
|
||||
python.version: "3.6"
|
||||
TOXENV: "py36"
|
||||
Python37:
|
||||
python.version: "3.7"
|
||||
TOXENV: "py37"
|
||||
maxParallel: 3
|
||||
steps:
|
||||
- template: linux/continuous-build-linux.yml
|
|
@ -0,0 +1,59 @@
|
|||
steps:
|
||||
- powershell: |
|
||||
((Get-Content -path "$(BUILD.REPOSITORY.LOCALPATH)\.env.tmp" -Raw) -replace 'IOTHUB_CONNECTION_STRING=".*"','IOTHUB_CONNECTION_STRING="$(IOTHUB_CONNECTION_STRING)"' -replace 'DEVICE_CONNECTION_STRING=".*"','DEVICE_CONNECTION_STRING="$(DEVICE_CONNECTION_STRING)"' -replace 'CONTAINER_REGISTRY_SERVER=".*"','CONTAINER_REGISTRY_SERVER="$(CONTAINER_REGISTRY_SERVER)"' -replace 'CONTAINER_REGISTRY_USERNAME=".*"','CONTAINER_REGISTRY_USERNAME="$(CONTAINER_REGISTRY_USERNAME)"' -replace 'CONTAINER_REGISTRY_PASSWORD=".*"','CONTAINER_REGISTRY_PASSWORD="$(CONTAINER_REGISTRY_PASSWORD)"') | Set-Content -Path "$(BUILD.REPOSITORY.LOCALPATH)\.env.tmp"
|
||||
displayName: "Update .env.tmp file"
|
||||
|
||||
- task: UsePythonVersion@0
|
||||
inputs:
|
||||
versionSpec: "$(python.version)"
|
||||
addToPath: true
|
||||
architecture: "x64"
|
||||
|
||||
- task: NodeTool@0
|
||||
displayName: "Use Node 8.x"
|
||||
inputs:
|
||||
versionSpec: 8.x
|
||||
checkLatest: true
|
||||
|
||||
- script: |
|
||||
node --version
|
||||
npm --version
|
||||
npm i -g iothub-explorer
|
||||
iothub-explorer --version
|
||||
displayName: "Install IoT Hub Explorer"
|
||||
|
||||
- powershell: |
|
||||
npm install -g yo
|
||||
npm i -g yo generator-azure-iot-edge-module
|
||||
yo --version
|
||||
displayName: "Install Yeoman and Azure IoT Edge Node.js module generator packages"
|
||||
|
||||
- powershell: |
|
||||
az extension add --name azure-cli-iot-ext
|
||||
az --version
|
||||
displayName: "Install Azure Cli iot extension"
|
||||
|
||||
- script: |
|
||||
pip install --upgrade pip
|
||||
pip install --upgrade tox
|
||||
displayName: "Update and install required tools"
|
||||
|
||||
- script: |
|
||||
brew install docker
|
||||
brew install docker-machine
|
||||
brew link --overwrite docker-machine
|
||||
brew unlink docker-machine-driver-xhyve
|
||||
brew install docker-machine-driver-xhyve
|
||||
sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
|
||||
sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
|
||||
mkdir -p /Users/vsts/.docker/machine/cache
|
||||
curl -Lo /Users/vsts/.docker/machine/cache/boot2docker.iso https://github.com/boot2docker/boot2docker/releases/download/v18.06.1-ce/boot2docker.iso
|
||||
docker-machine create default --driver xhyve --xhyve-boot2docker-url /Users/vsts/.docker/machine/cache/boot2docker.iso
|
||||
docker-machine env default
|
||||
eval $(docker-machine env default)
|
||||
brew services start docker-machine
|
||||
brew install docker-compose
|
||||
docker version
|
||||
sudo -E tox -e "$(TOXENV)"
|
||||
docker-machine rm default -f -y
|
||||
displayName: "Install docker and run tests against iotedgedev source code with tox"
|
|
@ -0,0 +1,29 @@
|
|||
steps:
|
||||
- powershell: |
|
||||
((Get-Content -path "$(BUILD.REPOSITORY.LOCALPATH)\.env.tmp" -Raw) -replace 'IOTHUB_CONNECTION_STRING=".*"','IOTHUB_CONNECTION_STRING="$(IOTHUB_CONNECTION_STRING)"' -replace 'DEVICE_CONNECTION_STRING=".*"','DEVICE_CONNECTION_STRING="$(DEVICE_CONNECTION_STRING)"' -replace 'CONTAINER_REGISTRY_SERVER=".*"','CONTAINER_REGISTRY_SERVER="$(CONTAINER_REGISTRY_SERVER)"' -replace 'CONTAINER_REGISTRY_USERNAME=".*"','CONTAINER_REGISTRY_USERNAME="$(CONTAINER_REGISTRY_USERNAME)"' -replace 'CONTAINER_REGISTRY_PASSWORD=".*"','CONTAINER_REGISTRY_PASSWORD="$(CONTAINER_REGISTRY_PASSWORD)"') | Set-Content -Path "$(BUILD.REPOSITORY.LOCALPATH)\.env.tmp"
|
||||
displayName: "Update .env.tmp file"
|
||||
|
||||
- task: UsePythonVersion@0
|
||||
inputs:
|
||||
versionSpec: "$(python.version)"
|
||||
addToPath: true
|
||||
architecture: "x64"
|
||||
|
||||
- powershell: |
|
||||
sudo npm install -g yo
|
||||
sudo npm i -g yo generator-azure-iot-edge-module
|
||||
displayName: "Install Yeoman and Azure IoT Edge Node.js module generator packages"
|
||||
|
||||
- powershell: |
|
||||
pip install --upgrade pip
|
||||
pip install --upgrade tox
|
||||
sudo npm i -g iothub-explorer
|
||||
az extension add --name azure-cli-iot-ext
|
||||
az --version
|
||||
displayName: "Update and install required tools"
|
||||
|
||||
- script: |
|
||||
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
|
||||
mvn -v
|
||||
sudo -E `which tox` -e "$(TOXENV)"
|
||||
displayName: "Run test"
|
|
@ -0,0 +1,40 @@
|
|||
steps:
|
||||
- powershell: |
|
||||
((Get-Content -path "$(BUILD.REPOSITORY.LOCALPATH)\.env.tmp" -Raw) -replace 'IOTHUB_CONNECTION_STRING=".*"','IOTHUB_CONNECTION_STRING="$(IOTHUB_CONNECTION_STRING)"' -replace 'DEVICE_CONNECTION_STRING=".*"','DEVICE_CONNECTION_STRING="$(DEVICE_CONNECTION_STRING)"' -replace 'CONTAINER_REGISTRY_SERVER=".*"','CONTAINER_REGISTRY_SERVER="$(CONTAINER_REGISTRY_SERVER)"' -replace 'CONTAINER_REGISTRY_USERNAME=".*"','CONTAINER_REGISTRY_USERNAME="$(CONTAINER_REGISTRY_USERNAME)"' -replace 'CONTAINER_REGISTRY_PASSWORD=".*"','CONTAINER_REGISTRY_PASSWORD="$(CONTAINER_REGISTRY_PASSWORD)"') | Set-Content -Path "$(BUILD.REPOSITORY.LOCALPATH)\.env.tmp"
|
||||
displayName: "Update .env.tmp file"
|
||||
|
||||
- powershell: |
|
||||
choco install jdk11
|
||||
$env:JAVA_HOME = "C:\Program Files\Java\jdk-11.0.1"
|
||||
choco install maven
|
||||
mvn -v
|
||||
dotnet --version
|
||||
displayName: "Install JDK and Maven"
|
||||
|
||||
- powershell: |
|
||||
npm i -g iothub-explorer
|
||||
displayName: "Install IoT Hub Explorer"
|
||||
|
||||
- powershell: |
|
||||
npm install -g yo
|
||||
npm i -g yo generator-azure-iot-edge-module
|
||||
displayName: "Install Yeoman and Azure IoT Edge Node.js module generator packages"
|
||||
|
||||
- powershell: |
|
||||
choco install azure-cli
|
||||
$env:Path += ";C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin"
|
||||
az extension add --name azure-cli-iot-ext
|
||||
az --version
|
||||
displayName: "Install Azure Cli And Azure Cli Extension"
|
||||
|
||||
- powershell: |
|
||||
$env:Path += ";C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin"
|
||||
$env:JAVA_HOME = "C:\Program Files\Java\jdk-11.0.1"
|
||||
choco install python2
|
||||
choco install python --version 3.6.6
|
||||
choco install python --version 3.7.1
|
||||
$env:Path += ";C:\Python37;C:\Python37\Scripts"
|
||||
python -m pip install --upgrade pip
|
||||
pip install tox
|
||||
tox
|
||||
displayName: "Run tests against iotedgedev source code"
|
Загрузка…
Ссылка в новой задаче