devmadhuu commented on code in PR #7071:
URL: https://github.com/apache/ozone/pull/7071#discussion_r1716282406
##########
hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/fsck/TestContainerHealthTask.java:
##########
@@ -384,6 +385,55 @@ public void testDeletedContainer() throws Exception {
.isGreaterThan(currentTime);
}
+ @Test
+ public void testAllContainerStateInsertions() {
+ // Set up DAOs and Schema Manager
+ UnhealthyContainersDao unHealthyContainersTableHandle =
+ getDao(UnhealthyContainersDao.class);
+
+ ContainerHealthSchemaManager containerHealthSchemaManager =
+ new ContainerHealthSchemaManager(
+ getSchemaDefinition(ContainerSchemaDefinition.class),
+ unHealthyContainersTableHandle);
+
+ // Iterate through each state in the UnHealthyContainerStates enum
+ for (ContainerSchemaDefinition.UnHealthyContainerStates state :
+ ContainerSchemaDefinition.UnHealthyContainerStates.values()) {
+ // Create a dummy UnhealthyContainer record with the current state
+ UnhealthyContainers unhealthyContainer = new UnhealthyContainers();
+ unhealthyContainer.setContainerId(state.ordinal() + 1L); // Ensure
unique ID for each state
+ unhealthyContainer.setExpectedReplicaCount(3);
+ unhealthyContainer.setActualReplicaCount(1);
+ unhealthyContainer.setReplicaDelta(2);
+ unhealthyContainer.setContainerState(state.name());
Review Comment:
Though it will not impact test case purpose, but for each
`UnhealthyContainerState`, expected replica count and actual replica count will
differ. Currently what you have set in test is a Under replicated container ,
but in a loop setting container state same for all iterations.
--
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]