peterxcli commented on code in PR #11299:
URL: https://github.com/apache/ozone/pull/11299#discussion_r4071409318


##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestOzoneManagerHASnapshot.java:
##########
@@ -125,38 +124,21 @@ public void testSnapshotDiffWhenOmLeaderRestart()
 
     assertEquals(IN_PROGRESS, response.getJobStatus());
 
-    String oldLeader = cluster.getOMLeader().getOMNodeId();
-
     OzoneManager omLeader = cluster.getOMLeader();
     cluster.shutdownOzoneManager(omLeader);
     cluster.restartOzoneManager(omLeader, true);
 
     cluster.waitForLeaderOM();
 
-    String newLeader = cluster.getOMLeader().getOMNodeId();
-
-    if (Objects.equals(oldLeader, newLeader)) {
-      // If old leader becomes leader again. Job should be done by this time.
-      response = store.snapshotDiff(volumeName, bucketName,
-          snapshot1, snapshot2, null, 0, false, false);
-      assertEquals(DONE, response.getJobStatus());
-      assertEquals(100, response.getSnapshotDiffReport().getDiffList().size());
-    } else {
-      // If new leader is different from old leader. SnapDiff request will be
-      // new to OM, and job status should be IN_PROGRESS.
+    while (true) {
       response = store.snapshotDiff(volumeName, bucketName, snapshot1,
-          snapshot2, null, 0, false, false);
-      assertEquals(IN_PROGRESS, response.getJobStatus());
-      while (true) {
-        response = store.snapshotDiff(volumeName, bucketName, snapshot1,
-                snapshot2, null, 0, false, false);
-        if (DONE == response.getJobStatus()) {
-          assertEquals(100,
-              response.getSnapshotDiffReport().getDiffList().size());
-          break;
-        }
-        Thread.sleep(response.getWaitTimeInMs());
+              snapshot2, null, 0, false, false);
+      if (DONE == response.getJobStatus()) {
+        assertEquals(100,
+            response.getSnapshotDiffReport().getDiffList().size());
+        break;

Review Comment:
   nit:
   ```suggestion
         // wait till snapshot diff job is done.
         do {
           response = store.snapshotDiff(volumeName, bucketName, snapshot1,
               snapshot2, null, 0, false, false);
           Thread.sleep(response.getWaitTimeInMs());
         } while (DONE != response.getJobStatus());
         assertEquals(100, 
response.getSnapshotDiffReport().getDiffList().size());
   
   ```



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