zhangshenghang opened a new pull request, #13066:
URL: https://github.com/apache/seatunnel/pull/13066

   ## Purpose of this pull request
   
   Yes, this is a contribution to Apache SeaTunnel.
   
   `SystemLoadAllocateStrategyIT` waits for worker heartbeat registration with 
`Thread.sleep(10000)` and for the workers' system-load samples with 
`Thread.sleep(60000)`; `SlotRatioAllocateStrategyIT` waits for the registration 
with `Thread.sleep(10000)`. Both waits are open loop:
   
   - The resource manager only learns about a worker on its first heartbeat (5s 
interval), and job submission requires both workers to be registered.
   - The SYSTEM_LOAD strategy weights a worker without load samples with the 
lowest allocation weight (`SystemLoadCalculate.calculate` returns `0.0` when 
the load history is empty), and samples are only reported every 
`SYSTEM_LOAD_SEND_INTERVAL` (2) heartbeats. If the second job is submitted 
before both workers have reported, all of its slots can be allocated to a 
single node and the `assertEquals(7, ...)` assertions fail intermittently; the 
fixed sleeps also always cost 70s of wall time even in the happy path.
   
   This PR replaces the fixed sleeps with bounded Awaitility polling, keeping 
the test scenarios and expected values unchanged:
   
   - both ITs poll `resourceManager.getRegisterWorker()` until both worker 
addresses are registered before submitting the first job;
   - `SystemLoadAllocateStrategyIT` polls until both workers have reported at 
least one load sample before submitting the second job.
   
   To make the load history observable, `SystemLoadStrategy` gets a read-only 
`hasLoadInfo(Address)` accessor over its internal load history. It does not 
change any runtime behavior.
   
   Searched the open PRs for the same objective (allocate strategy / fixed 
sleeps / e2e stability) and found no duplicate.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   - `./mvnw spotless:apply`
   - `./mvnw -DskipTests -Dcheckstyle.skip=true -Dlicense.skip=true 
-Dspotless.skip=true -pl 
seatunnel-engine/seatunnel-engine-server,seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base
 -am install`
   
   The ITs themselves run in the `seatunnel-engine-e2e` CI job (no Docker 
available in the authoring environment); the change only alters how long the 
tests wait, not what they assert.
   


-- 
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]

Reply via email to