Skip to content

Add end-to-end tests for IntermediateStateCalcStageV2 availability-aware prioritization#133

Open
ngngwr wants to merge 1 commit intolinkedin:devfrom
ngngwr:ngangwar/intermediate-state-v2-availability-aware-tests
Open

Add end-to-end tests for IntermediateStateCalcStageV2 availability-aware prioritization#133
ngngwr wants to merge 1 commit intolinkedin:devfrom
ngngwr:ngangwar/intermediate-state-v2-availability-aware-tests

Conversation

@ngngwr
Copy link
Collaborator

@ngngwr ngngwr commented Mar 11, 2026

Issues

  • My PR addresses the following Helix issues and references them in the PR description:

Follow-up to #131 — adds end-to-end test coverage for the V2 pipeline and availability-aware ordering code path.

Description

  • Here are some details about my PR, including screenshots of any UI changes:

PR #131 added the V2 config flag and delegation logic but had zero end-to-end tests for the availability-aware code path (IntermediateStateCalcStageV2.java:118-120). This PR closes that gap with two new test classes:

TestIntermediateStateCalcStageV2 — Subclass that runs all 8 V1 IntermediateStateCalcStage tests with V2 enabled via setIntermediateStateCalcStageV2Enabled(true), verifying backward compatibility of the V2 pipeline.

TestIntermediateStateCalcStageV2AvailabilityAware — Extends V2 tests with availability-aware prioritization enabled. Inherits 9 V1/V2 tests plus adds 3 new scenarios that verify availability-aware-specific ordering behavior under tight throttle budgets:

  • Recovery prioritization: fully-degraded resources (top state missing, score 1M) win recovery slots over partially-degraded ones
  • Handoff prioritization: top-state handoff transitions (score 999K) win over normal upward transitions
  • Load-balance gradient ordering: the upward score formula minActive/(currentActive+1) correctly prioritizes more-degraded resources for load-balance messages

Tests

  • The following tests are written for this issue:

  • TestIntermediateStateCalcStageV2 — 9 tests (8 inherited V1 + 1 routing guard)

  • TestIntermediateStateCalcStageV2AvailabilityAware#testAvailabilityAwarePrioritizesMostDegradedResource

  • TestIntermediateStateCalcStageV2AvailabilityAware#testAvailabilityAwareHandoffPrioritizedOverUpwardTransition

  • TestIntermediateStateCalcStageV2AvailabilityAware#testAvailabilityAwareOrdersByDegradationForLoadBalance

  • The following is the result of the "mvn test" command on the appropriate module:

mvn test -pl helix-core -Dtest="TestIntermediateStateCalcStage,TestIntermediateStateCalcStageV2,TestIntermediateStateCalcStageV2AvailabilityAware"

Tests run: 31, Failures: 0, Errors: 0, Skipped: 0
BUILD SUCCESS

Changes that Break Backward Compatibility (Optional)

None. This PR adds test files only — no production code changes.

Commits

  • My commits all reference appropriate Apache Helix GitHub issues in their subject lines.

…y-aware prioritization

TestIntermediateStateCalcStageV2: Subclass that runs all 8 V1 tests with V2
enabled via setIntermediateStateCalcStageV2Enabled(true), verifying backward
compatibility of the V2 pipeline.

TestIntermediateStateCalcStageV2AvailabilityAware: Extends V2 tests with
availability-aware prioritization enabled. Inherits 9 V1/V2 tests plus adds
3 new scenarios:
- testAvailabilityAwarePrioritizesMostDegradedResource: verifies fully-degraded
  resources (top state missing, score 1M) win recovery slots over partially-degraded
- testAvailabilityAwareHandoffPrioritizedOverUpwardTransition: verifies top-state
  handoff (score 999K) wins over normal upward transitions
- testAvailabilityAwareOrdersByDegradationForLoadBalance: verifies the upward score
  gradient (minActive/(currentActive+1)) correctly orders load-balance messages so
  more-degraded resources get priority under tight throttle budgets

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant