navinko commented on code in PR #11275:
URL: https://github.com/apache/ozone/pull/11275#discussion_r4061494781


##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/balancer/TestContainerBalancer.java:
##########
@@ -459,6 +460,59 @@ public void testRejectInvalidStartupConfiguration() throws 
Exception {
     assertSame(ContainerBalancerTask.Status.STOPPED, 
containerBalancer.getBalancerStatus());
   }
 
+  /**
+   * Verifies that a start request rejected during validation does not update 
startedAt of last run.
+   * Prevents startedAt from advancing past stoppedAt, which previously caused 
a negative duration and CLI status crash.
+   */
+  @Test
+  public void testRejectedStartDoesNotModifyStartedAt() throws Exception {
+    // The test first starts and immediately stops the balancer normally.This 
creates a realistic "previous state"
+    // in system memory and later trigger a bad request and verify that 
startedAt remains identical to startedAtBefore,
+    // rather than being wrongly overwritten with "now", which would make 
startedAt come after stoppedAt which resulted
+    // negative balancing duration.

Review Comment:
   corrected the comment.



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