test(amber): add unit test coverage for RegionPlan#4770
Conversation
Add RegionPlanSpec covering getRegion lookup (and unknown-id rejection), getRegionOfLink and getRegionOfPortId search, and topologicalIterator ordering across the regionLinks DAG. Closes apache#4769 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR adds a dedicated ScalaTest spec for RegionPlan, the immutable scheduling graph used by Amber’s workflow execution layer. It is focused on formalizing the expected lookup and traversal behavior called out in issue #4769.
Changes:
- Add
RegionPlanSpecwith unit tests for region lookup by id. - Add unit tests for lookup by physical link and global port id.
- Add a unit test for topological iteration over
regionLinks.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4770 +/- ##
=========================================
Coverage 43.46% 43.46%
- Complexity 2063 2066 +3
=========================================
Files 957 957
Lines 34077 34077
Branches 3753 3753
=========================================
+ Hits 14810 14811 +1
+ Misses 18469 18468 -1
Partials 798 798
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…OfLink Per Copilot feedback on apache#4770: lock down the absent-link failure mode (`.find(...).get` raising NoSuchElementException) so the spec documents the full lookup contract. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Yicong-Huang
left a comment
There was a problem hiding this comment.
Let's improve this test.
Add a 5-region diamond plan (src fans out to three middle regions, all joining a single sink) plus a 9-region wide DAG with multiple parallel branches and joins. The diamond exercises getRegion/getRegionOfLink/ getRegionOfPortId/topologicalIterator across multi-op regions; the wide DAG validates that topologicalIterator respects every regionLink edge beyond a simple linked-list ordering. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
What changes were proposed in this PR?
Add
RegionPlanSpeccovering the lookup and DAG-iteration contract ofRegionPlan:getRegion(id)returns the region with the given id; throwsNoSuchElementExceptionfor unknown idsgetRegionOfLinkreturns the region whosephysicalLinkscontain the link; throwsNoSuchElementExceptionwhen no region claims itgetRegionOfPortIdreturns the region whoseportscontain the global port id, orNonewhen no region claims ittopologicalIteratoryields region ids in topological order based onregionLinksAny related issues, documentation, discussions?
Closes #4769
How was this PR tested?
sbt "WorkflowExecutionService/testOnly org.apache.texera.amber.engine.architecture.scheduling.RegionPlanSpec"— 7/7 tests pass.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 4.7)