-
Notifications
You must be signed in to change notification settings - Fork 329
Expand file tree
/
Copy pathtest-sqlclientmanual-job.yml
More file actions
198 lines (162 loc) · 7.8 KB
/
test-sqlclientmanual-job.yml
File metadata and controls
198 lines (162 loc) · 7.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
#################################################################################
# Licensed to the .NET Foundation under one or more agreements. #
# The .NET Foundation licenses this file to you under the MIT license. #
# See the LICENSE file in the project root for more information. #
#################################################################################
parameters:
# General Parameters =====================================================
# Configuration with which to build the packages and execute the tests.
- name: buildConfiguration
type: string
values:
- Debug
- Release
# Suffix to append to the package version to indicate it is a pre-release/development build.
- name: buildSuffix
type: string
# Dotnet CLI verbosity level.
- name: dotnetVerbosity
type: string
default: normal
values:
- quiet
- minimal
- normal
- detailed
- diagnostic
# Name of the stage that generated the SA password
- name: stageNameSecrets
type: string
# Platform Parameters ====================================================
# Display name of the platform. This will be formatted into the job's official name as well as
# the display name for the job. As such, only alphanumeric and _ characters are permitted.
- name: platformDisplayName
type: string
# TFM name of the version of dotnet to run this test with.
- name: platformDotnet
type: string
# Name of the image in the customized ADO pool to use to execute this job.
- name: platformImage
type: string
# General name of the operating system that will be used to execute the job.
# Note: This is used at compile time to determine which SQL Server setup steps to use. As such,
# this cannot be replaced with the agent's operating system, as this value is only available
# at runtime.
- name: platformOperatingSystem
type: string
values:
- Windows
- Linux
# Name of the pool to use for jobs that require customized VM images.
- name: poolName
type: string
# Test Configuration Parameters ==========================================
# Azure Key Vault tenant ID that will be set in the config.json file.
- name: azureKeyVaultTenantId
type: string
# Azure Key Vault URL that will be set in the config.json file.
- name: azureKeyVaultUrl
type: string
# Display name for the config being used for this execution of the manual jobs. This will be used
# for the job name, so it may only contain alphanumeric and '_' characters.
- name: configDisplayName
type: string
# Connection string using named pipes that will be set in the config.json file.
- name: connectionStringNp
type: string
# Connection string using TCP that will be set in the config.json file.
- name: connectionStringTcp
type: string
# Path to use for file stream tests, this value will be stored in the config.json file.
- name: fileStreamDirectory
type: string
# Whether the server that tests will be executed against is local to the job agent. If `true`
# server configuration steps will be executed prior to running the tests.
- name: isLocalServer
type: boolean
# Name of the local DB application name for localdb tests, this value will be stored in the
# config.json
- name: localDbAppName
type: string
# Name of the local DB shared instance name for localdb tests, this value will be stored in the
# config.json
- name: localDbSharedInstanceName
type: string
# Manual test set to execute.
- name: testSet
type: string
jobs:
- job: "test_${{ parameters.platformDisplayName }}_${{ parameters.configDisplayName }}_${{ parameters.testSet }}_sqlclient_manual"
displayName: "sqlclient_manual_${{ parameters.configDisplayName}}_${{ parameters.testSet }}_${{ parameters.platformDisplayName }}"
pool:
name: ${{ parameters.poolName }}
demands:
- imageOverride -equals ${{ parameters.platformImage }}
variables:
# Bring the generated SA password from the secrets stage into scope for this test stage.
# Note: Because this is set at runtime, it must be referenced as `$(saPassword)`.
- name: saPassword
value: $[stageDependencies.${{ parameters.stageNameSecrets }}.secrets_job.outputs['SaPassword.Value']]
steps:
# Install dotnet and the runtime that will run the tests (if it is not netframework)
- template: /eng/pipelines/common/steps/install-dotnet.yml@self
parameters:
${{ if not(contains(parameters.platformDotnet, 'net4')) }}:
runtimes:
- "${{ replace(parameters.platformDotnet, 'net', '') }}.x"
# Restore dotnet tools
- template: /eng/pipelines/common/steps/restore-dotnet-tools.yml@self
# Configure the local SQL Server instance
- ${{ if eq(parameters.isLocalServer, true) }}:
- template: /eng/pipelines/pr/steps/configure-sqlserver-step.yml@self
parameters:
fileStreamDirectory: ${{ parameters.fileStreamDirectory }}
operatingSystem: ${{ parameters.platformOperatingSystem }}
saPassword: $(saPassword)
# Assign the generated SA password to the $Password field. This will allow $(Password) to be
# be replaced in connection strings with whatever set in the secrets stage.
- pwsh: |
$password = "$(saPassword)"
Write-Host "##vso[task.setvariable variable=Password;isSecret=true]$password"
displayName: Set Connection String Password
# Write configuration information to the config.json file.
- pwsh: |
# Read existing default configuration from file
$defaultConfigPath = "$(REPO_ROOT)/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/config.default.json"
$configDirectory = "$(Agent.TempDirectory)/mds-config"
$configPath = Join-Path $configDirectory "config.json"
$config = Get-Content -Raw $defaultConfigPath | ConvertFrom-Json
# Update the config values
$config.TCPConnectionString = "${{ parameters.connectionStringTcp }}"
$config.NPConnectionString = "${{ parameters.connectionStringNp }}"
$config.AzureKeyVaultURL = "${{ parameters.azureKeyVaultUrl }}"
$config.AzureKeyVaultTenantId = "${{ parameters.azureKeyVaultTenantId }}"
$config.LocalDbAppName = "${{ parameters.localDbAppName }}"
$config.LocalDbSharedInstanceName = "${{ parameters.localDbSharedInstanceName }}"
$config.ManagedIdentitySupported = $true
$config.SupportsIntegratedSecurity = $false
if ("${{ parameters.platformOperatingSystem }}" -eq "Windows") {
$config.FileStreamDirectory = "${{ parameters.fileStreamDirectory }}"
} else {
$config.FileStreamDirectory = ""
}
# Write config object to config file
New-Item -ItemType Directory -Force -Path $configDirectory | Out-Null
$config | ConvertTo-Json | Set-Content $configPath
# Set generated config file path to environment variable
Write-Host "##vso[task.setvariable variable=TEST_MDS_CONFIG]$configPath"
displayName: 'Generate manual test config'
# Execute TestSqlClientManual target from build.proj
- task: DotNetCoreCLI@2
displayName: 'Test: SqlClientManual ${{ parameters.testSet }}'
inputs:
command: build
projects: build.proj
verbosity: ${{ parameters.dotnetVerbosity }}
arguments: >-
-t:TestSqlClientManual
-p:Configuration=${{ parameters.buildConfiguration }}
-p:BuildNumber='$(Build.BuildNumber)'
-p:BuildSuffix='${{ parameters.buildSuffix }}'
-p:TestFramework=${{ parameters.platformDotnet }}
-p:TestSet=${{ parameters.testSet }}