steps: - task: AzurePowerShell@5 displayName: 'Get variables if EventHub' condition: eq(variables['SDK'], 'EventHub') inputs: azureSubscription: azure-sdk-tests-public ScriptType: InlineScript azurePowerShellVersion: LatestVersion pwsh: true Inline: | $EHSdkPath='azure-sdk-for-python/sdk/eventhub/azure-eventhub' $EHTestResultsPath='eventhub/azure-eventhub/test-results-live.xml' $EHIgnoreTests='--ignore=tests/perfstress_tests --ignore=tests/scripts' $EHSdkType='eventhub' Write-Output "##vso[task.setvariable variable=SdkType;]$EHSdkType" Write-Output "##vso[task.setvariable variable=SdkPath;]$EHSdkPath" Write-Output "##vso[task.setvariable variable=TestResultsPath;]$EHTestResultsPath" Write-Output "##vso[task.setvariable variable=IgnoreTests;]$EHIgnoreTests" - task: AzurePowerShell@5 displayName: 'Get variables if ServiceBus' condition: eq(variables['SDK'], 'ServiceBus') inputs: azureSubscription: azure-sdk-tests-public ScriptType: InlineScript azurePowerShellVersion: LatestVersion pwsh: true Inline: | $SBSdkPath='azure-sdk-for-python/sdk/servicebus/azure-servicebus' $SBTestResultsPath='servicebus/azure-servicebus/test-results-live.xml' $SBIgnoreTests='--ignore=tests/perf_tests --ignore=tests/stress_tests' $SBSdkType='servicebus' Write-Output "##vso[task.setvariable variable=SdkType;]$SBSdkType" Write-Output "##vso[task.setvariable variable=SdkPath;]$SBSdkPath" Write-Output "##vso[task.setvariable variable=TestResultsPath;]$SBTestResultsPath" Write-Output "##vso[task.setvariable variable=IgnoreTests;]$SBIgnoreTests" - script: | echo "SDKPath: $(SdkPath)" echo "Tests: $(TestResultsPath)" git clone https://github.com/Azure/azure-sdk-for-python.git --single-branch --depth 1 displayName: 'Clone azure-sdk-for-python' - task: AzurePowerShell@5 inputs: workingDirectory: azure-sdk-for-python azureSubscription: azure-sdk-tests-public azurePowerShellVersion: LatestVersion pwsh: True ScriptType: InlineScript Inline: | eng/common/scripts/Import-AzModules.ps1 $subscriptionConfiguration = @{} $context = Get-AzContext $subscriptionConfiguration["Environment"] = $context.Environment.Name $subscriptionConfiguration["SubscriptionId"] = $context.Subscription.Id $subscriptionConfiguration["TenantId"] = $context.Subscription.TenantId $subscriptionConfiguration["TestApplicationId"] = $context.Account.Id $subscriptionConfiguration["ProvisionerApplicationId"] = $context.Account.Id $principal = Get-AzADServicePrincipal -ApplicationId $context.Account.Id $subscriptionConfiguration["TestApplicationOid"] = $principal.Id $subscriptionConfiguration["ProvisionerApplicationOid"] = $principal.Id Write-Host ($subscriptionConfiguration | ConvertTo-Json) # Write the new SubscriptionConfiguration to be used by the remove test resources Write-Host "##vso[task.setvariable variable=SubscriptionConfiguration;]$($subscriptionConfiguration | ConvertTo-Json -Compress)" eng/common/TestResources/New-TestResources.ps1 ` -ResourceType test ` -ServiceDirectory $(SDKType) ` -Location westus ` -DeleteAfterHours 8 ` @subscriptionConfiguration ` -CI ` -Force ` -Verbose | Out-Null displayName: Deploy test resources env: TEMP: $(Agent.TempDirectory) PoolSubnet: $(PoolSubnet) - task: DownloadPipelineArtifact@2 displayName: 'Downloading artifact' inputs: source: 'current' patterns: '$(DownloadArtifactFolder)/*.whl' - pwsh: | $whlfile = Get-ChildItem -Filter *.whl $(Pipeline.Workspace)/$(DownloadArtifactFolder) | Select-Object -First 1 -ExpandProperty Name Write-Output "##vso[task.setvariable variable=DownloadArtifactWhl]$whlfile" Get-ChildItem $(Pipeline.Workspace)/$(DownloadArtifactFolder) displayName: 'Get name of whl file to install' - template: /.azure-pipelines/test-proxy-tool.yml parameters: runProxy: true rootFolder: azure-sdk-for-python templateRoot: azure-sdk-for-python - task: AzurePowerShell@5 displayName: Run Tests (AzurePowerShell@5) env: SYSTEM_ACCESSTOKEN: $(System.AccessToken) AZURE_TEST_RUN_LIVE: 'true' TEST_PYAMQP: 'false' PROXY_URL: 'http://localhost:5000' inputs: azureSubscription: azure-sdk-tests-public azurePowerShellVersion: LatestVersion pwsh: true ScriptType: InlineScript Inline: | $account = (Get-AzContext).Account; $env:AZURESUBSCRIPTION_CLIENT_ID = $account.Id; $env:AZURESUBSCRIPTION_TENANT_ID = $account.Tenants; $env:AZURE_SUBSCRIPTION_ID = (Get-AzContext).Subscription.Id; Write-Host (Get-Command python).Source python --version echo "Installing $DownloadArtifactWhl" echo "Full name $(Pipeline.Workspace)/$(DownloadArtifactFolder)/$(DownloadArtifactWhl)" python -m pip install $(Pipeline.Workspace)/$(DownloadArtifactFolder)/$(DownloadArtifactWhl) --force python -m pip install pytest cd $(SdkPath) python -m pip install futures python -m pip install . python -m pip install -r dev_requirements.txt python -m pip list python -m pytest tests -v --doctest-modules $(IgnoreTests) --junitxml=junit/$(TestResultsPath) Write-Host "Last exit code: $LASTEXITCODE"; exit $LASTEXITCODE; - task: AzurePowerShell@5 inputs: workingDirectory: azure-sdk-for-python azureSubscription: azure-sdk-tests-public azurePowerShellVersion: LatestVersion pwsh: True ScriptType: InlineScript Inline: | eng/common/scripts/Import-AzModules.ps1 $subscriptionConfiguration = @' $(SubscriptionConfiguration) '@ | ConvertFrom-Json -AsHashtable; eng/common/TestResources/Remove-TestResources.ps1 ` @subscriptionConfiguration ` -ResourceType test ` -ServiceDirectory $(SDKType) ` -CI ` -Force ` -Verbose displayName: Remove test resources condition: and(eq(variables['CI_HAS_DEPLOYED_RESOURCES'], 'true'), ne(variables['Skip.RemoveTestResources'], 'true')) continueOnError: true - task: PublishTestResults@2 displayName: 'Publish test results' condition: succeededOrFailed() inputs: testResultsFiles: '**/$(TestResultsPath)' testResultsFormat: 'JUnit' testRunTitle: '$(OSArch) $(SDK) Python $(PythonVersion)'