Skip to content

Commit

Permalink
First draft ISA95 test (Azure#4344)
Browse files Browse the repository at this point in the history
* First draft ISA95 test

* Adding to nested E2E

* Merge with David's PR

* nugget fix
  • Loading branch information
huguesBouvier authored Feb 10, 2021
1 parent 26ccf7e commit 2570b94
Show file tree
Hide file tree
Showing 25 changed files with 872 additions and 182 deletions.
230 changes: 230 additions & 0 deletions builds/e2e/isa-95-smoke-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
trigger: none
pr: none

variables:
itProxy: http://10.16.8.4:3128
otProxy: http://10.16.5.4:3128
ressourceGroup: nested-edge-isa95

resources:
pipelines:
- pipeline: images
source: 'Azure-IoT-Edge-Core Build Images'
branch: master
- pipeline: packages
source: 'Azure-IoT-Edge-Core Edgelet Packages'
branch: master

stages:
- stage: SetupVM
jobs:
- job: SetupVM_level5
displayName: SettingUp level 5
timeoutInMinutes: 180
variables:
artifactName: iotedged-ubuntu18.04-amd64
identityServiceArtifactName: packages_ubuntu-18.04_amd64
identityServicePackageFilter: aziot-identity-service_*_amd64.deb
vsts.project: $(System.TeamProjectId)
level: '5'
deploymentFile: 'nestededge_topLayerBaseDeployment_amqp.json'
parentName: ''
parentDeviceId: ''
proxyAddress: $(itProxy)
pool:
name: $(pool.name)
demands:
- agent-group -equals $(agent.group)
- Agent.OS -equals Linux
- Agent.OSArchitecture -equals X64
- level -equals 5
steps:
- template: templates/nested-get-secrets.yaml
- template: templates/e2e-clean-directory.yaml
- template: templates/nested-get-root-ca.yaml
- template: templates/nested-create-identity.yaml
- template: templates/nested-agent-deploy.yaml
- task: Bash@3
displayName: 'Exporting agentName'
name: exportAgentName
inputs:
targetType: inline
script: |
echo "##vso[task.setvariable variable=agentName;isOutput=true]$(Agent.Name)"
- job: SetupVM_level4
dependsOn: SetupVM_level5
displayName: SettingUp level 4
condition: succeeded()
timeoutInMinutes: 180
variables:
identityServiceArtifactName: packages_ubuntu-18.04_amd64
identityServicePackageFilter: aziot-identity-service_*_amd64.deb
artifactName: iotedged-ubuntu18.04-amd64
vsts.project: $(System.TeamProjectId)
parentName: $[ dependencies.SetupVM_level5.outputs['deployIoTEdge.deviceName'] ]
parentDeviceId: $[ dependencies.SetupVM_level5.outputs['createIdentity.parentDeviceId'] ]
deploymentFile: 'nestededge_middleLayerBaseDeployment_amqp.json'
level: '4'
pool:
name: $(pool.name)
demands:
- agent-group -equals $(agent.group)
- Agent.OS -equals Linux
- Agent.OSArchitecture -equals X64
- level -equals 4
steps:
- template: templates/nested-get-secrets.yaml
- template: templates/e2e-clean-directory.yaml
- template: templates/nested-get-root-ca.yaml
- template: templates/nested-create-identity.yaml
- template: templates/nested-agent-deploy.yaml
- task: Bash@3
displayName: 'Exporting agentName'
name: exportAgentName
inputs:
targetType: inline
script: |
echo "##vso[task.setvariable variable=agentName;isOutput=true]$(Agent.Name)"
- job: SetupVM_level3
dependsOn: SetupVM_level4
displayName: SettingUp level 3
condition: succeeded()
timeoutInMinutes: 180
variables:
identityServiceArtifactName: packages_ubuntu-18.04_amd64
identityServicePackageFilter: aziot-identity-service_*_amd64.deb
artifactName: iotedged-ubuntu18.04-amd64
vsts.project: $(System.TeamProjectId)
parentName: $[ dependencies.SetupVM_level4.outputs['deployIoTEdge.deviceName'] ]
parentDeviceId: $[ dependencies.SetupVM_level4.outputs['createIdentity.parentDeviceId'] ]
deploymentFile: 'nestededge_isa95_smoke_test_BaseDeployment.json'
level: '3'
proxyAddress: $(otProxy)
pool:
name: $(pool.name)
demands:
- agent-group -equals $(agent.group)
- Agent.OS -equals Linux
- Agent.OSArchitecture -equals X64
- level -equals 3
steps:
- template: templates/nested-get-secrets.yaml
- template: templates/e2e-clean-directory.yaml
- template: templates/nested-get-root-ca.yaml
- template: templates/nested-create-identity.yaml
- template: templates/nested-agent-deploy.yaml
- task: Bash@3
displayName: 'Exporting agentName'
name: exportAgentName
inputs:
targetType: inline
script: |
echo "##vso[task.setvariable variable=agentName;isOutput=true]$(Agent.Name)"
- job: Run_ISA95_test
dependsOn:
- SetupVM_level5
- SetupVM_level4
- SetupVM_level3
displayName: Run ISA-95 test
condition: succeeded()
timeoutInMinutes: 180
variables:
Lvl3DeviceId: $[ dependencies.SetupVM_level3.outputs['createIdentity.parentDeviceId'] ]
deviceLvl5AgentName: $[ dependencies.SetupVM_level5.outputs['exportAgentName.agentName'] ]
deviceLvl4AgentName: $[ dependencies.SetupVM_level4.outputs['exportAgentName.agentName'] ]
deviceLvl3AgentName: $[ dependencies.SetupVM_level3.outputs['exportAgentName.agentName'] ]
parentName: $[ dependencies.SetupVM_level4.outputs['deployIoTEdge.deviceName'] ]
parentDeviceId: $[ dependencies.SetupVM_level4.outputs['createIdentity.parentDeviceId'] ]
os: linux
arch: amd64
artifactName: iotedged-ubuntu18.04-amd64
identityServiceArtifactName: packages_ubuntu-18.04_amd64
identityServicePackageFilter: aziot-identity-service_*_amd64.deb
nestededge: true
proxyAddress: $(otProxy)
test_type: nestededge_isa95
pool:
name: $(pool.name)
demands:
- agent-group -equals $(agent.group)
- Agent.OS -equals Linux
- Agent.OSArchitecture -equals X64
- level -equals jumpbox
steps:
- template: templates/nested-get-secrets.yaml
- template: templates/e2e-clean-directory.yaml
- template: templates/nested-isa95-lock.yaml
parameters:
agentName: $(deviceLvl5AgentName)
lvl: 5
- template: templates/nested-isa95-lock.yaml
parameters:
agentName: $(deviceLvl4AgentName)
lvl: 4
- template: templates/nested-isa95-lock.yaml
parameters:
agentName: $(deviceLvl3AgentName)
lvl: 3
- template: templates/nested-get-root-ca.yaml
- template: templates/e2e-setup.yaml
- template: templates/e2e-run.yaml
parameters:
EventHubCompatibleEndpoint: $(EventHubStressConnStr)
IotHubConnectionString: $(IotHubStressConnString)
test_type: $(test_type)

- job: Clean_up
dependsOn:
- SetupVM_level5
- SetupVM_level4
- SetupVM_level3
- Run_ISA95_test
condition: always()
displayName: Clean up identities and unlock agents
timeoutInMinutes: 3
variables:
deviceLvl5DeviceId: $[ dependencies.SetupVM_level5.outputs['createIdentity.parentDeviceId'] ]
deviceLvl4DeviceId: $[ dependencies.SetupVM_level4.outputs['createIdentity.parentDeviceId'] ]
deviceLvl5IoTHubName: $[ dependencies.SetupVM_level5.outputs['createIdentity.iotHubName'] ]
deviceLvl4IoTHubName: $[ dependencies.SetupVM_level4.outputs['createIdentity.iotHubName'] ]
deviceLvl5AgentName: $[ dependencies.SetupVM_level5.outputs['exportAgentName.agentName'] ]
deviceLvl4AgentName: $[ dependencies.SetupVM_level4.outputs['exportAgentName.agentName'] ]
deviceLvl3AgentName: $[ dependencies.SetupVM_level3.outputs['exportAgentName.agentName'] ]
deviceLvl5NSGName: $[ dependencies.Run_ISA95_test.outputs['isa95_lock_lvl5.nsgName'] ]
deviceLvl4NSGName: $[ dependencies.Run_ISA95_test.outputs['isa95_lock_lvl4.nsgName'] ]
deviceLvl3NSGName: $[ dependencies.Run_ISA95_test.outputs['isa95_lock_lvl3.nsgName'] ]

pool:
name: $(pool.name)
demands:
- agent-group -equals $(agent.group)
- Agent.OS -equals Linux
- Agent.OSArchitecture -equals X64
- level -equals jumpbox
steps:
- template: templates/nested-get-secrets.yaml
- template: templates/nested-clean-identity.yaml
parameters:
iotHubName: $(deviceLvl5IoTHubName)
deviceId: $(deviceLvl5DeviceId)
lvl: 5
- template: templates/nested-clean-identity.yaml
parameters:
iotHubName: $(deviceLvl4IoTHubName)
deviceId: $(deviceLvl4DeviceId)
lvl: 4
- template: templates/nested-isa95-unlock.yaml
parameters:
agentName: $(deviceLvl5AgentName)
nsgName: $(deviceLvl5NSGName)
- template: templates/nested-isa95-unlock.yaml
parameters:
agentName: $(deviceLvl4AgentName)
nsgName: $(deviceLvl4NSGName)
- template: templates/nested-isa95-unlock.yaml
parameters:
agentName: $(deviceLvl3AgentName)
nsgName: $(deviceLvl3NSGName)
29 changes: 27 additions & 2 deletions builds/e2e/nested-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@ stages:
jobs:
- template: templates/nested-parent-vm-setup.yaml
- job: SetupVM_and_RunTest_level3
dependsOn: SetupVM_level4
dependsOn:
- SetupVM_level5
- SetupVM_level4
displayName: Set up and run tests
timeoutInMinutes: 180
condition: succeeded()
variables:
parentName: $[ dependencies.SetupVM_level4.outputs['deployIoTEdge.deviceName'] ]
parentDeviceId: $[ dependencies.SetupVM_level4.outputs['createIdentity.parentDeviceId'] ]
lvl5DeviceId: $[ dependencies.SetupVM_level5.outputs['createIdentity.parentDeviceId'] ]
iotHubName: $[ dependencies.SetupVM_level5.outputs['createIdentity.iotHubName'] ]
os: linux
arch: amd64
artifactName: iotedged-ubuntu18.04-amd64
Expand All @@ -47,6 +51,27 @@ stages:
parameters:
EventHubCompatibleEndpoint: $(EventHubStressConnStr)
IotHubConnectionString: $(IotHubStressConnString)
test_type: nestededge_mqtt
- template: templates/nested-deploy-config.yaml
parameters:
deviceId: $(lvl5DeviceId)
deploymentFile: nestededge_topLayerBaseDeployment_amqp.json
changeDeployConfigOnly: true
level: 5
name: 5
- template: templates/nested-deploy-config.yaml
parameters:
deviceId: $(parentDeviceId)
deploymentFile: nestededge_middleLayerBaseDeployment_amqp.json
changeDeployConfigOnly: true
level: 4
name: 4
- template: templates/e2e-run.yaml
parameters:
EventHubCompatibleEndpoint: $(EventHubStressConnStr)
IotHubConnectionString: $(IotHubStressConnString)
test_type: nestededge_amqp


- job: Clean_up
dependsOn:
Expand All @@ -55,7 +80,7 @@ stages:
- SetupVM_and_RunTest_level3
condition: always()
displayName: Clean up identities and unlock agents
timeoutInMinutes: 1
timeoutInMinutes: 2
variables:
deviceLvl5DeviceId: $[ dependencies.SetupVM_level5.outputs['createIdentity.parentDeviceId'] ]
deviceLvl4DeviceId: $[ dependencies.SetupVM_level4.outputs['createIdentity.parentDeviceId'] ]
Expand Down
25 changes: 18 additions & 7 deletions builds/e2e/templates/e2e-run.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
parameters:
EventHubCompatibleEndpoint: '$(TestEventHubCompatibleEndpoint)'
IotHubConnectionString: '$(TestIotHubConnectionString)'
test_type: ''

steps:
- pwsh: |
$testFile = '$(binDir)/Microsoft.Azure.Devices.Edge.Test.dll'
$test_type = '${{ parameters.test_type }}'
# Filter out unstable tests.
$filter = 'Category!=Unstable'
Expand All @@ -18,22 +20,31 @@ steps:
$filter += '&Category!=UnstableOnArm'
}
#filter out tests not usable on nested edge
if ('$(nestededge)' -eq 'true')
if ($test_type -eq 'nestededge_mqtt')
{
$filter += '&Category!=SingleNodeOnly'
#We are disabling some additional tests. See PBI #9171870. Once this is fixed we should run what's directly below.
#$filter += '&FullyQualifiedName!~Provisioning&FullyQualifiedName!~PlugAndPlay&FullyQualifiedName!~PriorityQueueModuleToHubMessages&FullyQualifiedName!~SasOutOfScope'
$filter += '&FullyQualifiedName!~Provisioning&FullyQualifiedName!~PlugAndPlay&FullyQualifiedName!~PriorityQueueModuleToHubMessages&FullyQualifiedName!~SasOutOfScope&FullyQualifiedName!~X509ManualProvision&FullyQualifiedName!~AuthorizationPolicyUpdateTest&FullyQualifiedName!~AuthorizationPolicyExplicitPolicyTest'
}
else
elseif ($test_type -eq 'nestededge_amqp')
{
$filter += '&Category!=SingleNodeOnly'
$filter += '&FullyQualifiedName!~Provisioning&FullyQualifiedName!~PriorityQueueModuleToHubMessages&FullyQualifiedName!~SasOutOfScope&FullyQualifiedName!~X509ManualProvision&FullyQualifiedName!~AuthorizationPolicyUpdateTest&FullyQualifiedName!~AuthorizationPolicyExplicitPolicyTest'
}
elseif ($test_type -eq 'nestededge_isa95')
{
$filter += '&Category!=NestedEdgeOnly'
$filter = 'Category=nestededge_isa95'
}
else
{
$filter += '&Category!=NestedEdgeOnly'
}
sudo --preserve-env dotnet test $testFile --logger:trx --testcasefilter:$filter
displayName: Run tests
displayName: Run tests ${{ parameters.test_type }}
continueOnError: true
env:
E2E_DPS_GROUP_KEY: $(TestDpsGroupKeySymmetric)
E2E_EVENT_HUB_ENDPOINT: ${{ parameters['EventHubCompatibleEndpoint'] }}
Expand All @@ -57,7 +68,7 @@ steps:
condition: and(succeededOrFailed(), not(variables['Agent.ProxyUrl']))

- pwsh: |
$logDir = '$(Build.ArtifactStagingDirectory)/logs'
$logDir = '$(Build.ArtifactStagingDirectory)/logs${{ parameters.test_type }}'
New-Item $logDir -ItemType Directory -Force | Out-Null
Out-File "$logDir/$(Build.DefinitionName)-$(Build.BuildNumber)"
Copy-Item "$(Build.SourcesDirectory)/TestResults" "$logDir/" -Recurse
Expand All @@ -72,6 +83,6 @@ steps:
- task: PublishBuildArtifacts@1
displayName: Publish logs
inputs:
PathtoPublish: $(Build.ArtifactStagingDirectory)/logs
PathtoPublish: $(Build.ArtifactStagingDirectory)/logs${{ parameters.test_type }}
ArtifactName: logs-end-to-end-$(Build.BuildNumber)-$(System.PhaseName)
condition: succeededOrFailed()
17 changes: 13 additions & 4 deletions builds/e2e/templates/e2e-setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ steps:
ARTIFACT_NAME: $(identityServiceArtifactName)
PACKAGE_FILTER: $(identityServicePackageFilter)
DOWNLOAD_PATH: $(System.ArtifactsDirectory)/$(artifactName)

IDENTITY_SERVICE_COMMIT: $(aziotis.commit)
- pwsh: |
$certsDir = '$(System.ArtifactsDirectory)/certs'
New-Item "$certsDir" -ItemType Directory -Force | Out-Null
Expand Down Expand Up @@ -130,8 +130,9 @@ steps:
echo "Edge agent image: $imagePrefix-agent:$imageTag"
$context = @{
nestededge = "$nestededge"
dpsIdScope = '$(dps.idScope)'
nestededge = "$nestededge";
dpsIdScope = '$(dps.idScope)';
isa95Tag = 'false';
edgeAgentImage = "$imagePrefix-agent:$imageTag";
edgeHubImage = "$imagePrefix-hub:$imageTag";
diagnosticsImage = "$diagnosticImagePrefix-diagnostics:$imageTag";
Expand Down Expand Up @@ -165,6 +166,13 @@ steps:
$context['hostname'] = '$(deviceName)'
$context['parentHostname'] = '$(parentName)'
$context['parentDeviceId'] = '$(parentDeviceId)'
if ('$(test_type)' -eq 'nestededge_isa95')
{
$context['deviceId'] = '$(Lvl3DeviceId)'
$context['edgeProxy'] = '$(proxyAddress)'
$context['isa95Tag'] = 'true'
}
}
if ('$(arch)' -eq 'arm32v7' -Or '$(arch)' -eq 'arm64v8')
Expand All @@ -177,7 +185,8 @@ steps:
if ($env:AGENT_PROXYURL)
{
$context['proxy'] = $env:AGENT_PROXYURL
$context['testRunnerProxy'] = $env:AGENT_PROXYURL
$context['edgeProxy'] = $env:AGENT_PROXYURL
}
$context | ConvertTo-Json | Out-File -Encoding Utf8 '$(binDir)/context.json'
Expand Down
Loading

0 comments on commit 2570b94

Please sign in to comment.