zhangshenghang opened a new pull request, #13494:
URL: https://github.com/apache/seatunnel/pull/13494
Yes, I am contributing to Apache SeaTunnel. This change only adds Zeta
engine E2E regression coverage; no production code, connector, or configuration
is modified.
### Purpose of this pull request
Adds
`TagFilterLateWorkerPlacementIT#testJobWaitsForMatchingWorkerAndIsOnlyPlacedOnIt`,
an embedded-cluster end-to-end test for `env.tag_filter` slot placement when
no matching worker exists at submission time and one joins later.
Contract under test (one master, fixed-slot workers, `job-schedule-strategy:
WAIT`):
1. Only a worker tagged `team-a` is registered. The job requests `tag_filter
{ team = "team-b" }` and needs 3 fixed slots. The non-matching worker
advertises 4 slots, so capacity can never explain why the job is not running.
The job must stay `PENDING` for a continuous 6-second observation window and
own zero slots.
2. A worker tagged `team-b` joins. The master's pending-job scheduler must
dispatch the queued job without any client resubmission or extra cluster event.
3. Every slot the running job owns must be on the `team-b` worker, and none
on the `team-a` worker. This also catches a stale pre-apply attempt from the
`PENDING` phase being reused against the non-matching worker after registration.
4. Placement and `RUNNING` stay stable for a 3-second window; cancelling the
job releases every slot it owned.
### Why this boundary has real regression risk
`tag_filter` is a placement contract, not a data-processing feature: the job
still produces correct output when it runs on the wrong worker, so a regression
that allocates from the unfiltered `registerWorker` map, or that reuses the
pending job's failed pre-apply attempt after a matching worker registers, is
invisible to every functional assertion. What breaks instead is hardware
isolation and capacity accounting: the job runs on a worker the operator
explicitly excluded while the matching worker sits idle. Both halves of the
contract (tag filtering in `AbstractResourceManager#applyResources`, and
re-evaluation of the queued job on worker registration) were touched by recent
scheduler/slot changes, so this boundary needs an explicit guard.
### Why existing coverage does not reach it
- `WorkerTagClusterTest` only asserts
`ResourceManager#workerCount(tagFilter)` and never submits a job, so it cannot
observe where a job is placed.
- `ResourceIsolationIT` submits jobs through a Testcontainers cluster whose
members all carry the same fixed attributes, and only asserts exit codes; it
can never observe a job whose filter matches some workers but not others.
- `SplitClusterPendingJobLifecycleFailoverIT` owns the pending-queue
mechanics, but frees capacity by cancelling or savepoint-stopping a running
job. It never pins a job behind a tag filter and does not assert per-worker
slot placement.
The test is a new class rather than an extension of `WorkerTagClusterTest`
because that class is a per-class `workerCount` smoke test with no submitted
job, no deliberately oversized non-matching worker, and no late-joining worker;
the reason is documented in the class Javadoc as well.
### Does this PR introduce _any_ user-facing change?
No. This is test-only coverage; no engine behavior, configuration option, or
API is changed.
### How was this patch tested?
```bash
JAVA_HOME=/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home \
mvn -pl seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base
verify \
-DskipUT=true -DskipIT=false -Dit.test=TagFilterLateWorkerPlacementIT
```
- New test on this branch: `Tests run: 1, Failures: 0, Errors: 0, Skipped:
0`, ~30s.
- Ran the same test a second time on the same branch: passes again.
- Negative control: changing only the fixture's `tag_filter` to the
non-matching worker's tag (`team-a`) makes the test fail with `expected:
<PENDING> but was: <RUNNING>`, which proves the assertion is not vacuous.
- `spotless:apply` produces no changes and `spotless:check` passes.
- No production code changed, so no unit test is affected.
### Check list
* [ ] If any new Jar binary package adding in your PR, please add License
Notice according
[New License
Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/developer/new-license.md)
* [ ] If necessary, please update the documentation to describe the new
feature. https://github.com/apache/seatunnel/tree/dev/docs
* [ ] If necessary, please update `incompatible-changes.md` to describe the
incompatibility caused by this PR.
* [ ] If you are contributing the connector code, please check that the
following files are updated:
1. Update
[plugin-mapping.properties](https://github.com/apache/seatunnel/blob/dev/plugin-mapping.properties)
and add new connector information in it
2. Update the pom file of
[seatunnel-dist](https://github.com/apache/seatunnel/blob/dev/seatunnel-dist/pom.xml)
3. Add ci label in
[label-scope-conf](https://github.com/apache/seatunnel/blob/dev/.github/workflows/labeler/label-scope-conf.yml)
4. Add e2e testcase in
[seatunnel-e2e](https://github.com/apache/seatunnel/tree/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/)
--
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]