Skip to content

Commit

Permalink
add SERVICEBUS_ envvars to test pipeline (#342)
Browse files Browse the repository at this point in the history
* update envvars for SB and version

* temp comment out tests

* test create resources

* add deploy test resources to pipeline

* remove SB client id/secret/tenant from explicit envvars

* add test proxy files

* specify cwd to run testproxy templ

* update template location

* add tests back

* create log file for linux/mac test proxy

* check mac/linux testproxy

* pwd for test proxy mac/linux

* print binaries dir

* more things

* rm workingDirectory from mac/linux testproxy

* re-enable all OS

* move line in template
  • Loading branch information
swathipil authored Oct 11, 2022
1 parent c6bd740 commit c42bbad
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 1 deletion.
47 changes: 47 additions & 0 deletions .azure-pipelines/test-eh-sb-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ steps:
$EHSdkPath='azure-sdk-for-python/sdk/eventhub/azure-eventhub'
$EHTestResultsPath='eventhub/azure-eventhub/test-results-live.xml'
$EHIgnoreTests='--ignore=tests/perfstress_tests'
$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"
Expand All @@ -12,6 +14,8 @@ steps:
$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"
Expand All @@ -22,6 +26,26 @@ steps:
echo "Tests: $(TestResultsPath)"
git clone https://github.com/Azure/azure-sdk-for-python.git --single-branch --depth 1
displayName: 'Clone azure-sdk-for-python'
- pwsh: |
eng/common/scripts/Import-AzModules.ps1
$subscriptionConfiguration = @'
$(sub-config-azure-cloud-test-resources)
'@ | ConvertFrom-Json -AsHashtable;
eng/common/TestResources/New-TestResources.ps1 `
-ResourceType test `
-ServiceDirectory $(SDKType) `
-Location westus `
-DeleteAfterHours 8 `
@subscriptionConfiguration `
-CI `
-Force `
-Verbose | Out-Null
workingDirectory: azure-sdk-for-python
displayName: Deploy test resources
env:
TEMP: $(Agent.TempDirectory)
- task: DownloadPipelineArtifact@2
displayName: 'Downloading artifact'
inputs:
Expand All @@ -32,6 +56,11 @@ steps:
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
- script: |
python --version
python -m pip install pytest
Expand All @@ -50,6 +79,24 @@ steps:
AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id)
AZURE_CLIENT_SECRET: $(aad-azure-sdk-test-client-secret)
AZURE_TEST_RUN_LIVE: 'true'
- pwsh: |
eng/common/scripts/Import-AzModules.ps1
$subscriptionConfiguration = @'
$(sub-config-azure-cloud-test-resources)
'@ | ConvertFrom-Json -AsHashtable;
eng/common/TestResources/Remove-TestResources.ps1 `
@subscriptionConfiguration `
-ResourceType test `
-ServiceDirectory $(SDKType) `
-CI `
-Force `
-Verbose
workingDirectory: azure-sdk-for-python
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()
Expand Down
68 changes: 68 additions & 0 deletions .azure-pipelines/test-proxy-tool.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
parameters:
rootFolder: '$(Build.SourcesDirectory)'
runProxy: true
targetVersion: ''
templateRoot: '$(Build.SourcesDirectory)'
condition: true

steps:
- pwsh: |
${{ parameters.templateRoot }}/eng/common/scripts/trust-proxy-certificate.ps1
displayName: 'Language Specific Certificate Trust'
condition: and(succeeded(), ${{ parameters.condition }})
- pwsh: |
$version = $(Get-Content "${{ parameters.templateRoot }}/eng/common/testproxy/target_version.txt" -Raw).Trim()
$overrideVersion = "${{ parameters.targetVersion }}"
if($overrideVersion) {
Write-Host "Overriding default target proxy version of '$version' with override $overrideVersion."
$version = $overrideVersion
}
dotnet tool install azure.sdk.tools.testproxy `
--tool-path $(Build.BinariesDirectory)/test-proxy `
--add-source https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json `
--version $version
displayName: "Install test-proxy"
condition: and(succeeded(), ${{ parameters.condition }})
- pwsh: |
Write-Host "##vso[task.prependpath]$(Build.BinariesDirectory)/test-proxy"
displayName: "Prepend path with test-proxy tool install location"
- ${{ if eq(parameters.runProxy, 'true') }}:
- pwsh: |
Write-Host "##vso[task.setvariable variable=ASPNETCORE_Kestrel__Certificates__Default__Path]${{ parameters.templateRoot }}/eng/common/testproxy/dotnet-devcert.pfx"
Write-Host "##vso[task.setvariable variable=ASPNETCORE_Kestrel__Certificates__Default__Password]password"
Write-Host "##vso[task.setvariable variable=PROXY_MANUAL_START]true"
displayName: 'Configure Kestrel and PROXY_MANUAL_START Variables'
condition: and(succeeded(), ${{ parameters.condition }})
- pwsh: |
Start-Process $(Build.BinariesDirectory)/test-proxy/test-proxy.exe `
-ArgumentList "--storage-location ${{ parameters.rootFolder }}" `
-NoNewWindow -PassThru -RedirectStandardOutput ${{ parameters.templateRoot }}/test-proxy.log
displayName: 'Run the testproxy - windows'
condition: and(succeeded(), eq(variables['Agent.OS'],'Windows_NT'), ${{ parameters.condition }})
# nohup does NOT continue beyond the current session if you use it within powershell
- bash: |
nohup $(Build.BinariesDirectory)/test-proxy/test-proxy > ${{ parameters.templateRoot }}/test-proxy.log &
displayName: "Run the testproxy - linux/mac"
condition: and(succeeded(), ne(variables['Agent.OS'],'Windows_NT'), ${{ parameters.condition }})
- pwsh: |
for ($i = 0; $i -lt 10; $i++) {
try {
Invoke-WebRequest -Uri "http://localhost:5000/Admin/IsAlive" | Out-Null
exit 0
} catch {
Write-Warning "Failed to successfully connect to test proxy. Retrying..."
Start-Sleep 6
}
}
Write-Error "Could not connect to test proxy."
exit 1
displayName: Test Proxy IsAlive
condition: and(succeeded(), ${{ parameters.condition }})
2 changes: 1 addition & 1 deletion uamqp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
pass # Async not supported.


__version__ = "1.6.0"
__version__ = "1.6.1"


_logger = logging.getLogger(__name__)
Expand Down

0 comments on commit c42bbad

Please sign in to comment.