diff --git a/eng/pipelines/pr/jobs/test-buildproj-job.yml b/eng/pipelines/pr/jobs/test-buildproj-job.yml index 0b051bf50e..ec2d292ec8 100644 --- a/eng/pipelines/pr/jobs/test-buildproj-job.yml +++ b/eng/pipelines/pr/jobs/test-buildproj-job.yml @@ -18,6 +18,17 @@ parameters: - name: buildSuffix type: string + # Dotnet CLI verbosity level. + - name: dotnetVerbosity + type: string + default: normal + values: + - quiet + - minimal + - normal + - detailed + - diagnostic + # Platform Parameters ==================================================== # Display name of the platform. This will be formatted into the job's official name as well as @@ -73,17 +84,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: ${{ parameters.dotnetVerbosity }} + 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..9ca2c7c555 100644 --- a/eng/pipelines/pr/jobs/test-sqlclientmanual-job.yml +++ b/eng/pipelines/pr/jobs/test-sqlclientmanual-job.yml @@ -5,6 +5,8 @@ ################################################################################# parameters: + # General Parameters ===================================================== + # Configuration with which to build the packages and execute the tests. - name: buildConfiguration type: string @@ -16,6 +18,17 @@ parameters: - 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 @@ -51,39 +64,58 @@ parameters: # Test Configuration Parameters ========================================== - # Azure Key Vault tenant ID that will be set in the config.json file. + # Azure Key Vault tenant ID that will be set in the config.jsonc file. - name: azureKeyVaultTenantId type: string - # Azure Key Vault URL that will be set in the config.json file. + # Azure Key Vault URL that will be set in the config.jsonc file. - name: azureKeyVaultUrl type: string - # Connection string using named pipes that will be set in the config.json file. + # 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.jsonc file. - name: connectionStringNp type: string - # Connection string using TCP that will be set in the config.json file. + # Connection string using TCP that will be set in the config.jsonc file. - name: connectionStringTcp type: string - # Path to use for file stream tests, this value will be stored in the config.json file. + # Path to use for file stream tests, this value will be stored in the config.jsonc 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 + # config.jsonc - name: localDbAppName type: string # Name of the local DB shared instance name for localdb tests, this value will be stored in the - # config.json + # config.jsonc - name: localDbSharedInstanceName type: string + # Manual test set to execute. + - name: testSet + type: string + + # Name of the user managed identity client ID. This value will be stored in config.jsonc for use + # in AKV tests and substituted in for Azure connection string user IDs. + - name: userManagedIdentityClientId + 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 +129,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. @@ -116,12 +154,12 @@ jobs: Write-Host "##vso[task.setvariable variable=Password;isSecret=true]$password" displayName: Set Connection String Password - # Write configuration information to the config.json file. + # Write configuration information to the config.jsonc file. - pwsh: | # Read existing default configuration from file - $defaultConfigPath = "$(REPO_ROOT)/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/config.default.json" + $defaultConfigPath = "$(REPO_ROOT)/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/config.default.jsonc" $configDirectory = "$(Agent.TempDirectory)/mds-config" - $configPath = Join-Path $configDirectory "config.json" + $configPath = Join-Path $configDirectory "config.jsonc" $config = Get-Content -Raw $defaultConfigPath | ConvertFrom-Json # Update the config values @@ -133,6 +171,7 @@ jobs: $config.LocalDbSharedInstanceName = "${{ parameters.localDbSharedInstanceName }}" $config.ManagedIdentitySupported = $true $config.SupportsIntegratedSecurity = $false + $config.UserManagedIdentityClientId = "${{ parameters.userManagedIdentityClientId }}" if ("${{ parameters.platformOperatingSystem }}" -eq "Windows") { $config.FileStreamDirectory = "${{ parameters.fileStreamDirectory }}" @@ -149,12 +188,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: ${{ 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 }} diff --git a/eng/pipelines/pr/pr-pipeline.yml b/eng/pipelines/pr/pr-pipeline.yml index 9774ebdbfa..daf393e502 100644 --- a/eng/pipelines/pr/pr-pipeline.yml +++ b/eng/pipelines/pr/pr-pipeline.yml @@ -6,6 +6,21 @@ name: $(DayOfYear)$(Rev:rr) +parameters: + # General Parameters ===================================================== + + # Dotnet CLI verbosity level. + - name: dotnetVerbosity + displayName: dotnet CLI Verbosity + type: string + default: normal + values: + - quiet + - minimal + - normal + - detailed + - diagnostic + variables: - template: /eng/pipelines/common/variables/common-variables.yml@self - template: /eng/pipelines/pr/variables/pr-variables.yml@self @@ -28,6 +43,7 @@ stages: parameters: buildConfiguration: Debug buildSuffix: pr + dotnetVerbosity: ${{ parameters.dotnetVerbosity }} poolName: $(PoolNameDefault) stageNamePack: ${{ variables.stageNamePack }} stageNameSecrets: ${{ variables.stageNameSecrets }} @@ -72,6 +88,7 @@ stages: manualTestFileStreamDirectory: "$(Pipeline.Workspace)/filestream" manualTestLocalDbAppName: $(LocalDbAppName) manualTestLocalDbSharedInstanceName: $(LocalDbSharedInstanceName) + manualTestUserManagedIdentityClientId: $(UserManagedIdentityClientId) # Stage 3: Collect code coverage # @TODO: 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..3a1e2c2011 100644 --- a/eng/pipelines/pr/stages/test-stages.yml +++ b/eng/pipelines/pr/stages/test-stages.yml @@ -9,6 +9,8 @@ # confidence and expedience of validation. parameters: + # General Parameters ===================================================== + # Configuration with which to build the packages and execute the tests. - name: buildConfiguration type: string @@ -20,6 +22,21 @@ parameters: - name: buildSuffix type: string + # Dotnet CLI verbosity level. + - name: dotnetVerbosity + type: string + default: normal + values: + - quiet + - minimal + - normal + - detailed + - diagnostic + + # Name of the pool to use for jobs that require customized VM images. + - name: poolName + type: string + # Name of the build/pack stage that this stage will depend on. - name: stageNamePack type: string @@ -28,55 +45,56 @@ parameters: - name: stageNameSecrets type: string - # Name of the pool to use for jobs that require customized VM images. - - name: poolName - type: string - # Manual Test Configuration Parameters ================================== - # Azure Key Vault tenant ID that will be set in the config.json file for sqlclient manual tests. + # Azure Key Vault tenant ID that will be set in the config.jsonc file for sqlclient manual tests. - name: manualTestAzureKeyVaultTenantId type: string - # Azure Key Vault URL that will be set in the config.json file for sqlclient manual tests. + # Azure Key Vault URL that will be set in the config.jsonc file for sqlclient manual tests. - name: manualTestAzureKeyVaultUrl type: string - # Connection string to Azure SQL using named pipes that will be set in the config.json file for + # Connection string to Azure SQL using named pipes that will be set in the config.jsonc file for # sqlclient manual tests against Azure SQL. - name: manualTestConnectionStringNpAzure type: string - # Connection string to localhost using named pipes that will be set in the config.json file for + # Connection string to localhost using named pipes that will be set in the config.jsonc file for # sqlclient manual tests against a local box product. - name: manualTestConnectionStringNpLocalhost type: string - # Connection string to Azure SQL using TCP that will be set in the config.json file for sqlclient + # Connection string to Azure SQL using TCP that will be set in the config.jsonc file for sqlclient # manual tests against Azure SQL. - name: manualTestConnectionStringTcpAzure type: string - # Connection string to localhost using TCP that will be set in the config.json file for sqlclient + # Connection string to localhost using TCP that will be set in the config.jsonc file for sqlclient # manual tests against a local box product. - name: manualTestConnectionStringTcpLocalhost type: string - # Path to use for file stream tests, this value will be stored in the config.json for sqlclient + # Path to use for file stream tests, this value will be stored in the config.jsonc for sqlclient # manual tests. - name: manualTestFileStreamDirectory type: string # Name of the local DB application name for localdb tests, this value will be stored in the - # config.json for sqlclient manual tests. + # config.jsonc for sqlclient manual tests. - name: manualTestLocalDbAppName type: string # Name of the local DB shared instance name for localdb tests, this value will be stored in the - # config.json for sqlclient manual tests. + # config.jsonc for sqlclient manual tests. - name: manualTestLocalDbSharedInstanceName type: string + # Name of the managed identity client ID, this value will be stored in the config.jsonc for + # sqlclient manual tests. + - name: manualTestUserManagedIdentityClientId + type: string + # This is an array of objects with the following fields: # - displayName - Friendly name to use when displaying the stage name and job names. This # must only contain alphanumeric characters and '_'. It will be used for both @@ -106,6 +124,7 @@ stages: parameters: buildConfiguration: ${{ parameters.buildConfiguration }} buildSuffix: ${{ parameters.buildSuffix }} + dotnetVerbosity: ${{ parameters.dotnetVerbosity }} platformDisplayName: ${{ platform.displayName }} platformDotnet: ${{ platform.dotnet }} platformImage: ${{ platform.image }} @@ -119,6 +138,7 @@ stages: parameters: buildConfiguration: ${{ parameters.buildConfiguration }} buildSuffix: ${{ parameters.buildSuffix }} + dotnetVerbosity: ${{ parameters.dotnetVerbosity }} platformDisplayName: ${{ platform.displayName }} platformDotnet: ${{ platform.dotnet }} platformImage: ${{ platform.image }} @@ -132,6 +152,7 @@ stages: parameters: buildConfiguration: ${{ parameters.buildConfiguration }} buildSuffix: ${{ parameters.buildSuffix }} + dotnetVerbosity: ${{ parameters.dotnetVerbosity }} platformDisplayName: ${{ platform.displayName }} platformDotnet: ${{ platform.dotnet }} platformImage: ${{ platform.image }} @@ -146,6 +167,7 @@ stages: parameters: buildConfiguration: ${{ parameters.buildConfiguration }} buildSuffix: ${{ parameters.buildSuffix }} + dotnetVerbosity: ${{ parameters.dotnetVerbosity }} stageNameSecrets: ${{ parameters.stageNameSecrets }} platformDisplayName: ${{ platform.displayName }} @@ -156,37 +178,74 @@ 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" + userManagedIdentityClientId: ${{ parameters.manualTestUserManagedIdentityClientId }} + + # TestSqlClientManual - Azure + - template: /eng/pipelines/pr/jobs/test-sqlclientmanual-job.yml@self + parameters: + buildConfiguration: ${{ parameters.buildConfiguration }} + buildSuffix: ${{ parameters.buildSuffix }} + dotnetVerbosity: ${{ parameters.dotnetVerbosity }} + 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" + userManagedIdentityClientId: ${{ parameters.manualTestUserManagedIdentityClientId }} - # @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 - 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 }} + dotnetVerbosity: ${{ parameters.dotnetVerbosity }} + 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" + userManagedIdentityClientId: ${{ parameters.manualTestUserManagedIdentityClientId }} # TestSqlClientUnit - template: /eng/pipelines/pr/jobs/test-buildproj-job.yml@self parameters: buildConfiguration: ${{ parameters.buildConfiguration }} buildSuffix: ${{ parameters.buildSuffix }} + dotnetVerbosity: ${{ parameters.dotnetVerbosity }} platformDisplayName: ${{ platform.displayName }} platformDotnet: ${{ platform.dotnet }} platformImage: ${{ platform.image }} 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/eng/pipelines/pr/variables/pr-variables.yml b/eng/pipelines/pr/variables/pr-variables.yml index 4a28253dc7..a9da73850e 100644 --- a/eng/pipelines/pr/variables/pr-variables.yml +++ b/eng/pipelines/pr/variables/pr-variables.yml @@ -20,6 +20,7 @@ variables: # LocalDbAppName # LocalDbSharedInstanceName # PoolNameDefault + # UserManagedIdentityClientId - group: sqlclient-testconfig-v1 # General Variables ====================================================== diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/AKVTests.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/AKVTests.cs index 53232b1431..6c2db5dd6e 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/AKVTests.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/AKVTests.cs @@ -30,7 +30,13 @@ public AKVTest(SQLSetupStrategyAzureKeyVault fixture) [ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringSetupForAE), nameof(DataTestUtility.IsAKVSetupAvailable))] public void TestEncryptDecryptWithAKV() { - SqlConnectionStringBuilder builder = new(DataTestUtility.TCPConnectionStringHGSVBS) + // Select connection string - If an enclave connection string exists, use that, but for + // non-enclave test runs, use the standard TCP connection string. + string baseConnectionString = string.IsNullOrWhiteSpace(DataTestUtility.TCPConnectionStringHGSVBS) + ? DataTestUtility.TCPConnectionString + : DataTestUtility.TCPConnectionStringHGSVBS; + + SqlConnectionStringBuilder builder = new(baseConnectionString) { ColumnEncryptionSetting = SqlConnectionColumnEncryptionSetting.Enabled, AttestationProtocol = SqlConnectionAttestationProtocol.NotSpecified, @@ -71,7 +77,13 @@ It aims to confirm that three consecutive connections will consistently fail wit [ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringSetupForAE), nameof(DataTestUtility.IsAKVSetupAvailable))] public void ForcedColumnDecryptErrorTestShouldFail() { - SqlConnectionStringBuilder builder = new(DataTestUtility.TCPConnectionStringHGSVBS) + // Select connection string - If an enclave connection string exists, use that, but for + // non-enclave test runs, use the standard TCP connection string. + string baseConnectionString = string.IsNullOrWhiteSpace(DataTestUtility.TCPConnectionStringHGSVBS) + ? DataTestUtility.TCPConnectionString + : DataTestUtility.TCPConnectionStringHGSVBS; + + SqlConnectionStringBuilder builder = new(baseConnectionString) { ColumnEncryptionSetting = SqlConnectionColumnEncryptionSetting.Enabled, AttestationProtocol = SqlConnectionAttestationProtocol.NotSpecified, @@ -148,7 +160,13 @@ public void TestRoundTripWithAKVAndCertStoreProvider() [ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringSetupForAE), nameof(DataTestUtility.IsAKVSetupAvailable))] public void TestLocalCekCacheIsScopedToProvider() { - SqlConnectionStringBuilder builder = new(DataTestUtility.TCPConnectionStringHGSVBS) + // Select connection string - If an enclave connection string exists, use that, but for + // non-enclave test runs, use the standard TCP connection string. + string baseConnectionString = string.IsNullOrWhiteSpace(DataTestUtility.TCPConnectionStringHGSVBS) + ? DataTestUtility.TCPConnectionString + : DataTestUtility.TCPConnectionStringHGSVBS; + + SqlConnectionStringBuilder builder = new(baseConnectionString) { ColumnEncryptionSetting = SqlConnectionColumnEncryptionSetting.Enabled, AttestationProtocol = SqlConnectionAttestationProtocol.NotSpecified, diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/ApiShould.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/ApiShould.cs index feefe77adb..6f564250ce 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/ApiShould.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/ApiShould.cs @@ -1999,6 +1999,8 @@ public void TestBeginAndEndExecuteReaderWithAsyncCallback(string connection, Com } } + [Trait("Category", "flaky")] // System.AggregateException : One or more errors occurred. (Assert.ThrowsAny() Failure: No exception was thrown + // Expected: typeof(System.Exception)) [ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.IsTargetReadyForAeWithKeyStore))] [ClassData(typeof(AEConnectionStringProviderWithExecutionMethod))] public void TestSqlCommandCancel(string connection, string value) @@ -2184,6 +2186,16 @@ public void TestSqlCommandCancel(string connection, string value) tasks[1].Start(); // Wait for the threads to finish. + // Flaky Stack Trace -------------------------------------- + // Assert.ThrowsAny() Failure: No exception was thrown + // Expected: typeof(System.Exception) + // Stack Trace: + // at System.Threading.Tasks.Task.WaitAllCore(ReadOnlySpan`1 tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken) + // at System.Threading.Tasks.Task.WaitAll(Task[] tasks) + // at Microsoft.Data.SqlClient.ManualTesting.Tests.AlwaysEncrypted.ApiShould.TestSqlCommandCancel(String connection, String value) in D:\a\_work\1\s\src\Microsoft.Data.SqlClient\tests\ManualTests\AlwaysEncrypted\ApiShould.cs:line 2187 + // at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor) + // at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr) + Task.WaitAll(tasks); CommandHelper.s_sleepAfterReadDescribeEncryptionParameterResults?.SetValue(null, false); diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/BulkCopy/CopyAllFromReaderConnectionCloseOnEventAsync.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/BulkCopy/CopyAllFromReaderConnectionCloseOnEventAsync.cs index 4938014ca3..e48bf5906a 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/BulkCopy/CopyAllFromReaderConnectionCloseOnEventAsync.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/BulkCopy/CopyAllFromReaderConnectionCloseOnEventAsync.cs @@ -13,7 +13,8 @@ namespace Microsoft.Data.SqlClient.ManualTests.BulkCopy [Trait("Set", "2")] 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/MARSSessionPoolingTest/MarsSessionPoolingTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/MARSSessionPoolingTest/MarsSessionPoolingTest.cs index e84c9fabb6..9f666fc45f 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/MARSSessionPoolingTest/MarsSessionPoolingTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/MARSSessionPoolingTest/MarsSessionPoolingTest.cs @@ -228,6 +228,9 @@ public void ExecuteReader_GarbageCollectReader(CommandType commandType) } } + [Trait("Category", "flaky")] // Assert.Equal() Failure: Values differ + // Expected: 5 + // Actual: 4 [ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.IsNotAzureSynapse), nameof(DataTestUtility.IsNotManagedInstance))] [InlineData(CommandType.Text)] [InlineData(CommandType.StoredProcedure)] @@ -254,6 +257,17 @@ public void ExecuteReader_DisposeCommand(CommandType commandType) // Disposing of the command does *not* close the reader, meaning the MARS session // is left in an incomplete state. As such, with each command that's executed, a // new session is opened. + + // Flaky stack trace ------------------ + // Assert.Equal() Failure: Values differ + // Expected: 5 + // Actual: 4 + // Stack Trace: + // at Microsoft.Data.SqlClient.ManualTesting.Tests.MarsSessionPoolingTest.AssertSessionsAndRequests(SqlConnection connection, Int32 openMarsSessions, Int32 openRequests) in D:\a\_work\1\s\src\Microsoft.Data.SqlClient\tests\ManualTests\SQL\MARSSessionPoolingTest\MarsSessionPoolingTest.cs:line 368 + // at Microsoft.Data.SqlClient.ManualTesting.Tests.MarsSessionPoolingTest.ExecuteReader_DisposeCommand(CommandType commandType) in D:\a\_work\1\s\src\Microsoft.Data.SqlClient\tests\ManualTests\SQL\MARSSessionPoolingTest\MarsSessionPoolingTest.cs:line 256 + // at InvokeStub_MarsSessionPoolingTest.ExecuteReader_DisposeCommand(Object, Span`1) + // at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) + AssertSessionsAndRequests(connection, openMarsSessions: i + 1, openRequests: i + 1); } } 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 0f81496d65..a6d5b741ed 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/SqlVariantParameterTests.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/SqlVariantParameterTests.cs @@ -259,6 +259,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) @@ -305,6 +306,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)