Copilot commented on code in PR #11171:
URL: https://github.com/apache/ozone/pull/11171#discussion_r3891883823


##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestOmMetadataManager.java:
##########
@@ -163,6 +164,19 @@ public void setup() throws Exception {
     omMetadataManager = new OmMetadataManagerImpl(ozoneConfiguration, null);
   }
 
+  @Test
+  public void testGetMissingLifecycleConfigurationIsNotLoggedAsError() throws 
Exception {
+    LogCapturer logCapturer = 
LogCapturer.captureLogs(OmMetadataManagerImpl.class);
+
+    OMException ex = assertThrows(OMException.class, () ->
+        omMetadataManager.getLifecycleConfiguration("volume1", "bucket1"));
+
+    assertEquals(ResultCodes.LIFECYCLE_CONFIGURATION_NOT_FOUND, 
ex.getResult());
+    // A bucket without a lifecycle configuration is an expected outcome, so 
the
+    // catch-all must not report it with an error and a stack trace.
+    assertFalse(logCapturer.getOutput().contains("Exception while getting 
lifecycle configuration"));
+  }

Review Comment:
   `LogCapturer` implements `AutoCloseable` and should be stopped/closed to 
avoid leaking appenders across tests (which can make later assertions flaky 
and/or grow captured output). Wrap it in try-with-resources (or call 
`stopCapturing()` in a `finally`).



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