diff --git a/eng/pipelines/pr/jobs/test-buildproj-job.yml b/eng/pipelines/pr/jobs/test-buildproj-job.yml index 0b051bf50e..bc931397bb 100644 --- a/eng/pipelines/pr/jobs/test-buildproj-job.yml +++ b/eng/pipelines/pr/jobs/test-buildproj-job.yml @@ -73,17 +73,26 @@ jobs: - imageOverride -equals ${{ parameters.platformImage }} steps: - # Install the version of the dotnet runtime we will use to execute the test target. - - template: /eng/pipelines/pr/steps/install-dotnet.yml@self + # 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: - runtimeVersion: ${{ parameters.platformDotnet }} + ${{ if not(contains(parameters.platformDotnet, 'net4')) }}: + runtimes: + - "${{ replace(parameters.platformDotnet, 'net', '') }}.x" - # Execute the test target - - template: /eng/pipelines/pr/steps/test-buildproj-step.yml - parameters: - buildConfiguration: ${{ parameters.buildConfiguration }} - buildSuffix: ${{ parameters.buildSuffix }} + # Restore dotnet tools + - template: /eng/pipelines/common/steps/restore-dotnet-tools.yml@self - packageShortName: ${{ parameters.packageShortName }} - testFramework: ${{ parameters.platformDotnet }} - testProject: ${{ parameters.testProject }} + # Execute the test target + - task: DotNetCoreCLI@2 + displayName: 'Test: ${{ parameters.packageShortName }}${{ parameters.testProject }}' + inputs: + command: build + projects: build.proj + verbosity: detailed + arguments: >- + -t:Test${{ parameters.packageShortName }}${{ parameters.testProject }} + -p:Configuration=${{ parameters.buildConfiguration }} + -p:BuildNumber='$(Build.BuildNumber)' + -p:BuildSuffix='${{ parameters.buildSuffix }}' + -p:TestFramework=${{ parameters.platformDotnet }} diff --git a/eng/pipelines/pr/jobs/test-sqlclientmanual-job.yml b/eng/pipelines/pr/jobs/test-sqlclientmanual-job.yml index ff81d983a3..62e026ca3c 100644 --- a/eng/pipelines/pr/jobs/test-sqlclientmanual-job.yml +++ b/eng/pipelines/pr/jobs/test-sqlclientmanual-job.yml @@ -59,6 +59,11 @@ parameters: - 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 @@ -71,6 +76,11 @@ parameters: - 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 @@ -81,9 +91,13 @@ parameters: - name: localDbSharedInstanceName type: string + # Manual test set to execute. + - name: testSet + type: string + jobs: - - job: "test_${{ parameters.platformDisplayName }}_sqlclient_manual" - displayName: "sqlclient_manual_${{ parameters.platformDisplayName }}" + - job: "test_${{ parameters.platformDisplayName }}_${{ parameters.configDisplayName }}_${{ parameters.testSet }}_sqlclient_manual" + displayName: "sqlclient_manual_${{ parameters.configDisplayName}}_${{ parameters.testSet }}_${{ parameters.platformDisplayName }}" pool: name: ${{ parameters.poolName }} @@ -97,17 +111,23 @@ jobs: value: $[stageDependencies.${{ parameters.stageNameSecrets }}.secrets_job.outputs['SaPassword.Value']] steps: - # Install the version of the dotnet runtime we will use to execute the test target. - - template: /eng/pipelines/pr/steps/install-dotnet.yml@self + # 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: - runtimeVersion: ${{ parameters.platformDotnet }} + ${{ 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 - - template: /eng/pipelines/pr/steps/configure-sqlserver-step.yml@self - parameters: - fileStreamDirectory: ${{ parameters.fileStreamDirectory }} - operatingSystem: ${{ parameters.platformOperatingSystem }} - saPassword: $(saPassword) + - ${{ 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. @@ -149,12 +169,17 @@ jobs: displayName: 'Generate manual test config' # Execute TestSqlClientManual target from build.proj - - template: /eng/pipelines/pr/steps/test-buildproj-step.yml - parameters: - buildConfiguration: ${{ parameters.buildConfiguration }} - buildSuffix: ${{ parameters.buildSuffix }} - - packageShortName: "SqlClient" - testFramework: ${{ parameters.platformDotnet }} - testProject: "Manual" + - task: DotNetCoreCLI@2 + displayName: 'Test: SqlClientManual ${{ parameters.testSet }}' + inputs: + command: build + projects: build.proj + verbosity: detailed + arguments: >- + -t:TestSqlClientManual + -p:Configuration=${{ parameters.buildConfiguration }} + -p:BuildNumber='$(Build.BuildNumber)' + -p:BuildSuffix='${{ parameters.buildSuffix }}' + -p:TestFramework=${{ parameters.platformDotnet }} + -p:TestSet=${{ parameters.testSet }} diff --git a/eng/pipelines/pr/stages/pack-stage.yml b/eng/pipelines/pr/stages/pack-stage.yml index c0a135e246..5473027731 100644 --- a/eng/pipelines/pr/stages/pack-stage.yml +++ b/eng/pipelines/pr/stages/pack-stage.yml @@ -50,8 +50,11 @@ stages: vmImage: 'ubuntu-latest' steps: - # Install dotnet SDK and restore tools - - template: /eng/pipelines/pr/steps/install-dotnet.yml@self + # Install dotnet + - template: /eng/pipelines/common/steps/install-dotnet.yml@self + + # Restore dotnet tools + - template: /eng/pipelines/common/steps/restore-dotnet-tools.yml@self # ################################################################ # Build/Pack Microsoft.Data.SqlClient diff --git a/eng/pipelines/pr/stages/test-stages.yml b/eng/pipelines/pr/stages/test-stages.yml index f2ffbc09cf..9a2a862c9f 100644 --- a/eng/pipelines/pr/stages/test-stages.yml +++ b/eng/pipelines/pr/stages/test-stages.yml @@ -156,31 +156,62 @@ stages: azureKeyVaultTenantId: ${{ parameters.manualTestAzureKeyVaultTenantId }} azureKeyVaultUrl: ${{ parameters.manualTestAzureKeyVaultUrl }} + configDisplayName: "localhost" connectionStringNp: ${{ parameters.manualTestConnectionStringNpLocalhost }} connectionStringTcp: ${{ parameters.manualTestConnectionStringTcpLocalhost }} fileStreamDirectory: ${{ parameters.manualTestFileStreamDirectory }} + isLocalServer: true localDbAppName: ${{ parameters.manualTestLocalDbAppName }} localDbSharedInstanceName: ${{ parameters.manualTestLocalDbSharedInstanceName }} + testSet: "123" - # @TODO: -# # TestSqlClientManual - Azure -# - template: /eng/pipelines/pr/jobs/test-sqlclientmanual-job.yml@self -# parameters: -# buildConfiguration: ${{ parameters.buildConfiguration }} -# buildSuffix: ${{ parameters.buildSuffix }} -# platformDisplayName: ${{ platform.displayName }} -# platformDotnet: ${{ platform.dotnet }} -# platformImage: ${{ platform.image }} -# poolName: ${{ parameters.poolName }} -# -# azureKeyVaultTenantId: ${{ parameters.manualTestAzureKeyVaultTenantId }} -# azureKeyVaultUrl: ${{ parameters.manualTestAzureKeyVaultUrl }} -# connectionStringNp: ${{ parameters.manualTestConnectionStringNpAzure }} -# connectionStringTcp: ${{ parameters.manualTestConnectionStringTcpAzure }} -# fileStreamDirectory: ${{ parameters.manualTestFileStreamDirectory }} -# localDbAppName: ${{ parameters.manualTestLocalDbAppName }} -# localDbSharedInstanceName: ${{ parameters.manualTestLocalDbSharedInstanceName }} -# saPassword: $(manualTestSaPassword) + # TestSqlClientManual - Azure + - template: /eng/pipelines/pr/jobs/test-sqlclientmanual-job.yml@self + parameters: + buildConfiguration: ${{ parameters.buildConfiguration }} + buildSuffix: ${{ parameters.buildSuffix }} + stageNameSecrets: ${{ parameters.stageNameSecrets }} + + platformDisplayName: ${{ platform.displayName }} + platformDotnet: ${{ platform.dotnet }} + platformImage: ${{ platform.image }} + platformOperatingSystem: ${{ platform.operatingSystem }} + poolName: ${{ parameters.poolName }} + + azureKeyVaultTenantId: ${{ parameters.manualTestAzureKeyVaultTenantId }} + azureKeyVaultUrl: ${{ parameters.manualTestAzureKeyVaultUrl }} + configDisplayName: "azure" + connectionStringNp: ${{ parameters.manualTestConnectionStringNpAzure }} + connectionStringTcp: ${{ parameters.manualTestConnectionStringTcpAzure }} + fileStreamDirectory: ${{ parameters.manualTestFileStreamDirectory }} + isLocalServer: false + localDbAppName: ${{ parameters.manualTestLocalDbAppName }} + localDbSharedInstanceName: ${{ parameters.manualTestLocalDbSharedInstanceName }} + testSet: "123" + + # TestSqlClientManual - Localhost Always Encrypted + - template: /eng/pipelines/pr/jobs/test-sqlclientmanual-job.yml@self + parameters: + buildConfiguration: "Release" # AE tests are not stable enough to run in DEBUG mode (as of 5/29/26) + buildSuffix: ${{ parameters.buildSuffix }} + stageNameSecrets: ${{ parameters.stageNameSecrets }} + + platformDisplayName: ${{ platform.displayName }} + platformDotnet: ${{ platform.dotnet }} + platformImage: ${{ platform.image }} + platformOperatingSystem: ${{ platform.operatingSystem }} + poolName: ${{ parameters.poolName }} + + azureKeyVaultTenantId: ${{ parameters.manualTestAzureKeyVaultTenantId }} + azureKeyVaultUrl: ${{ parameters.manualTestAzureKeyVaultUrl }} + configDisplayName: "localhost_ae" + connectionStringNp: ${{ parameters.manualTestConnectionStringNpLocalhost }} + connectionStringTcp: ${{ parameters.manualTestConnectionStringTcpLocalhost }} + fileStreamDirectory: ${{ parameters.manualTestFileStreamDirectory }} + isLocalServer: true + localDbAppName: ${{ parameters.manualTestLocalDbAppName }} + localDbSharedInstanceName: ${{ parameters.manualTestLocalDbSharedInstanceName }} + testSet: "AE" # TestSqlClientUnit - template: /eng/pipelines/pr/jobs/test-buildproj-job.yml@self diff --git a/eng/pipelines/pr/steps/build-buildproj-step.yml b/eng/pipelines/pr/steps/build-buildproj-step.yml deleted file mode 100644 index 3e81edfbf4..0000000000 --- a/eng/pipelines/pr/steps/build-buildproj-step.yml +++ /dev/null @@ -1,46 +0,0 @@ -################################################################################# -# 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. # -################################################################################# - -# This collection of steps to build a project via the build.proj. This will execute the "Build*" -# target in build.proj, where * is the packageShortName provided in the parameters. -# -# Note: This differs from the onebranch build-buildproj-step.yml in that it does *not* strong-name -# sign the assemblies, it only builds in project reference mode, and as such it does not allow -# version parameters or dependencies to be provided. - -parameters: - - name: buildConfiguration - type: string - values: - - Debug - - Release - - - name: buildSuffix - type: string - - - name: packageShortName - type: string - values: - - Azure - - AkvProvider - - Abstractions - - Logging - - SqlClient - - SqlServer - -steps: - - task: DotNetCoreCLI@2 - displayName: 'build.proj - Build${{ parameters.packageShortName }}' - inputs: - command: build - projects: build.proj - arguments: >- - -t:Build${{ parameters.packageShortName }} - -p:Configuration=${{ parameters.buildConfiguration }} - -p:BuildNumber='$(Build.BuildNumber)' - -p:BuildSuffix='${{ parameters.buildSuffix }}' - - diff --git a/eng/pipelines/pr/steps/install-dotnet.yml b/eng/pipelines/pr/steps/install-dotnet.yml deleted file mode 100644 index fe1c8f7878..0000000000 --- a/eng/pipelines/pr/steps/install-dotnet.yml +++ /dev/null @@ -1,27 +0,0 @@ -################################################################################# -# 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. # -################################################################################# - -# This is a step to wrap the install-dotnet step for use in the PR pipeline. It will always install -# the SDK version specified in the global.json file, and if the runtime version specified does not -# begin with "net4" (ie, indicating netfx runtime is being used), the version will be passed in as -# part of the runtime parameters. -# -# This version chains into the common install-dotnet step to enable the pr pipeline to call a -# single step template and get the desired behavior without complexity. - -parameters: - - name: runtimeVersion - type: string - default: '' - -steps: - - template: /eng/pipelines/common/steps/install-dotnet.yml@self - parameters: - ${{ if and( not(eq(parameters.runtimeVersion, '' )), not(contains(parameters.runtimeVersion, 'net4')) ) }}: - runtimes: - - "${{ replace(parameters.runtimeVersion, 'net', '') }}.x" - - - template: /eng/pipelines/common/steps/restore-dotnet-tools.yml@self diff --git a/eng/pipelines/pr/steps/pack-buildproj-step.yml b/eng/pipelines/pr/steps/pack-buildproj-step.yml index 6b2980cbb4..f947bafb0e 100644 --- a/eng/pipelines/pr/steps/pack-buildproj-step.yml +++ b/eng/pipelines/pr/steps/pack-buildproj-step.yml @@ -46,7 +46,7 @@ parameters: steps: - task: DotNetCoreCLI@2 - displayName: 'build.proj - Build${{ parameters.packageShortName }}' + displayName: 'Pack: ${{ parameters.packageShortName }}' condition: ${{ parameters.condition }} inputs: command: build diff --git a/eng/pipelines/pr/steps/test-buildproj-step.yml b/eng/pipelines/pr/steps/test-buildproj-step.yml deleted file mode 100644 index 5309e7ef96..0000000000 --- a/eng/pipelines/pr/steps/test-buildproj-step.yml +++ /dev/null @@ -1,59 +0,0 @@ -################################################################################# -# 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 to use to build the project. - - name: buildConfiguration - type: string - values: - - Debug - - Release - - # Suffix to apply to the generated packages such that the package will be considered a prerelease - # version. The resulting package version will look like: `1.2.3-suffix888.1` where 1.2.3 is the - # default version specified in Versions.props, suffix is this parameter, and 888.1 is the build - # number for the currently executing build. - - name: buildSuffix - type: string - - # Test Parameters ======================================================== - - # Package/project to test. - - name: packageShortName - type: string - values: - - Azure - - AkvProvider - - Abstractions - - Logging - - SqlClient - - SqlServer - - - name: testFramework - type: string - - # If the project to test has multiple projects supported by build.proj, use this optional - # parameter to specify the project to execute. This will be appended to Test{PackageShortName} to - # generate the target to execute. See build.proj for supported targets. - - name: testProject - type: string - default: '' - -steps: - - task: DotNetCoreCLI@2 - displayName: 'build.proj - Test${{ parameters.packageShortName }}${{ parameters.testProject }}' - inputs: - command: build - projects: build.proj - verbosity: detailed - arguments: >- - -t:Test${{ parameters.packageShortName }}${{ parameters.testProject }} - -p:Configuration=${{ parameters.buildConfiguration }} - -p:BuildNumber='$(Build.BuildNumber)' - -p:BuildSuffix='${{ parameters.buildSuffix }}' - -p:TestFramework=${{ parameters.testFramework }} diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/BulkCopy/CopyAllFromReaderConnectionCloseOnEventAsync.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/BulkCopy/CopyAllFromReaderConnectionCloseOnEventAsync.cs index 89b354c3b2..8cbdc84d2f 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/BulkCopy/CopyAllFromReaderConnectionCloseOnEventAsync.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/BulkCopy/CopyAllFromReaderConnectionCloseOnEventAsync.cs @@ -12,7 +12,8 @@ namespace Microsoft.Data.SqlClient.ManualTests.BulkCopy { public class CopyAllFromReaderConnectionClosedOnEventAsync { - [ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))] + [Trait("Category", "flaky")] // Hangs and crashes on occasion + [ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureServer))] public void Test() { string srcConstr = DataTestUtility.TCPConnectionString; diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/SqlVariantParameterTests.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/SqlVariantParameterTests.cs index 5f47576baa..0bb4b8e7e9 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/SqlVariantParameterTests.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/SqlVariantParameterTests.cs @@ -31,7 +31,7 @@ public SqlVariantParameterTests() // which uses CultureInfo.CurrentCulture.LCID. On Linux, this LCID is 127 // (InvariantCulture), which is not a valid SQL Server collation and causes // "invalid TDS collation" errors in the TVP code path. - // SqlClient doesn't support invariant mode: + // SqlClient doesn't support invariant mode: // https://github.com/dotnet/SqlClient/issues/3742 _previousCulture = Thread.CurrentThread.CurrentCulture; Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); @@ -258,6 +258,7 @@ public void SqlType_BulkCopyFromDataRow_RoundTripsCorrectly(object paramValue, s /// /// Round trip sql_variant value using TVP with a SqlMetaData/SqlDataRecord source. /// + [Trait("Category", "flaky")] // Doesn't work well on Azure. [ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureSynapse))] [MemberData(nameof(SqlTypeTestData), DisableDiscoveryEnumeration = true)] public void SqlType_TvpFromSqlMetaData_RoundTripsCorrectly(object paramValue, string expectedTypeName, string expectedBaseTypeName) @@ -304,6 +305,7 @@ public void SqlType_TvpFromSqlMetaData_RoundTripsCorrectly(object paramValue, st /// /// Round trip sql_variant value using TVP with a SqlDataReader source. /// + [Trait("Category", "flaky")] // Doesn't work well on Azure. [ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureSynapse))] [MemberData(nameof(SqlTypeTestData), DisableDiscoveryEnumeration = true)] public void SqlType_TvpFromSqlDataReader_RoundTripsCorrectly(object paramValue, string expectedTypeName, string expectedBaseTypeName)