mitsa-ng commented on code in PR #12134:
URL: https://github.com/apache/ozone/pull/12134#discussion_r4697178333


##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/ha/TestSCMConfiguration.java:
##########
@@ -202,27 +201,35 @@ public void testSCMConfig() throws Exception {
 
     assertEquals(port++,
         conf.getInt(ConfUtils.addKeySuffixes(OZONE_SCM_RATIS_PORT_KEY,
-        scmServiceId, "scm1"), 9999));
-
+            scmServiceId, "scm1"), 9999));
+  }
 
+  @Test
+  public void testScmRatisServerConfigRaftProperties() {
     final ScmRatisServerConfig scmRatisConfig = conf.getObject(
         ScmRatisServerConfig.class);
     assertEquals(0, scmRatisConfig.getLogAppenderWaitTimeMin(),
         "getLogAppenderWaitTimeMin");
-
-    conf.set(HddsConfigKeys.OZONE_METADATA_DIRS, tempDir.getPath());
-
-    final RaftProperties p = RatisUtil.newRaftProperties(conf);
-    final TimeDuration t = RaftServerConfigKeys.Log.Appender.waitTimeMin(p);
-    assertEquals(TimeDuration.ZERO, t,
+    assertEquals(TimeDuration.ZERO,
+        RaftServerConfigKeys.Log.Appender.waitTimeMin(
+            RatisUtil.newRaftProperties(conf)),
+        RaftServerConfigKeys.Log.Appender.WAIT_TIME_MIN_KEY);
+    scmRatisConfig.setLogAppenderWaitTimeMin(7);
+    conf.setFromObject(scmRatisConfig);
+    assertEquals(TimeDuration.valueOf(7, TimeUnit.MILLISECONDS),
+        RaftServerConfigKeys.Log.Appender.waitTimeMin(
+            RatisUtil.newRaftProperties(conf)),
         RaftServerConfigKeys.Log.Appender.WAIT_TIME_MIN_KEY);
 
-    assertFalse(scmRatisConfig.isAppendEntriesComposeEnabled(), 
"isAppendEntriesComposeEnabled");
-    assertFalse(RaftServerConfigKeys.Log.appendEntriesComposeEnabled(p),
+    assertFalse(scmRatisConfig.isAppendEntriesComposeEnabled(),
+        "isAppendEntriesComposeEnabled");
+    assertFalse(RaftServerConfigKeys.Log.appendEntriesComposeEnabled(
+            RatisUtil.newRaftProperties(conf)),
         RaftServerConfigKeys.Log.APPEND_ENTRIES_COMPOSE_ENABLED_KEY);
     scmRatisConfig.setAppendEntriesComposeEnabled(true);
     conf.setFromObject(scmRatisConfig);
-    
assertTrue(RaftServerConfigKeys.Log.appendEntriesComposeEnabled(RatisUtil.newRaftProperties(conf)),
+    assertTrue(RaftServerConfigKeys.Log.appendEntriesComposeEnabled(
+            RatisUtil.newRaftProperties(conf)),
         RaftServerConfigKeys.Log.APPEND_ENTRIES_COMPOSE_ENABLED_KEY);
   }

Review Comment:
   @F64116045 confirmed by running it. Without the `RatisUtil` change this test 
still passes: `newRaftProperties` ends with a prefix copy of 
`ozone.scm.ha.raft.server.*`, so the raw key reaches Ratis on its own. It only 
fails when that raw key is absent, which is the HDDS-17700 case.
   
   a4043ead makes the test cover that case by hiding the raw key from the 
prefix copy. Without the fix it now fails with `expected: <0ns> but was: 
<1ms>`. With the fix `TestSCMConfiguration` is 7/7 and `checkstyle:check` is 
clean.
   



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