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


##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestOzoneManagerHASnapshot.java:
##########
@@ -125,38 +124,24 @@ 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.
+    response = store.snapshotDiff(volumeName, bucketName, snapshot1,
+        snapshot2, null, 0, false, false);
+    assertEquals(IN_PROGRESS, response.getJobStatus());

Review Comment:
   Just curious why we have to check if the job status here is `IN_PROGRESS`, 
though not likely, could the job finish and become `DONE` status before 
`cluster.shutdownOzoneManager(omLeader);`?
   
   In the case above, the test becomes flaky again because of `DONE` != 
`IN_PROGRESS`.
   
   Can we remove ` assertEquals(IN_PROGRESS, response.getJobStatus());` here 
and only check `DONE` in the while loop below?



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