Skip to content

Commit 1d36326

Browse files
authored
Update live test yaml to use cloud and matrix configuration (Azure#13886)
* Update live test templates to use matrix generation * Update sdk live tests to use matrix generation, cloud config stages * Fix live test matrix filter parity errors * Remove matrix filters. Opt-in most tests to samples and min/max testing * Fix post step template parameter in monitor live tests * Filter dependency version for live tests that don't support it * Only publish test results for browser and node tests
1 parent d28b4ae commit 1d36326

File tree

38 files changed

+591
-513
lines changed

38 files changed

+591
-513
lines changed

eng/pipelines/templates/jobs/archetype-sdk-integration.yml

Lines changed: 47 additions & 157 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,7 @@ parameters:
22
- name: PackageName
33
type: string
44
default: ""
5-
- name: PreIntegrationSteps
6-
type: string
7-
default: ""
8-
- name: PostIntegrationSteps
9-
type: string
10-
default: ""
11-
- name: ResourceServiceDirectory
5+
- name: ServiceDirectory
126
type: string
137
default: ""
148
- name: EnvVars
@@ -23,161 +17,64 @@ parameters:
2317
- name: PublishCodeCoverage
2418
type: boolean
2519
default: false
26-
- name: SubscriptionConfiguration
27-
type: string
28-
default: $(sub-config-azure-cloud-test-resources)
29-
- name: ResourceGroupLocation
20+
- name: PreSteps
21+
type: object
22+
default: []
23+
- name: PostSteps
24+
type: object
25+
default: []
26+
- name: Location
3027
type: string
31-
default: ""
32-
- name: ResourceGroupLocationCanary
28+
default: ''
29+
- name: CloudConfig
30+
type: object
31+
default: {}
32+
- name: Matrix
3333
type: string
34-
default: "centraluseuap"
35-
- name: ArmTemplateParameters
34+
- name: DependsOn
3635
type: string
37-
default: "@{}"
38-
- name: TestBrowser
39-
type: boolean
40-
default: true
41-
- name: TestSamples
42-
type: boolean
43-
default: true
44-
- name: TestMinMax
45-
type: boolean
46-
default: false
47-
- name: TestSame
36+
default: ''
37+
- name: UsePlatformContainer
4838
type: boolean
4939
default: false
50-
- name: TestCanary
51-
type: boolean
52-
default: false
53-
- name: Matrix
54-
type: object
55-
default:
56-
Windows Node 8:
57-
Pool: azsdk-pool-mms-win-2019-general
58-
OSVmImage: MMS2019
59-
TestType: "node"
60-
NodeTestVersion: "8.x"
61-
PublishCodeCoverage: true
62-
Linux Node 10:
63-
Pool: azsdk-pool-mms-ubuntu-1804-general
64-
OSVmImage: MMSUbuntu18.04
65-
TestType: "node"
66-
NodeTestVersion: "10.x"
67-
Linux Node 12:
68-
Pool: azsdk-pool-mms-ubuntu-1804-general
69-
OSVmImage: MMSUbuntu18.04
70-
TestType: "node"
71-
NodeTestVersion: "12.x"
72-
MacOS Node 14:
73-
Pool: Azure Pipelines
74-
OSVmImage: "macOS-10.15"
75-
TestType: "node"
76-
NodeTestVersion: "14.x"
40+
7741

7842
jobs:
79-
- job: "IntegrationTest"
43+
- job:
44+
dependsOn: ${{ parameters.DependsOn }}
45+
condition: ne(${{ parameters.Matrix }}, '{}')
46+
strategy:
47+
maxParallel: ${{ parameters.MaxParallel }}
48+
matrix: $[ ${{ parameters.Matrix }} ]
8049

8150
variables:
8251
- template: ../variables/globals.yml
83-
- name: SubscriptionConfiguration
84-
value: ${{ parameters.SubscriptionConfiguration }}
85-
- name: ResourceGroupLocation
86-
value: ${{ parameters.ResourceGroupLocation }}
8752
- name: ArmTemplateParameters
88-
value: ${{ parameters.ArmTemplateParameters }}
89-
90-
91-
strategy:
92-
maxParallel: ${{ parameters.MaxParallel }}
93-
matrix:
94-
${{ each matrixEntry in parameters.Matrix }}:
95-
${{ matrixEntry.key }}:
96-
# TestResultsFiles
97-
${{ if eq(matrixEntry.value.TestType, 'browser' )}}:
98-
TestResultsFiles: "**/test-results.browser.xml"
99-
${{ if eq(matrixEntry.value.TestType, 'node') }}:
100-
TestResultsFiles: "**/test-results.xml"
101-
# Remaining entries from the matrix object
102-
${{ insert }}: ${{ matrixEntry.value }}
103-
# Include these entries in all test matrices. Note that TestResultsFile
104-
# is specified because the template logic above is not running in this
105-
# context.
106-
107-
# Add matrix entry for browser testing
108-
${{ if eq(parameters.TestBrowser, 'true') }}:
109-
Windows Browser:
110-
Pool: azsdk-pool-mms-win-2019-general
111-
OSVmImage: MMS2019
112-
TestType: "browser"
113-
NodeTestVersion: "$(NodeVersion)"
114-
TestResultsFiles: "**/test-results.browser.xml"
115-
116-
# Add matrix entry for sample testing
117-
${{ if eq(parameters.TestSamples, 'true') }}:
118-
Samples Linux Node 10:
119-
Pool: azsdk-pool-mms-ubuntu-1804-general
120-
OSVmImage: MMSUbuntu18.04
121-
TestType: "sample"
122-
NodeTestVersion: "10.x"
123-
124-
# Add matrix entry for min-max testing
125-
${{ if eq(parameters.TestMinMax, 'true') }}:
126-
MaxVersion_Node:
127-
Pool: azsdk-pool-mms-ubuntu-1804-general
128-
OSVmImage: MMSUbuntu18.04
129-
TestType: "node"
130-
DependencyVersion: max
131-
NodeTestVersion: "$(NodeVersion)"
132-
TestResultsFiles: "**/test-results.xml"
133-
MinVersion_Node:
134-
Pool: azsdk-pool-mms-ubuntu-1804-general
135-
OSVmImage: MMSUbuntu18.04
136-
TestType: "node"
137-
DependencyVersion: min
138-
NodeTestVersion: "$(NodeVersion)"
139-
TestResultsFiles: "**/test-results.xml"
140-
141-
# Add matrix entry for same dep testing
142-
${{ if eq(parameters.TestSame, 'true') }}:
143-
SameVersion_Node:
144-
Pool: azsdk-pool-mms-ubuntu-1804-general
145-
OSVmImage: MMSUbuntu18.04
146-
TestType: "node"
147-
DependencyVersion: same
148-
NodeTestVersion: "$(NodeVersion)"
149-
TestResultsFiles: "**/test-results.xml"
150-
151-
# Add matrix entry for canary testing
152-
${{ if eq(parameters.TestCanary, 'true') }}:
153-
CanaryTest_Node:
154-
Pool: azsdk-pool-mms-ubuntu-1804-general
155-
OSVmImage: MMSUbuntu18.04
156-
TestType: "node"
157-
NodeTestVersion: "$(NodeVersion)"
158-
TestResultsFiles: "**/test-results.xml"
159-
SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources-preview)
160-
ResourceGroupLocation: ${{ parameters.ResourceGroupLocationCanary }}
53+
value: '@{}'
16154

16255
pool:
16356
name: $(Pool)
16457
vmImage: $(OSVmImage)
16558

16659
timeoutInMinutes: ${{ parameters.TimeoutInMinutes }}
16760

61+
${{ if eq(parameters.UsePlatformContainer, 'true') }}:
62+
container: $[ variables['Container'] ]
63+
16864
steps:
16965
- template: ../steps/common.yml
17066

17167
- template: /eng/common/pipelines/templates/steps/verify-agent-os.yml
17268
parameters:
17369
AgentImage: $(OSVmImage)
17470

175-
- ${{ if ne(parameters.ResourceServiceDirectory, '') }}:
71+
- ${{ if ne(parameters.ServiceDirectory, '') }}:
17672
- template: /eng/common/TestResources/deploy-test-resources.yml
17773
parameters:
178-
ServiceDirectory: "${{ parameters.ResourceServiceDirectory }}"
179-
SubscriptionConfiguration: $(SubscriptionConfiguration)
180-
Location: $(ResourceGroupLocation)
74+
${{ if or(parameters.Location, parameters.CloudConfig.Location) }}:
75+
Location: ${{ coalesce(parameters.Location, parameters.CloudConfig.Location) }}
76+
ServiceDirectory: '${{ parameters.ServiceDirectory }}'
77+
SubscriptionConfiguration: ${{ parameters.CloudConfig.SubscriptionConfiguration }}
18178
ArmTemplateParameters: $(ArmTemplateParameters)
18279

18380
- script: |
@@ -196,7 +93,7 @@ jobs:
19693
node common/scripts/install-run-rush.js build:test -t "${{parameters.PackageName}}" --verbose -p max
19794
displayName: "Build test assets"
19895
condition: and(succeededOrFailed(),eq(variables['DependencyVersion'],''))
199-
96+
20097
- script: |
20198
npm install
20299
node index.js --artifact-name "${{parameters.PackageName}}" --version-type $(DependencyVersion) --source-dir "$(Build.SourcesDirectory)" --test-folder "test/public"
@@ -216,8 +113,7 @@ jobs:
216113
workingDirectory: $(PackageTestPath)
217114
condition: and(succeededOrFailed(),ne(variables['DependencyVersion'],''))
218115
219-
- ${{if ne(parameters.PreIntegrationSteps, '')}}:
220-
- template: ../steps/${{parameters.PreIntegrationSteps}}.yml
116+
- ${{ parameters.PreSteps }}
221117

222118
- pwsh: |
223119
npm install
@@ -247,8 +143,7 @@ jobs:
247143
TEST_MODE: "live"
248144
${{ insert }}: ${{ parameters.EnvVars }}
249145
250-
- ${{if ne(parameters.PostIntegrationSteps, '')}}:
251-
- template: ../steps/${{parameters.PostIntegrationSteps}}.yml
146+
- ${{ parameters.PostSteps }}
252147

253148
- script: |
254149
node common/scripts/npm-run-project.js "${{parameters.PackageName}}" execute:samples
@@ -258,11 +153,11 @@ jobs:
258153
${{ insert }}: ${{ parameters.EnvVars }}
259154
condition: and(succeeded(),eq(variables['TestType'],'sample'))
260155
261-
- ${{ if ne(parameters.ResourceServiceDirectory, '') }}:
156+
- ${{ if ne(parameters.ServiceDirectory, '') }}:
262157
- template: /eng/common/TestResources/remove-test-resources.yml
263158
parameters:
264-
ServiceDirectory: "${{ parameters.ResourceServiceDirectory }}"
265-
SubscriptionConfiguration: $(SubscriptionConfiguration)
159+
ServiceDirectory: "${{ parameters.ServiceDirectory }}"
160+
SubscriptionConfiguration: '${{ parameters.CloudConfig.SubscriptionConfiguration }}'
266161

267162
- task: PublishCodeCoverageResults@1
268163
displayName: "Publish NodeJs Code Coverage to DevOps"
@@ -302,17 +197,12 @@ jobs:
302197
- task: PublishTestResults@2
303198
inputs:
304199
searchFolder: "$(System.DefaultWorkingDirectory)/sdk"
305-
testResultsFiles: "**/test-results.xml"
306-
testRunTitle: "$(OSName) - NodeJS - Integration Tests - [Node $(NodeTestVersion)]"
307-
condition: and(always(), eq(variables['TestType'], 'node'))
308-
displayName: "Publish NodeJS integration test results"
309-
310-
# It's important for performance to pass "sdk" as "searchFolder" to avoid looking under root "node_modules".
311-
# PublishTestResults.searchFolder only supports absolute paths, not relative.
312-
- task: PublishTestResults@2
313-
inputs:
314-
searchFolder: "$(System.DefaultWorkingDirectory)/sdk"
315-
testResultsFiles: "**/test-results.browser.xml"
316-
testRunTitle: "$(OSName) - Browser - Integration Tests - [Node $(NodeTestVersion)]"
317-
condition: and(always(), eq(variables['TestType'], 'browser'))
318-
displayName: "Publish browser integration test results"
200+
testResultsFiles: "$(TestResultsFiles)"
201+
testRunTitle: "$(OSName) - $(TestType) - Integration Tests - [Node $(NodeTestVersion)]"
202+
condition: >
203+
and(
204+
always(),
205+
ne(variables['TestResultsFiles'], ''),
206+
or(eq(variables['TestType'], 'node'), eq(variables['TestType'], 'browser'))
207+
)
208+
displayName: "Publish $(TestType) integration test results"
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
parameters:
2+
- name: PackageName
3+
type: string
4+
default: ""
5+
- name: ServiceDirectory
6+
type: string
7+
default: ""
8+
- name: EnvVars
9+
type: object
10+
default: {}
11+
- name: MaxParallel
12+
type: number
13+
default: 0
14+
- name: TimeoutInMinutes
15+
type: number
16+
default: 0
17+
- name: PublishCodeCoverage
18+
type: boolean
19+
default: false
20+
- name: Location
21+
type: string
22+
default: ""
23+
- name: Clouds
24+
type: string
25+
default: 'Public'
26+
- name: SupportedClouds
27+
type: string
28+
default: 'Public,Canary'
29+
- name: UnsupportedClouds
30+
type: string
31+
default: ''
32+
- name: PreSteps
33+
type: object
34+
default: []
35+
- name: PostSteps
36+
type: object
37+
default: []
38+
- name: CloudConfig
39+
type: object
40+
default:
41+
Public:
42+
SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources)
43+
Preview:
44+
SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources-preview)
45+
Canary:
46+
SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources)
47+
Location: 'centraluseuap'
48+
UsGov:
49+
SubscriptionConfiguration: $(sub-config-gov-test-resources)
50+
China:
51+
SubscriptionConfiguration: $(sub-config-cn-test-resources)
52+
- name: MatrixConfigs
53+
type: object
54+
default:
55+
- Name: Js_live_test_base
56+
Path: eng/pipelines/templates/stages/platform-matrix.json
57+
Selection: sparse
58+
GenerateVMJobs: true
59+
- name: AdditionalMatrixConfigs
60+
type: object
61+
default: []
62+
- name: MatrixFilters
63+
type: object
64+
default: []
65+
66+
stages:
67+
- ${{ each cloud in parameters.CloudConfig }}:
68+
# TODO: re-enable tests-weekly allow filter once sovereign cloud live tests are stable: https://github.com/Azure/azure-sdk/issues/2074
69+
# Run all clouds by default for weekly test pipeline, except for clouds specifically unsupported by the calling pipeline
70+
# - ${{ if or(contains(parameters.Clouds, cloud.key), contains(variables['Build.DefinitionName'], 'tests-weekly')) }}:
71+
- ${{ if or(contains(parameters.Clouds, cloud.key), and(contains(variables['Build.DefinitionName'], 'tests-weekly'), contains(parameters.SupportedClouds, cloud.key))) }}:
72+
- ${{ if not(contains(parameters.UnsupportedClouds, cloud.key)) }}:
73+
- stage: ${{ cloud.key }}
74+
dependsOn: []
75+
jobs:
76+
- template: /eng/common/pipelines/templates/jobs/archetype-sdk-tests-generate.yml
77+
parameters:
78+
JobTemplatePath: /eng/pipelines/templates/jobs/archetype-sdk-integration.yml
79+
AdditionalParameters:
80+
PackageName: ${{ parameters.PackageName }}
81+
ServiceDirectory: ${{ parameters.ServiceDirectory }}
82+
EnvVars: ${{ parameters.EnvVars }}
83+
MaxParallel: ${{ parameters.MaxParallel }}
84+
TimeoutInMinutes: ${{ parameters.TimeoutInMinutes }}
85+
PublishCodeCoverage: ${{ parameters.PublishCodeCoverage }}
86+
PreSteps:
87+
- ${{ parameters.PreSteps }}
88+
PostSteps:
89+
- ${{ parameters.PostSteps }}
90+
MatrixConfigs:
91+
# Enumerate platforms and additional platforms based on supported clouds (sparse platform<-->cloud matrix).
92+
- ${{ each config in parameters.MatrixConfigs }}:
93+
- ${{ config }}
94+
- ${{ each config in parameters.AdditionalMatrixConfigs }}:
95+
- ${{ config }}
96+
MatrixFilters:
97+
- ${{ each cloudFilter in cloud.value.MatrixFilters }}:
98+
- ${{ cloudFilter }}
99+
- ${{ parameters.MatrixFilters }}
100+
CloudConfig:
101+
SubscriptionConfiguration: ${{ cloud.value.SubscriptionConfiguration }}
102+
Location: ${{ coalesce(parameters.Location, cloud.value.Location) }}
103+
Cloud: ${{ cloud.key }}

0 commit comments

Comments
 (0)