smengcl commented on code in PR #10862:
URL: https://github.com/apache/ozone/pull/10862#discussion_r3710415606


##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestOMDBCheckpointServletInodeBasedXferNonLeader.java:
##########
@@ -77,4 +81,35 @@ void 
processMetadataSnapshotRequestSetsStatusWhenSendErrorFails() throws Excepti
 
     verify(response).setStatus(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
   }
+
+  @ParameterizedTest
+  @ValueSource(booleans = {false, true})
+  void processMetadataSnapshotRequestDoesNotReturn503WhenLeader(boolean 
isLeaderReady) throws Exception {
+    OMDBCheckpointServletInodeBasedXfer servlet =
+        spy(new OMDBCheckpointServletInodeBasedXfer());
+    OzoneManager om = mock(OzoneManager.class);
+    when(om.isLeader()).thenReturn(true);
+    when(om.isLeaderReady()).thenReturn(isLeaderReady);

Review Comment:
   The `isLeaderReady` parameter does not affect production behavior here. The 
servlet calls `isLeader()`, which is independently stubbed to `true`, while the 
parameter is passed only to the unused `isLeaderReady()` stub. Both 
parameterized cases therefore exercise the same path, and the test would still 
pass if `OzoneManager.isLeader()` incorrectly rejected `LEADER_AND_NOT_READY`. 
Could this directly verify `isLeader()` against all three `RaftServerStatus` 
values?



##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestOMDBCheckpointServletInodeBasedXferNonLeader.java:
##########
@@ -31,6 +32,9 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import org.apache.hadoop.ozone.OzoneConsts;
+import org.apache.hadoop.ozone.lock.BootstrapStateHandler;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;

Review Comment:
   This import order fails Ozone checkstyle because 
`org.junit.jupiter.api.Test` must precede the `org.junit.jupiter.params` 
imports. Could you move it above `ParameterizedTest` and `ValueSource`? The 
checkstyle job will otherwise fail when full CI runs.



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