Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the shared PR pipeline test template to run additional “flaky-only” Functional and Manual test passes (and ignore failures from those passes) to help separate flaky test failures from main PR signal.
Changes:
- Adds “Run Flaky Functional Tests” and “Run Flaky Manual Tests” steps for both Windows (MSBuild@1) and non-Windows (DotNetCoreCLI@2).
- Adjusts test-step conditions to
succeededOrFailed()so later test steps still execute even when earlier steps fail. - Marks flaky-only steps with
continueOnError: trueto ignore flaky test failures.
| displayName: 'Run Flaky Functional Tests ${{parameters.msbuildArchitecture }}' | ||
| inputs: | ||
| solution: build.proj | ||
| msbuildArchitecture: ${{parameters.msbuildArchitecture }} | ||
| platform: '${{parameters.platform }}' | ||
| configuration: '${{parameters.configuration }}' | ||
| ${{ if eq(parameters.msbuildArchitecture, 'x64') }}: | ||
| msbuildArguments: '-t:RunFunctionalTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:Filter="category=flaky"' | ||
| ${{ else }}: # x86 | ||
| msbuildArguments: '-t:RunFunctionalTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:DotnetPath=${{parameters.dotnetx86RootPath }} -p:Filter="category=flaky"' | ||
| condition: succeededOrFailed() |
| displayName: 'Run Flaky Manual Tests ${{parameters.msbuildArchitecture }}' | ||
| inputs: | ||
| solution: build.proj | ||
| msbuildArchitecture: ${{parameters.msbuildArchitecture }} | ||
| platform: '${{parameters.platform }}' | ||
| configuration: '${{parameters.configuration }}' | ||
| ${{ if eq(parameters.msbuildArchitecture, 'x64') }}: | ||
| msbuildArguments: '-t:RunManualTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:Filter="category=flaky"' | ||
| ${{ else }}: # x86 | ||
| msbuildArguments: '-t:RunManualTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:DotnetPath=${{parameters.dotnetx86RootPath }} -p:Filter="category=flaky"' |
| msbuildArguments: '-t:RunFunctionalTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }}' | ||
| ${{ else }}: # x86 | ||
| msbuildArguments: '-t:RunFunctionalTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:DotnetPath=${{parameters.dotnetx86RootPath }}' |
| - task: DotNetCoreCLI@2 | ||
| displayName: 'Run Flaky Functional Tests' | ||
| inputs: | ||
| command: custom | ||
| projects: build.proj | ||
| custom: msbuild | ||
| arguments: '-t:RunFunctionalTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:platform=${{parameters.platform }} -p:Configuration=${{parameters.configuration }} -p:Filter="category=flaky"' | ||
| verbosityRestore: Detailed | ||
| verbosityPack: Detailed | ||
| condition: succeededOrFailed() | ||
| continueOnError: true |
| - task: DotNetCoreCLI@2 | ||
| displayName: 'Run Flaky Manual Tests' | ||
| inputs: | ||
| command: custom | ||
| projects: build.proj | ||
| custom: msbuild | ||
| arguments: '-t:RunManualTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:platform=${{parameters.platform }} -p:Configuration=${{parameters.configuration }} -p:Filter="category=flaky"' | ||
| verbosityRestore: Detailed | ||
| verbosityPack: Detailed | ||
| condition: succeededOrFailed() | ||
| continueOnError: true |
There was a problem hiding this comment.
Pull request overview
This PR aims to port the “flaky test separation” behavior into the 6.1 PR pipeline, so CI runs non-flaky tests normally and then runs flaky tests separately without failing the PR.
Changes:
- Updates the shared
run-all-tests-step.ymltemplate to add dedicated “Run Flaky * Tests” steps that continue on error. - Adjusts pipeline step conditions to run subsequent test phases even if an earlier phase fails.
- Updates
ConnectionFailoverTestsattributes/traits related to theflakycategory.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/ConnectionFailoverTests.cs | Trait/attribute adjustments for flaky categorization in this unit test class. |
| eng/pipelines/common/templates/steps/run-all-tests-step.yml | Adds separate flaky test executions for unit/functional/manual tests and tweaks step conditions/behavior. |
| msbuildArguments: '-t:RunUnitTests -p:TF=${{parameters.targetFramework }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:Filter="category=flaky"' | ||
| ${{ else }}: #x86 | ||
| msbuildArguments: '-t:RunUnitTests -p:TF=${{parameters.targetFramework }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:DotnetPath=${{parameters.dotnetx86RootPath }} -p:Filter="category=flaky"' |
There was a problem hiding this comment.
This is correct. You need the parts of build.proj from main that support the <Filter> property.
| command: custom | ||
| projects: build.proj | ||
| custom: msbuild | ||
| arguments: '-t:RunUnitTests -p:TF=${{ parameters.targetFramework }} -p:TestSet=${{ parameters.testSet }} -p:=TestMicrosoftDataSqlClientVersion=${{ parameters.nugetPackageVersion }} -p:platform=${{ parameters.platform }} -p:Configuration=${{ parameters.configuration }} -p:Filter="category=flaky"' |
| [Trait("Category", "flaky")] | ||
| [Theory] | ||
| [InlineData(40613)] |
There was a problem hiding this comment.
Agreed - the entire class is flaky, so individual tests don't also need to be marked as flaky.
| platform: '${{parameters.platform }}' | ||
| configuration: '${{parameters.configuration }}' | ||
| ${{ if eq(parameters.msbuildArchitecture, 'x64') }}: | ||
| msbuildArguments: '-t:RunUnitTests -p:TF=${{parameters.targetFramework }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }}' |
There was a problem hiding this comment.
Last thing, we'll need to filter out flaky tests for the non-flaky test steps.
There was a problem hiding this comment.
This is already done in build.proj via the RunUnitTests target.
What this PR needs is the newer build.proj with the <Filter> property.
Description
Since 6.1 branch already has the flaky test traits, this PR just updates the PR pipeline to run tests w/o flaky tests, then run only flaky tests, ignoring the results of the latter.
🤖
Codex ported these changes from the branch for #4059
Testing
These changes only apply to PR pipelines. They will be validated here.