rajeshkumarchandolu opened a new pull request, #11850:
URL: https://github.com/apache/ozone/pull/11850

   ## What changes were proposed in this pull request?
   
   Test OM read-path datanode sorting through KeyManager#listStatus
   
   ### Why
   This is a preparatory change for OM tracing  The tracing work will create 
the OM key manager as a tracing proxy, using `TracingUtil.createProxy(new 
KeyManagerImpl(...), KeyManager.class, ...)`, so that each key manager call 
gets its own span. A proxy implements only the `KeyManager` interface, so tests 
can no longer reach helpers that exist only on `KeyManagerImpl`.
   
   `TestOMSortDatanodes` tested read-path sorting by calling 
`KeyManagerImpl#sortDatanodes(List, String)` directly. That helper was `public` 
and annotated `@VisibleForTesting` only for this test. Rather than put the 
helper on the `KeyManager` interface just for a test, this PR tests the 
behaviour through the public read API that clients actually use. It doesn't add 
any tracing itself.
   
   ### What
   The three read-path tests (`sortDatanodesRelativeToDatanode`, 
`sortDatanodesRelativeToNonDatanode`, `testSortDatanodes`) now go through 
`KeyManager#listStatus`:
   * The setup creates a volume, a LEGACY bucket, and a key whose block 
location points to a container on a pipeline with all the datanodes.
   * The mocked SCM container client returns that container and pipeline from 
`getContainerWithPipelineBatch`.
   * Each test calls `listStatus` with `setSortDatanodesInPipeline(true)` and a 
given client address. It asserts the order of `getNodesInOrder()` on the 
returned block's pipeline.
   
   This exercises the whole path: pipeline refresh from SCM, then sorting 
relative to the client. `KeyManagerImpl#sortDatanodes(List, String)` is now 
`private`. The `sortDatanodesForWrite*` tests are unchanged.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-XXXX
   
   ## How was this patch tested?
   
   * `TestOMSortDatanodes`: all 6 tests pass, the 3 rewritten read-path tests 
and the 3 unchanged write-path tests.
   * Checkstyle and PMD on `ozone-manager` and `ozone-integration-test`.
   
   Build:
   https://github.com/rajeshkumarchandolu/ozone/actions/runs/40860344967


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to