SEZ9 commented on PR #13154:
URL: https://github.com/apache/seatunnel/pull/13154#issuecomment-6786384110
Thanks @DanielLeens for the third pass, and for tracing the mocks rather
than taking the test comment at its word. All four points are addressed. Head
is now `a2f59c7`.
### Issue A — the capture test now covers reordering
You were right that the test only caught deletion. `physicalPlan` was a
plain mock, so `addPipelineEndCallback(this)` was a no-op and
`initStateFuture()` never ran, which is exactly the call that replaces
`errorByPhysicalVertex`. I took your suggested shape:
```java
doAnswer(
invocation -> {
((SubPlan) invocation.getArgument(0)).initStateFuture();
return null;
})
.when(physicalPlan)
.addPipelineEndCallback(any(SubPlan.class));
PhysicalVertex vertex = mockPhysicalVertex(ExecutionState.FAILED);
when(vertex.initStateFuture())
.thenReturn(new PassiveCompletableFuture<>(new
CompletableFuture<>()));
...
Assertions.assertTrue(invokePrepareRestorePipeline(subPlan),
"prepareRestorePipeline failed");
```
`initStateFuture()` is safe to run for real here: the stubbed vertex future
never completes, so the `thenAcceptAsync` callback is registered and nothing
else fires, and `coordinatorVertexList` is empty.
What the test should now guard, derived from the wiring rather than from a
mutation run — I have no JDK in this environment, so please read this as
reasoning I would like checked, not as measured results:
| Mutation of `SubPlan.java` | Expected |
| --- | --- |
| delete `retainRestoreCause(...)` at :615 | red — `causes.size()` is 0 |
| move it below `addPipelineEndCallback` (:623) | red — `initStateFuture()`
has replaced the reference, so the entry becomes the placeholder and
`contains("Access denied for user")` fails |
| make `reset()` throw | red — `prepareRestorePipeline` returns `false` and
the new `assertTrue` fires |
Moving it below `reset()` alone still passes, as you said, because `reset()`
genuinely does not touch the field. I rewrote the test comment to claim only
what the mocks enforce, and to say why the callback is wired rather than left
as a bare mock.
### Issue B — the ZH heading
Fixed, and this one was a bad edit on my side, not a formatting artefact: my
paragraph was appended to the line that held `#### 指标字段说明`, so the heading was
consumed. It is now its own line with a blank line before it, matching EN:
```
...上一个 Master 记录的原因不会延续。
#### 指标字段说明
```
I also diffed every `#### ` heading in both `rest-api-v2.md` files against
`dev` to confirm nothing else was swallowed the same way — that was the only
one.
### Issue C — the 3 s sleep
`newSubPlan` now sets `job.retry.interval.seconds = 0` in the shared
`JobConfig`, so `pipelineRestoreIntervalSeconds` is 0 and the sleep is gone. I
put it in the shared factory rather than only in the restore test, with a
comment saying why, since any future test reaching that path would otherwise
pay the same 3 s.
### Issue D — the inline FQNs
`java.lang.reflect.Field`, `java.lang.reflect.Method` and
`java.util.concurrent.atomic.AtomicReference` are imported normally now.
### Two slips of mine on the way here, for the record
1. `1954fdeb` was needed because my first attempt at Issue A imported
`java.util.concurrent.CompletableFuture`, which
`ImportClassCheckTest.javaUtilCompletableFutureCheck` forbids — the module's
own `org.apache.seatunnel.engine.common.utils.concurrent.CompletableFuture` is
the right one. That failed all four `unit-test` jobs. After fixing it I checked
every import I had added against all eight forbidden patterns in that test.
2. That fix left two identical `@SuppressWarnings("unchecked")` annotations
on `setErrorByPhysicalVertex`. `@SuppressWarnings` is not `@Repeatable`, so it
is a compile error, and it would have failed the same four jobs again.
`a2f59c7` removes the duplicate. I found it by re-reading my own diff rather
than from CI, but it should not have been pushed at all — I cannot compile Java
in this environment, so a mechanical re-read of the diff is the only check I
have, and I had skipped it.
CI on `a2f59c7` is running; I will report the result here either way rather
than leave it implied.
Thanks again for the three careful rounds. Every change in the test file
since your first review came from one of your points.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]