You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "weiqingy (via GitHub)" <gi...@apache.org> on 2026/05/12 04:25:58 UTC
[PR] [runtime] Add comprehensive tests for ActionExecutionOperator manager classes [flink-agents]
weiqingy opened a new pull request, #659:
URL: https://github.com/apache/flink-agents/pull/659
Linked issue: #646
### Purpose of change
Closes the heavier test coverage explicitly deferred at PR #546's review for the manager classes that decomposed `ActionExecutionOperator`. PR #546 added 4 contract test files (7 tests, 295 lines) using mocks and stubs; heavier coverage — snapshot/recovery cycle, listener notification, watermark draining order, memory-context lifecycle — was deferred and tracked in #646. This PR closes that gap.
**Scope** (matches issue #646's deferred-coverage table):
| Manager | New coverage |
|---------|--------------|
| `DurableExecutionManager` | Full snapshot + recovery cycle; `notifyCheckpointComplete` pruning behaviour (3 new tests) |
| `EventRouter` | Listener notification on event processed; watermark draining order under concurrent keys (5 new tests) |
| `ActionTaskContextManager` | Full memory-context lifecycle: create → transfer → complete → cleanup (5 new tests) |
`OperatorStateManager` is dropped from this PR — its observable contracts are already covered by `ActionExecutionOperatorTest.java:176–231` (rescale + recovery) and `:254–306` (durable state recovery). Adding a manager-scoped harness test would duplicate without adding coverage.
`PythonBridgeManager` is out of scope per the issue body's deferred-coverage table.
### Commit structure (4 commits)
1. **[runtime] Add @VisibleForTesting seams for manager tests** — three narrow seams in production code, all following the existing `DurableExecutionManager.getActionStateStore()` precedent:
- `DurableExecutionManager.getCheckpointIdToSeqNums()` accessor
- `EventRouter.addEventListener(EventListener)` accessor
- `EventRouter` 3-arg `@VisibleForTesting` constructor for `EventLogger` injection (2-arg constructor delegates; production signature unchanged)
2. **[runtime] Add comprehensive tests for DurableExecutionManager** — 3 new tests
3. **[runtime] Add comprehensive tests for EventRouter** — 5 new tests
4. **[runtime] Add comprehensive tests for ActionTaskContextManager** — 5 new tests
### Tests
- **13 new tests** added; 6 existing manager tests untouched. After this PR: 5 + 7 + 7 + 1 = **20 tests** across the four manager test classes (was 7).
- Full `runtime` module: **262 tests, 0 failures, 0 errors, 0 skipped**.
- Spotless format check: `### FORMAT CHECK PASSED ###`.
- License check: clean (no tracked files missing headers).
Verification commands:
```
mvn -pl runtime -am test -Dsurefire.failIfNoSpecifiedTests=false
./tools/lint.sh -c
```
Final diff: **5 files, +464 / -2** (2 production-code files for the seams; 3 test files for the new tests).
#### Test design notes (each test catches a distinct mutation)
- `DurableExecutionManagerTest.notifyPrunesNotifiedCheckpointAndPreservesOthers` is a single consolidated test that exercises BOTH the multi-key loop body (two keys under one checkpoint, both must be pruned) AND multi-checkpoint isolation (a third key under a different checkpoint must survive). Strictly stronger than two separate tests.
- `DurableExecutionManagerTest.handleRecoveryCallsRebuildState` verifies the *call* contract; mutation observability for the `rebuildState` side effect is covered by operator-level integration tests against real stores (`InMemoryActionStateStore.rebuildState` is a no-op).
- `ActionTaskContextManagerTest.transferContextsCopiesMemoryAndContinuationToNewTask` covers the Java path; the Python path requires Pemja and is covered by `ActionExecutionOperatorTest`'s Python flows.
- `EventRouterTest.processEligibleWatermarksDrainsInArrivalOrder` drives `SegmentedQueue` across two segments and removes keys in completion order that differs from arrival; ordered assertion `containsExactly(WM1, WM2)` catches both wrong-order draining and skipped watermarks.
### API
No public API changes. Three new `@VisibleForTesting` package-private members in production code (one accessor on `DurableExecutionManager`, one accessor + one constructor overload on `EventRouter`). The existing `EventRouter(AgentPlan, boolean)` constructor signature is unchanged; it delegates to the new 3-arg form. `createEventLogger` is converted from instance to `static` (required by Java for chained `this(...)` constructors; the original body uses only its parameter).
### Documentation
- [ ] `doc-needed`
- [x] `doc-not-needed`
- [ ] `doc-included`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [runtime] Add comprehensive tests for ActionExecutionOperator manager classes [flink-agents]
Posted by "wenjin272 (via GitHub)" <gi...@apache.org>.
wenjin272 merged PR #659:
URL: https://github.com/apache/flink-agents/pull/659
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [runtime] Add comprehensive tests for ActionExecutionOperator manager classes [flink-agents]
Posted by "weiqingy (via GitHub)" <gi...@apache.org>.
weiqingy commented on PR #659:
URL: https://github.com/apache/flink-agents/pull/659#issuecomment-4437303216
The 1 remaining failing check is unrelated to this PR — it's an `httpx.ReadTimeout` against the external chat model service.
- **cross-language [python-3.12] [java-21]**: `ChatModelCrossLanguageTest.testChatModeIntegration` — `Caused by: pemja.core.PythonException: <class 'httpx.ReadTimeout'>: timed out`. Pure network/HTTP-client timeout, no assertion failure, no code path touched by this PR. Evidence: [job log](https://github.com/apache/flink-agents/actions/runs/25777629362/job/75713450480).
The same flake hit this PR earlier (run `25716424884`) and seems a known environmental flake in the cross-language integration suite. All other 22 checks pass.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [runtime] Add comprehensive tests for ActionExecutionOperator manager classes [flink-agents]
Posted by "weiqingy (via GitHub)" <gi...@apache.org>.
weiqingy commented on PR #659:
URL: https://github.com/apache/flink-agents/pull/659#issuecomment-4437192735
Hey @wenjin272, this PR follows up on the review comment about adding more tests for https://github.com/apache/flink-agents/pull/546. Could you please review it when you get a chance? Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org