mladjan-gadzic commented on code in PR #4521:
URL: https://github.com/apache/ozone/pull/4521#discussion_r1156181117
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/scm/TestStorageContainerManagerHA.java:
##########
@@ -284,36 +280,80 @@ public void testInvalidHAConfig(boolean isRatisEnabled)
throws Exception {
() -> StorageContainerManager.scmInit(conf, clusterId));
}
-
-
@Test
+ @Timeout(300)
public void testBootStrapSCM() throws Exception {
StorageContainerManager scm2 =
cluster.getStorageContainerManagers().get(1);
OzoneConfiguration conf2 = scm2.getConfiguration();
boolean isDeleted = scm2.getScmStorageConfig().getVersionFile().delete();
- Assert.assertTrue(isDeleted);
+ Assertions.assertTrue(isDeleted);
final SCMStorageConfig scmStorageConfig = new SCMStorageConfig(conf2);
scmStorageConfig.setClusterId(UUID.randomUUID().toString());
scmStorageConfig.getCurrentDir().delete();
scmStorageConfig.setSCMHAFlag(true);
scmStorageConfig.initialize();
conf2.setBoolean(ScmConfigKeys.OZONE_SCM_SKIP_BOOTSTRAP_VALIDATION_KEY,
false);
- Assert.assertFalse(StorageContainerManager.scmBootstrap(conf2));
+ Assertions.assertFalse(StorageContainerManager.scmBootstrap(conf2));
conf2.setBoolean(ScmConfigKeys.OZONE_SCM_SKIP_BOOTSTRAP_VALIDATION_KEY,
true);
- Assert.assertTrue(StorageContainerManager.scmBootstrap(conf2));
+ Assertions.assertTrue(StorageContainerManager.scmBootstrap(conf2));
}
@Test
+ @Timeout(300)
public void testGetRatisRolesDetail() throws IOException {
Set<String> resultSet = new HashSet<>();
for (StorageContainerManager scm: cluster.getStorageContainerManagers()) {
resultSet.addAll(scm.getScmHAManager().getRatisServer().getRatisRoles());
}
System.out.println(resultSet);
- Assert.assertEquals(3, resultSet.size());
- Assert.assertEquals(1,
+ Assertions.assertEquals(3, resultSet.size());
+ Assertions.assertEquals(1,
resultSet.stream().filter(x -> x.contains("LEADER")).count());
}
+
+ @Test
+ @Timeout(300)
+ public void testSCMHAMetrics() throws InterruptedException, TimeoutException
{
+ waitForLeaderToBeReady();
+
+ StorageContainerManager leaderSCM = cluster.getActiveSCM();
+ String leaderSCMId = leaderSCM.getScmId();
+ List<StorageContainerManager> scms =
+ cluster.getStorageContainerManagersList();
+
+ checkSCMHAMetricsForAllSCMs(scms, leaderSCMId);
+ }
Review Comment:
I'd say there is no need for that because SCMHAMetrics are initialized the
way that `leaderId=null`:
https://github.com/mladjan-gadzic/ozone/blob/HDDS-8363/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/StorageContainerManager.java#L1497
Test checks if there is a leader and there is which means it was updated
since it was initialized. Leader is being updated here:
https://github.com/mladjan-gadzic/ozone/blob/HDDS-8363/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMStateMachine.java#L287
--
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]