ayushtkn commented on code in PR #5698:
URL: https://github.com/apache/ozone/pull/5698#discussion_r1409477795


##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/scm/TestGetCommittedBlockLengthAndPutKey.java:
##########
@@ -110,12 +115,21 @@ public void tesGetCommittedBlockLength() throws Exception 
{
         ContainerTestHelper
             .getPutBlockRequest(pipeline, writeChunkRequest.getWriteChunk());
     client.sendCommand(putKeyRequest);
-    response = ContainerProtocolCalls
-        .getCommittedBlockLength(client, blockID, null);
+    GenericTestUtils.waitFor(() -> {
+      boolean success = true;
+      try {
+        response[0] = ContainerProtocolCalls
+            .getCommittedBlockLength(client, blockID, null);
+      } catch (IOException e) {
+        success = false;
+        LOG.error("Ignore the exception till wait: {}", e.getMessage());
+      }
+      return success;
+    }, 1000, 5000);
     // make sure the block ids in the request and response are same.
     Assertions.assertTrue(
-        BlockID.getFromProtobuf(response.getBlockID()).equals(blockID));
-    Assertions.assertTrue(response.getBlockLength() == data.length);
+        BlockID.getFromProtobuf(response[0].getBlockID()).equals(blockID));
+    Assertions.assertTrue(response[0].getBlockLength() == data.length);

Review Comment:
   This should be ``assertEquals`` I believe rather than doing equals inside 
``assertTrue``
   
   ```
       
Assertions.assertEquals(BlockID.getFromProtobuf(response[0].getBlockID()), 
blockID);
       Assertions.assertEquals(response[0].getBlockLength(), data.length);
   ```



##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/scm/TestGetCommittedBlockLengthAndPutKey.java:
##########
@@ -110,12 +115,21 @@ public void tesGetCommittedBlockLength() throws Exception 
{
         ContainerTestHelper
             .getPutBlockRequest(pipeline, writeChunkRequest.getWriteChunk());
     client.sendCommand(putKeyRequest);
-    response = ContainerProtocolCalls
-        .getCommittedBlockLength(client, blockID, null);
+    GenericTestUtils.waitFor(() -> {
+      boolean success = true;
+      try {
+        response[0] = ContainerProtocolCalls
+            .getCommittedBlockLength(client, blockID, null);
+      } catch (IOException e) {
+        success = false;
+        LOG.error("Ignore the exception till wait: {}", e.getMessage());
+      }
+      return success;
+    }, 1000, 5000);

Review Comment:
   this would be 5 tries I believe, did you try how much time does it take, if 
it is fast you can explore reducing 1000 to a lower number



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