Repository navigation
test(workflow-core): add unit test coverage for core executor traits + factory - #5400
Merged
Merged
Conversation
…+ factory Pin the abstract executor contract every operator implementation honors plus the reflection-based factory that compiles / instantiates them. OperatorExecutor defaults: no-op open / close (idempotent across the lifecycle); produceStateOnStart / produceStateOnFinish default to None; processState defaults to Some(state); onFinish defaults to Iterator.empty. Multi-port wrappers default to pairing each underlying emission with Option.empty port and forwarding the input port id verbatim to the subclass override; zero-/many-emission fan-out covered. SourceOperatorExecutor overrides: open / close no-op; processTuple returns Iterator.empty (sources do not consume input); the input-side processTupleMultiPort returns Iterator.empty without ever calling produceTuple; onFinishMultiPort delegates to produceTuple and wraps each emitted tuple with Option.empty port. ExecFactory.newExecFromJavaClassName: no-arg constructor when descString is empty; (String) constructor when non-empty; falls back to (Int, Int) or (String, Int, Int) when the first branch raises NoSuchMethodException; ClassNotFoundException propagates when the name doesn't resolve; NoSuchMethodException propagates when neither branch matches (a fixture with only a (Long) constructor exercises this). ExecFactory.newExecFromJavaCode: the diagnostic-collection branch is covered with a syntactically-broken source. A happy-path compile-and- construct test is intentionally omitted — JavaRuntimeCompilation's in-memory compiler doesn't inherit sbt's test classpath, so a source that implements OperatorExecutor can't resolve the trait at javac time. Closes apache#5396
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new ScalaTest suite intended to pin the default behaviors of the core executor traits (OperatorExecutor, SourceOperatorExecutor) and the reflection-based executor factory (ExecFactory) in workflow-core.
Changes:
- Adds
CoreExecutorSpeccovering default lifecycle/state methods and multi-port wrappers forOperatorExecutor. - Adds coverage for
SourceOperatorExecutorinput-side no-op behavior and finish-time tuple production wrapping. - Adds reflection/compilation failure-path tests for
ExecFactory(class-name instantiation branches; Java compilation diagnostics).
💡 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 #5400 +/- ##
============================================
- Coverage 51.62% 51.60% -0.02%
+ Complexity 2419 2418 -1
============================================
Files 1056 1056
Lines 41049 41049
Branches 4410 4410
============================================
- Hits 21190 21182 -8
- Misses 18619 18627 +8
Partials 1240 1240
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…Spec Address Copilot review on apache#5400: CoreExecutorReflectionSpec already covered OperatorExecutor / SourceOperatorExecutor defaults and ExecFactory.newExecFromJavaClassName / JavaRuntimeCompilation. I missed the existing spec during my initial coverage check (its name doesn't match any source-class name pattern). Drop the duplicate CoreExecutorSpec.scala and instead add five genuinely-new tests to the existing spec: - OperatorExecutor.open / close honor a subclass override across the lifecycle (counter-based pin so direct no-op stubs would not pass). - processTupleMultiPort forwards the input port id verbatim to the subclass override (regression that hard-codes port = 0 would be invisible to the basic delegation test). - processTupleMultiPort produces as many output pairs as processTuple emits (zero / many fan-out). - SourceOperatorExecutor.processTupleMultiPort never invokes produceTuple on the input-side path (counter-based pin — an accidental drain that discards results wouldn't fail an empty-iterator check). - ExecFactory.newExecFromJavaClassName propagates NoSuchMethodException when neither factory branch matches a fixture with only a (Long) constructor. The PR diff is now additive on top of the existing spec rather than a parallel duplicate.
aglinxinyuan
added a commit
to aglinxinyuan/texera
that referenced
this pull request
Jun 7, 2026
… files Address Yicong-Huang's review on apache#5439: the single WorkerManagersAdditionalSpec.scala combining tests for two source classes makes future contributors miss this file when they search StatisticsManagerSpec.scala / SerializationManagerSpec.scala — exactly the duplicate-spec failure mode that surfaced on apache#5400 with CoreExecutorReflectionSpec vs my parallel CoreExecutorSpec. Split into two files following the <srcClassName>Spec.scala convention: - StatisticsManagerSpec.scala (12 tests for StatisticsManager) - SerializationManagerSpec.scala (8 tests for SerializationManager) No assertion changes; tests + companion fixtures simply move to the file that matches their source class.
yangzhang75
pushed a commit
to yangzhang75/texera
that referenced
this pull request
Jun 22, 2026
…+ factory (apache#5400) ### What changes were proposed in this PR? `CoreExecutorReflectionSpec` (same package) already covered the basic defaults of `OperatorExecutor` / `SourceOperatorExecutor` and the `ExecFactory.newExecFromJavaClassName` happy paths + `JavaRuntimeCompilation` failure path. This PR extends the existing spec with five additional regression pins, without duplicating any existing assertion. | Surface | Pinned (new in this PR) | | --- | --- | | `OperatorExecutor.open` / `close` | A subclass override is reachable from every call site that invokes `open` / `close` on the trait (counter-based pin; a direct no-op-stub regression that bypassed dispatch wouldn't fail the existing default-stays-no-op tests). | | `OperatorExecutor.processTupleMultiPort` | The default wrapper hands the input `port` verbatim to the subclass override (a regression that hard-coded `port = 0` would be invisible to the basic delegation test). Zero-emission and many-emission fan-out from the underlying `processTuple` both pass through with `Option.empty` port. | | `SourceOperatorExecutor.processTupleMultiPort` | The input-side path never invokes `produceTuple` (counter-based pin; an accidental drain that discarded results wouldn't fail an empty-iterator check). | | `ExecFactory.newExecFromJavaClassName` | `NoSuchMethodException` propagates when neither factory branch matches a fixture with only a `(Long)` constructor (the existing tests pin the success paths and `ClassNotFoundException`, not the "no constructor matches" branch). | The PR body's earlier claim that "this package has no unit tests today" was inaccurate; the existing spec was missed during my initial coverage check because its `Reflection` suffix doesn't match any source-class name pattern. Consolidated per Copilot review. No production code changed; this is test-only. ### Any related issues, documentation, discussions? Closes apache#5396 ### How was this PR tested? ``` sbt "WorkflowCore/Test/testOnly org.apache.texera.amber.core.executor.CoreExecutorReflectionSpec" # → 23 tests (18 pre-existing + 5 new), all pass sbt "WorkflowCore/Test/scalafmtCheck" # → clean ``` ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Opus 4.7)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this PR?
CoreExecutorReflectionSpec(same package) already covered the basic defaults ofOperatorExecutor/SourceOperatorExecutorand theExecFactory.newExecFromJavaClassNamehappy paths +JavaRuntimeCompilationfailure path. This PR extends the existing spec with five additional regression pins, without duplicating any existing assertion.OperatorExecutor.open/closeopen/closeon the trait (counter-based pin; a direct no-op-stub regression that bypassed dispatch wouldn't fail the existing default-stays-no-op tests).OperatorExecutor.processTupleMultiPortportverbatim to the subclass override (a regression that hard-codedport = 0would be invisible to the basic delegation test). Zero-emission and many-emission fan-out from the underlyingprocessTupleboth pass through withOption.emptyport.SourceOperatorExecutor.processTupleMultiPortproduceTuple(counter-based pin; an accidental drain that discarded results wouldn't fail an empty-iterator check).ExecFactory.newExecFromJavaClassNameNoSuchMethodExceptionpropagates when neither factory branch matches a fixture with only a(Long)constructor (the existing tests pin the success paths andClassNotFoundException, not the "no constructor matches" branch).The PR body's earlier claim that "this package has no unit tests today" was inaccurate; the existing spec was missed during my initial coverage check because its
Reflectionsuffix doesn't match any source-class name pattern. Consolidated per Copilot review.No production code changed; this is test-only.
Any related issues, documentation, discussions?
Closes #5396
How was this PR tested?
Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 4.7)