|
| 1 | +#################################################################################################### |
| 2 | +# Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this |
| 3 | +# file to you under the MIT license. See the LICENSE file in the project root for more information. |
| 4 | +#################################################################################################### |
| 5 | + |
| 6 | +# This job builds and runs the SqlClient Manual test suite against an Azure SQL Managed Instance. |
| 7 | +# The SqlClient NuGet packages produced by the sqlclient-ci-package pipeline are downloaded into the |
| 8 | +# local NuGet feed (packages/) and the test project is built in "Package" mode |
| 9 | +# (ReferenceType=Package) against the exact package versions produced by that pipeline. |
| 10 | +# |
| 11 | +# The Managed Instance TCP connection string is provided by the "ADO Test Configuration Properties" |
| 12 | +# variable group (SQL_MI_TCP_CONN_STRING). This job runs on the Managed-Instance-pool, whose agents |
| 13 | +# have network line-of-sight to the Managed Instance. |
| 14 | +# |
| 15 | +# This template defines a job named 'managed_instance_tests_job_<suffix>' that can be depended on by |
| 16 | +# downstream jobs. |
| 17 | + |
| 18 | +parameters: |
| 19 | + |
| 20 | + # The type of build to produce (Debug or Release). |
| 21 | + - name: buildConfiguration |
| 22 | + type: string |
| 23 | + values: |
| 24 | + - Debug |
| 25 | + - Release |
| 26 | + |
| 27 | + # True to enable debugging steps. |
| 28 | + - name: debug |
| 29 | + type: boolean |
| 30 | + |
| 31 | + # The job's display name. |
| 32 | + - name: displayName |
| 33 | + type: string |
| 34 | + |
| 35 | + # The verbosity level for the dotnet CLI commands. |
| 36 | + - name: dotnetVerbosity |
| 37 | + type: string |
| 38 | + values: |
| 39 | + - quiet |
| 40 | + - minimal |
| 41 | + - normal |
| 42 | + - detailed |
| 43 | + - diagnostic |
| 44 | + |
| 45 | + # The suffix to append to the job name. |
| 46 | + - name: jobNameSuffix |
| 47 | + type: string |
| 48 | + |
| 49 | + # The OS to build and run the tests for. |
| 50 | + - name: operatingSystem |
| 51 | + type: string |
| 52 | + values: |
| 53 | + - Linux |
| 54 | + - Windows |
| 55 | + |
| 56 | + # The .NET runtime (TFM) to build and run the tests for. |
| 57 | + - name: runtime |
| 58 | + type: string |
| 59 | + |
| 60 | + # The timeout, in minutes, for this job. |
| 61 | + - name: timeout |
| 62 | + type: number |
| 63 | + default: 90 |
| 64 | + |
| 65 | + # True to use managed SNI on Windows. Ignored on non-Windows, where managed SNI is always used. |
| 66 | + - name: useManagedSNI |
| 67 | + type: boolean |
| 68 | + default: false |
| 69 | + |
| 70 | + # The pool VM image to use. The Managed-Instance-pool must provide an image with this name. |
| 71 | + # |
| 72 | + # NOTE: This value is evaluated at template-expansion (compile) time to select the pool image, so |
| 73 | + # it must be a literal and must not contain any runtime expressions (e.g. $(...) macros or |
| 74 | + # $[...] runtime expressions). |
| 75 | + - name: vmImage |
| 76 | + type: string |
| 77 | + |
| 78 | +jobs: |
| 79 | + - job: managed_instance_tests_job_${{ parameters.jobNameSuffix }} |
| 80 | + displayName: ${{ parameters.displayName }} |
| 81 | + timeoutInMinutes: ${{ parameters.timeout }} |
| 82 | + |
| 83 | + workspace: |
| 84 | + clean: all |
| 85 | + |
| 86 | + variables: |
| 87 | + |
| 88 | + # Import the variable group that provides the Managed Instance TCP connection string |
| 89 | + # (SQL_MI_TCP_CONN_STRING) and other test configuration. |
| 90 | + - group: ADO Test Configuration Properties |
| 91 | + |
| 92 | + # The Managed-Instance-pool agents have network line-of-sight to the Managed Instance. |
| 93 | + pool: |
| 94 | + name: Managed-Instance-pool |
| 95 | + demands: |
| 96 | + - imageOverride -equals ${{ parameters.vmImage }} |
| 97 | + |
| 98 | + steps: |
| 99 | + |
| 100 | + # Check out the repo and align the working-tree source with the commit that built the upstream |
| 101 | + # sqlclient-ci-package artifacts, so the test projects compile against the matching API surface. |
| 102 | + - template: /eng/pipelines/common/steps/align-source-with-upstream-step.yml@self |
| 103 | + |
| 104 | + # Download the SqlClient driver packages published by the triggering sqlclient-ci-package |
| 105 | + # pipeline, stage them into the local NuGet feed, and resolve their exact versions into the |
| 106 | + # sqlClient/sqlServer/abstractions/logging/azure PackageVersion variables. |
| 107 | + # |
| 108 | + # sqlServerVersionOverride pins Microsoft.SqlServer.Server to the released stable 1.0.0 to |
| 109 | + # avoid an NU1605 downgrade against the >= 1.0.0 dependency from Microsoft.SqlServer.Types. |
| 110 | + - template: /eng/pipelines/common/steps/download-driver-packages-step.yml@self |
| 111 | + parameters: |
| 112 | + sqlServerVersionOverride: 1.0.0 |
| 113 | + |
| 114 | + # Install the .NET SDK and the runtimes needed to execute the test frameworks. |
| 115 | + - template: /eng/pipelines/common/steps/install-dotnet.yml@self |
| 116 | + parameters: |
| 117 | + debug: ${{ parameters.debug }} |
| 118 | + runtimes: [8.x, 9.x, 10.x] |
| 119 | + |
| 120 | + # Restore dotnet CLI tools (e.g. pwsh, apicompat) before building. |
| 121 | + - template: /eng/pipelines/common/steps/restore-dotnet-tools.yml@self |
| 122 | + |
| 123 | + # Authenticate with NuGet feeds so that upstream packages (e.g. runtime host packs) can be |
| 124 | + # fetched through the ADO Artifacts feed. |
| 125 | + - task: NuGetAuthenticate@1 |
| 126 | + displayName: Authenticate NuGet feeds |
| 127 | + |
| 128 | + # Write the config.jsonc file pointing the tests at the Managed Instance. Integrated security |
| 129 | + # and managed identity are not supported against the Managed Instance, and IsManagedInstance |
| 130 | + # opts the test suite into Managed-Instance-specific behavior. |
| 131 | + - template: /eng/pipelines/common/templates/steps/update-config-file-step.yml@self |
| 132 | + parameters: |
| 133 | + debug: ${{ parameters.debug }} |
| 134 | + # The Managed Instance connection strings carry their own credentials, so no local SA |
| 135 | + # password is used here; pass an empty string for the required saPassword parameter. |
| 136 | + saPassword: '' |
| 137 | + TCPConnectionString: $(SQL_MI_TCP_CONN_STRING) |
| 138 | + # Azure SQL Managed Instance exposes TDS over TCP and does not support Named Pipes. |
| 139 | + NPConnectionString: '' |
| 140 | + SupportsIntegratedSecurity: false |
| 141 | + ManagedIdentitySupported: false |
| 142 | + IsManagedInstance: true |
| 143 | + UseManagedSNIOnWindows: ${{ parameters.useManagedSNI }} |
| 144 | + |
| 145 | + # Ensure the TestResults directory exists so publish steps don't fail when tests are skipped |
| 146 | + # due to a setup failure. |
| 147 | + - pwsh: New-Item -ItemType Directory -Path TestResults -Force | Out-Null |
| 148 | + displayName: Create TestResults Directory |
| 149 | + |
| 150 | + # Gate: record that all setup steps completed successfully. Test steps condition on this |
| 151 | + # variable so they are skipped when setup fails, yet remain independent of each other's |
| 152 | + # results. |
| 153 | + - pwsh: Write-Host '##vso[task.setvariable variable=setupSucceeded]true' |
| 154 | + displayName: 'Gate: Mark Setup Succeeded' |
| 155 | + |
| 156 | + # Run ManualTests sets 1, 2, and 3 against the Managed Instance using the exact upstream |
| 157 | + # package versions. UnitTests and FunctionalTests do not exercise the configured instance. |
| 158 | + # Set AE is omitted because this pipeline does not provision its separate AE, enclave, and AKV |
| 159 | + # resources. build.proj's default filter also excludes failing, flaky, and interactive tests. |
| 160 | + - task: DotNetCoreCLI@2 |
| 161 | + displayName: Run Managed Instance Tests |
| 162 | + condition: and(eq(variables['setupSucceeded'], 'true'), succeededOrFailed()) |
| 163 | + inputs: |
| 164 | + command: build |
| 165 | + projects: build.proj |
| 166 | + arguments: >- |
| 167 | + --verbosity ${{ parameters.dotnetVerbosity }} |
| 168 | + -t:TestSqlClientManual |
| 169 | + -p:TestFramework=${{ parameters.runtime }} |
| 170 | + -p:TestSet=123 |
| 171 | + -p:ReferenceType=Package |
| 172 | + -p:Configuration=${{ parameters.buildConfiguration }} |
| 173 | + -p:PackageVersionAbstractions=$(abstractionsPackageVersion) |
| 174 | + -p:PackageVersionLogging=$(loggingPackageVersion) |
| 175 | + -p:PackageVersionSqlClient=$(sqlClientPackageVersion) |
| 176 | + -p:PackageVersionSqlServer=$(sqlServerPackageVersion) |
| 177 | + -p:TestResultsFolderPath=TestResults |
| 178 | + retryCountOnTaskFailure: 2 |
| 179 | + |
| 180 | + - template: /eng/pipelines/common/templates/steps/publish-test-results-step.yml@self |
| 181 | + parameters: |
| 182 | + debug: ${{ parameters.debug }} |
| 183 | + targetFramework: ${{ parameters.runtime }} |
| 184 | + operatingSystem: ${{ parameters.operatingSystem }} |
| 185 | + buildConfiguration: ${{ parameters.buildConfiguration }} |
0 commit comments