Skip to content

Add PartitionByClass support to Helix test scheduling#55434

Merged
MichaelSimons merged 1 commit into
mainfrom
michaelsimons-add-partition-by-class
Jul 23, 2026
Merged

Add PartitionByClass support to Helix test scheduling#55434
MichaelSimons merged 1 commit into
mainfrom
michaelsimons-add-partition-by-class

Conversation

@MichaelSimons

@MichaelSimons MichaelSimons commented Jul 23, 2026

Copy link
Copy Markdown
Member

Summary

Adds a per-class Helix work-item partitioning mode to the SDK's custom Helix test scheduling.

  • AssemblyScheduler.PartitionByClass(assemblyPath) — produces one AssemblyPartitionInfo per public test class in the assembly (rather than grouping classes together up to a method-count limit). Falls back to a single unpartitioned representation when the assembly has no schedulable types.
  • CreateHelixTestWorkItems — opts a test project into per-class partitioning when it carries PartitionByClass=true metadata; otherwise the existing method-count scheduling is unchanged. MethodLimitMultiplier is only read on the method-count path.
  • Bug fix — the trailing test arguments were reformatted inside the work-item foreach, prepending an extra -- on every partition after the first. The formatting is now computed once (formattedArguments) before the loop.

Validation

  • dotnet build test/HelixTasks/HelixTasks.csproj succeeds with 0 warnings / 0 errors.

Required and tested by #55399; pulled into a separate PR for easier reviewability and to work incrementally.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@MichaelSimons
MichaelSimons force-pushed the michaelsimons-add-partition-by-class branch from 82c23a8 to 527f1b9 Compare July 23, 2026 15:49
@MichaelSimons
MichaelSimons marked this pull request as ready for review July 23, 2026 16:39
Copilot AI review requested due to automatic review settings July 23, 2026 16:39
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an opt-in “partition by test class” sharding mode to the SDK’s custom Helix test-work-item scheduling, enabling one Helix work item per discovered public test class when requested by project metadata, while preserving the existing method-count-based partitioning as the default.

Changes:

  • Add AssemblyScheduler.PartitionByClass(assemblyPath) to generate per-class AssemblyPartitionInfo partitions (with a single unpartitioned fallback when no schedulable types are found).
  • Update CreateHelixTestWorkItems to honor PartitionByClass=true metadata and to only read MethodLimitMultiplier on the method-count scheduling path.
  • Fix an arguments formatting bug by computing formattedArguments once before the partition loop (avoids repeated -- prefixing across partitions).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
test/HelixTasks/CreateHelixTestWorkItems.cs Adds PartitionByClass metadata support for per-class sharding and fixes argument formatting in the work-item loop.
test/HelixTasks/AssemblyScheduler.cs Introduces PartitionByClass API to return one partition per discovered public test-class candidate.

Comment thread test/HelixTasks/CreateHelixTestWorkItems.cs Outdated
Comment thread test/HelixTasks/AssemblyScheduler.cs
Adds AssemblyScheduler.PartitionByClass to produce one Helix work item per test class, gated by the optional PartitionByClass MSBuild metadata on test projects (documented on CreateHelixTestWorkItems.TestProjects). MethodLimitMultiplier is only read for the method-count scheduling path. Also fixes a latent bug where the trailing test arguments were re-formatted on every loop iteration, prepending an extra '-- ' for each partition after the first.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2331cf72-dd7c-4507-ba0f-792de68bd434
@MichaelSimons
MichaelSimons force-pushed the michaelsimons-add-partition-by-class branch from 527f1b9 to b32be18 Compare July 23, 2026 17:03
@MichaelSimons

Copy link
Copy Markdown
Member Author

/ba-g unrelated intermittent test failure.

@MichaelSimons
MichaelSimons merged commit 3f3c7c3 into main Jul 23, 2026
35 of 37 checks passed
@MichaelSimons
MichaelSimons deleted the michaelsimons-add-partition-by-class branch July 23, 2026 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants