zjncs opened a new pull request, #5674: URL: https://github.com/apache/rocketmq-dashboard/pull/5674
### Problem `MqClientPool` — the long-lived pull-consumer/producer pool whose per-request client creation is forbidden (every `start()` registers with NameServer and brokers, per the class docs) — had **no test**. ### Change Add `MqClientPoolTest` with eleven tests. The cache is seeded through the private `ClientKey` record via reflection, so **no real RocketMQ client is ever started**: | Contract | Pinned behaviour | | --- | --- | | guards | blank NameServer address → 400 up front | | reuse | a cached client serves repeated calls (no second create, no shutdown); null identity ≡ blank identity (both → `anonymous`) | | endpoint release | shuts down **every identity** on that endpoint, leaves other endpoints untouched, and matches equivalent address lists (comma vs semicolon ordering) | | identity release | shuts down exactly that identity; other identities on the same endpoint keep their clients | | failure discipline | an action failure is wrapped as 502 with the **root cause** message; a `BusinessException` from the action passes through unwrapped | | shutdown | stops every client, empties the cache, refuses further work — **including the racing-entry case** where a late write leaves an entry behind after shutdown: the up-front closed check must refuse before the cache is consulted, because a cache hit skips the inside-`computeIfAbsent` re-check | | robustness | a client shutdown failure during release is swallowed | ### Verification - New tests: **11/11 green** against unmodified code. - Discriminating mutations on `MqClientPool` (build result verified): endpoint release no longer shuts clients down (**red**); identity release drops the scoping (**red**); action failures no longer wrapped (**red**); the up-front closed check dropped (**red** with the racing-entry test — the inner `computeIfAbsent` re-check alone is behaviourally equivalent for cache misses, which the test design separates). - Restored: 11/11 green. No product code changed. -- 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]
