adoroszlai commented on PR #6409:
URL: https://github.com/apache/ozone/pull/6409#issuecomment-2009029707

   Thanks @will-sh for the patch.
   
   > Some tests likely cannot use the same cluster, if I comment out all the 
`startCluster()` and `shutdown()`, the below OM dummyException happens
   
   This happens due to the mock manager objects created by some of the tests, 
e.g.:
   
   
https://github.com/apache/ozone/blob/aee32f507ac98f5eb88e1e590a19d6535d57228c/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOmMetrics.java#L192-L200
   
   We can avoid creating a new cluster by restoring the original manager 
objects at the end of the tests, like:
   
   ```java
   HddsWhiteboxTestUtils.setInternalState(ozoneManager, "volumeManager", 
volumeManager);
   ```
   
   I suggest changing `mockWritePathExceptions` to return the original 
`metadataManager`, so that the caller can save it in a local variable and 
restore it at the end of the test.
   
   ```java
   OMMetadataManager metadataManager = 
mockWritePathExceptions(OmVolumeArgs.class);
   
   ...
   
   HddsWhiteboxTestUtils.setInternalState(ozoneManager, "metadataManager", 
metadataManager);
   ```


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