Skip to content

Commit 426e00b

Browse files
authored
Add storage test pipeline with static config for virtualized resource (Azure#29916)
1 parent 191d028 commit 426e00b

File tree

5 files changed

+100
-11
lines changed

5 files changed

+100
-11
lines changed

eng/pipelines/templates/jobs/live.tests.yml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ parameters:
3232
- name: TestSetupSteps
3333
type: stepList
3434
default: []
35+
- name: DeployTestResources
36+
type: boolean
37+
default: true
3538
- name: CloudConfig
3639
type: object
3740
default: {}
@@ -99,13 +102,14 @@ jobs:
99102
SubscriptionConfiguration: ${{ parameters.CloudConfig.SubscriptionConfiguration }}
100103
SubscriptionConfigurations: ${{ parameters.CloudConfig.SubscriptionConfigurations }}
101104

102-
- template: /eng/common/TestResources/deploy-test-resources.yml
103-
parameters:
104-
${{ if or(parameters.Location, parameters.CloudConfig.Location) }}:
105-
Location: ${{ coalesce(parameters.Location, parameters.CloudConfig.Location) }}
106-
ServiceDirectory: '${{ parameters.ServiceDirectory }}'
107-
SubscriptionConfiguration: $(SubscriptionConfiguration)
108-
ArmTemplateParameters: $(ArmTemplateParameters)
105+
- ${{ if parameters.DeployTestResources }}:
106+
- template: /eng/common/TestResources/deploy-test-resources.yml
107+
parameters:
108+
${{ if or(parameters.Location, parameters.CloudConfig.Location) }}:
109+
Location: ${{ coalesce(parameters.Location, parameters.CloudConfig.Location) }}
110+
ServiceDirectory: '${{ parameters.ServiceDirectory }}'
111+
SubscriptionConfiguration: $(SubscriptionConfiguration)
112+
ArmTemplateParameters: $(ArmTemplateParameters)
109113

110114
- pwsh: |
111115
if ($env:SupportsRecording -and $env:Record) {
@@ -138,10 +142,11 @@ jobs:
138142
${{ each var in parameters.EnvVars }}:
139143
${{ var.key }}: ${{ var.value }}
140144
141-
- template: /eng/common/TestResources/remove-test-resources.yml
142-
parameters:
143-
ServiceDirectory: '${{ parameters.ServiceDirectory }}'
144-
SubscriptionConfiguration: $(SubscriptionConfiguration)
145+
- ${{ if parameters.DeployTestResources }}:
146+
- template: /eng/common/TestResources/remove-test-resources.yml
147+
parameters:
148+
ServiceDirectory: '${{ parameters.ServiceDirectory }}'
149+
SubscriptionConfiguration: $(SubscriptionConfiguration)
145150

146151
- task: PublishTestResults@2
147152
condition: always()

eng/pipelines/templates/stages/archetype-sdk-tests.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ parameters:
4444
- name: TestSetupSteps
4545
type: stepList
4646
default: []
47+
- name: DeployTestResources
48+
type: boolean
49+
default: true
4750
- name: CloudConfig
4851
type: object
4952
default:
@@ -128,6 +131,7 @@ stages:
128131
ServiceDirectory: ${{ parameters.ServiceDirectory }}
129132
Project: ${{ parameters.Project }}
130133
TestSetupSteps: ${{ parameters.TestSetupSteps }}
134+
DeployTestResources: ${{ parameters.DeployTestResources }}
131135
MatrixConfigs:
132136
# Enumerate platforms and additional platforms based on supported clouds (sparse platform<-->cloud matrix).
133137
- ${{ each config in parameters.MatrixConfigs }}:
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"displayNames": {
3+
"/p:UseProjectReferenceToAzureClients=false": "PackageRef"
4+
},
5+
"matrix": {
6+
"Agent": {
7+
"Ubuntu-20.04_NET6.0": {
8+
"OSVmImage": "MMSUbuntu20.04",
9+
"Pool": "azsdk-pool-mms-ubuntu-2004-general",
10+
"TestTargetFramework": "net6.0"
11+
}
12+
},
13+
"AdditionalTestArguments": [
14+
"/p:UseProjectReferenceToAzureClients=false"
15+
],
16+
"BuildConfiguration": [
17+
"Debug"
18+
]
19+
}
20+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env pwsh
2+
3+
# This script enables bypassing ARM template deployment in live tests in favor of a statically configured
4+
# test configuration xml file stored in keyvault. The test configuration file is normally constructed
5+
# dynamically from ARM template outputs via test-resources-post.ps1
6+
[CmdletBinding()]
7+
param (
8+
[ValidateNotNullOrEmpty()]
9+
[string] $TestConfigurationXmlContent
10+
)
11+
12+
function getTestConfigurationPath() {
13+
$storageTestConfigurationTemplateName = 'TestConfigurationsTemplate.xml'
14+
$storageTestConfigurationName = 'TestConfigurations.xml'
15+
16+
if(-not (Test-Path $env:BUILD_ARTIFACTSTAGINGDIRECTORY -ErrorAction Ignore) ) {
17+
Write-Verbose "Checking for '$storageTestConfigurationTemplateName' files under '$PSScriptRoot'"
18+
19+
$foundFile = Get-ChildItem -Path $PSScriptRoot -Filter $storageTestConfigurationTemplateName -Recurse | Select-Object -First 1
20+
$storageTemplateDirName = $foundFile.Directory.FullName
21+
Write-Verbose "Found template dir '$storageTemplateDirName'"
22+
23+
} else {
24+
$storageTemplateDirName = $env:BUILD_ARTIFACTSTAGINGDIRECTORY
25+
Write-Verbose "Found environment variable BUILD_ARTIFACTSTAGINGDIRECTORY '$storageTemplateDirName'"
26+
}
27+
28+
# Construct the test configuration path to use based on the devops build variable for artifact staging directory
29+
$TestConfigurationPath = Join-Path -Path $storageTemplateDirName -ChildPath $storageTestConfigurationName
30+
return $TestConfigurationPath
31+
}
32+
33+
$outfile = getTestConfigurationPath
34+
Write-Host "Writing test configuration xml to $outfile"
35+
$TestConfigurationXmlContent | Out-File $outfile

sdk/storage/tests.virtualized.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
trigger: none
2+
3+
extends:
4+
template: /eng/pipelines/templates/stages/archetype-sdk-tests.yml
5+
parameters:
6+
ServiceDirectory: storage
7+
MatrixReplace:
8+
# Use dedicated storage pool in canadacentral with higher memory capacity
9+
- Pool=(.*)-general/$1-storage
10+
MatrixConfigs:
11+
- Name: Storage_virtualized
12+
Path: sdk/storage/platform-matrix-virtualized.json
13+
Selection: sparse
14+
GenerateVMJobs: true
15+
EnvVars:
16+
AZURE_ONLY_TEST_LATEST_SERVICE_VERSION: true
17+
DeployTestResources: false
18+
TestSetupSteps:
19+
- template: /sdk/storage/tests-install-azurite.yml
20+
- pwsh: |
21+
$config = @'
22+
$(live-test-config-net-virtualized-xml)
23+
'@
24+
sdk/storage/set-test-configuration.ps1 -TestConfigurationXmlContent $config
25+
displayName: Set Static Test Configuration

0 commit comments

Comments
 (0)