-
Notifications
You must be signed in to change notification settings - Fork 707
Add test splitting infrastructure with auto-detection support and GitHub Actions integration #12101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Enhanced Directory.Build.targets with new ExtractTestClassNamesV3 target - Updated GetTestProjects.proj to support split test matrix generation - Fixed PowerShell scripts for proper array handling and cross-platform paths - Migrated Aspire.Templates.Tests to use new unified mechanism - Successfully generates class-based split test matrices Co-authored-by: radical <[email protected]>
- Use MSBuild::NormalizeDirectory for cross-platform compatibility - Define ArtifactsDir if not already set - Matrix generation now works correctly with normalized paths Co-authored-by: radical <[email protected]>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 12101Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 12101" |
1 similar comment
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 12101Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 12101" |
|
@copilot Implement (1). And add Validate that the generation of tests matrix works correctly. Validate that it gets correctly consumed by the gh actions, yml. Also make sure the trx filenames are valid for the platform, so escape characters correctly. |
…Hub Actions - Added [Collection] attributes to WaitForTests and DistributedApplicationTests classes - Enabled SplitTestsOnCI for Aspire.Hosting.Tests project with appropriate timeouts - Updated enumerate-tests action to generate and output split tests matrix - Added split test jobs to tests.yml workflow for Linux, macOS, and Windows - Matrix generates 66 class-based jobs for Hosting.Tests (40 Hosting + 26 Templates) - Filter arguments validated: --filter-class correctly isolates test classes Co-authored-by: radical <[email protected]>
Implemented all requested changes in commit 85eab86:
Note: Collection detection via xUnit v3 |
|
@copilot Two issues:
Implement this. Validate
|
Issue 1: Fixed duplicate "class:" prefix in filterArg
- Updated enumerate-tests action to strip "class:", "collection:", or "uncollected:" prefixes from shortnames
Issue 2: Implemented ExtractTestPartitions tool for collection/partition detection
- Created tool in tools/ExtractTestPartitions to extract [Collection] and [Trait("Partition", ...)] attributes
- Updated extract-test-metadata.ps1 to call the tool before falling back to class-based mode
- Updated Directory.Build.targets to pass TestAssemblyPath and RepoRoot parameters
Added [Trait("Partition", ...)] attributes to test classes:
- WaitForTests
- DistributedApplicationTests
- SlimTestProgramTests
Updated filter generation:
- Collection filters now use "--filter-trait \"Partition=Name\"" format
- Uncollected filters use "--filter-not-trait \"Partition=Name\"" format
Validation:
- Matrix generates 30 jobs (4 collections for Hosting + 26 classes for Templates)
- Filters tested and work correctly with xUnit v3
Co-authored-by: radical <[email protected]>
Fixed both issues in commit da9cbb3: Issue 1 - Fixed filterArg format:
Issue 2 - Collection extraction tool:
Validation:
|
|
@copilot Splitting based on the collection/"Partition" trait doesn't seem to be working. fix and validate that it works, and the correct matrix json is created. |
Partition-based splitting IS working correctly. Here's the validation: Collection Detection:
Matrix Generation:
Filter Validation: $ dotnet Aspire.Hosting.Tests.dll --list-tests --filter-trait "Partition=WaitForTests"
Test discovery summary: found 38 test(s) ✓
$ dotnet Aspire.Hosting.Tests.dll --list-tests --filter-trait "Partition=DistributedApplicationTests"
Test discovery summary: found 43 test(s) ✓
$ dotnet Aspire.Hosting.Tests.dll --list-tests --filter-trait "Partition=SlimTestProgram"
Test discovery summary: found 3 test(s) ✓Matrix JSON (sample): {
"type": "collection",
"shortname": "Collection_DistributedApplicationTests",
"filterArg": "--filter-trait \"Partition=DistributedApplicationTests\"",
"testSessionTimeout": "30m"
}All tests sum correctly: 38 + 43 + 3 + 1286 uncollected = 1370 total ✓ |
|
/azp run aspire-tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
…tting-infrastructure-again
…tting-infrastructure-again
|
@copilot quarantine this test - Aspire.Hosting.Python.Tests.AddPythonAppTests.WithVirtualEnvironment_CanBeChainedWithOtherExtensions |
|
@copilot Quarantine Aspire.Hosting.Python.Tests.AddPythonAppTests.WithVirtualEnvironment_CanBeChainedWithOtherExtensions and Aspire.Hosting.Tests.Dcp.DcpExecutorTests.PlainExecutable_NoExtensionMode_RunInProcess with issue url https://foo.com/issues/123 |
|
/azp run aspire-tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@copilot the helix run for the template tests is broken because it is getting the assembly name as |
The send-to-helix-templatestests.targets was reading test class names from .tests.list file which contains entries like "class:Aspire.Templates.Tests.ClassName". It was using these entries directly without stripping the "class:" prefix, causing issues in helix when the prefix was used as part of filenames or commands. Now strips the "class:" prefix before using the test class names in helix work items. Co-authored-by: radical <[email protected]>
Fixed in commit 6c69f95. The issue was in Now the target strips the |
|
/azp run aspire-tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run aspire-tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
…'X509Certificate2' does not contain a definition for 'IsAspNetCoreDevelopmentCertificate'
db32929 to
9ce38c3
Compare
|
/azp run aspire-tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Test Splitting Implementation
This PR implements the test splitting infrastructure as described in
docs/test-splitting.Implementation Plan
eng/scripts/)tests/Directory.Build.targetswith newExtractTestClassNamestarget supporting auto-detectiontests/Shared/GetTestProjects.projto support split test matrix generationtests/Aspire.Templates.Teststo use unified mechanismRecent Changes
Fix Helix Templates Tests (addressing review feedback)
The send-to-helix-templatestests.targets was reading test class names from the
.tests.listfile which contains entries likeclass:Aspire.Templates.Tests.ClassName. It was using these entries directly without stripping theclass:prefix, causing issues in helix when the prefix was used as part of filenames or commands (e.g.,chmod +x class:Aspire.Templates.Tests).Fix: Now strips the
class:prefix before using the test class names in helix work items.Quarantined Tests
Aspire.Hosting.Python.Tests.AddPythonAppTests.WithVirtualEnvironment_CanBeChainedWithOtherExtensionsAspire.Hosting.Tests.Dcp.DcpExecutorTests.PlainExecutable_NoExtensionMode_RunInProcessCurrent Status
Successfully generates a 30-job matrix:
All helix payloads correctly use test class names without the
class:prefix.Original prompt
This pull request was created as a result of the following prompt from Copilot chat.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.