This is an automated email from the ASF dual-hosted git repository.
adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 1789b5d9a1 HDDS-6627. Intermittent failure in
TestGetCommittedBlockLengthAndPutKey (#5698)
1789b5d9a1 is described below
commit 1789b5d9a172cad02947401d64e5fd32094eb9b9
Author: Devesh Kumar Singh <[email protected]>
AuthorDate: Fri Dec 1 20:19:32 2023 +0530
HDDS-6627. Intermittent failure in TestGetCommittedBlockLengthAndPutKey
(#5698)
---
.../scm/TestGetCommittedBlockLengthAndPutKey.java | 36 +++++++++++++++-------
1 file changed, 25 insertions(+), 11 deletions(-)
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/scm/TestGetCommittedBlockLengthAndPutKey.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/scm/TestGetCommittedBlockLengthAndPutKey.java
index e503a48b5c..f236c94571 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/scm/TestGetCommittedBlockLengthAndPutKey.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/scm/TestGetCommittedBlockLengthAndPutKey.java
@@ -42,12 +42,17 @@ import org.apache.hadoop.ozone.MiniOzoneCluster;
import org.apache.hadoop.ozone.OzoneConsts;
import org.apache.hadoop.ozone.container.ContainerTestHelper;
import org.apache.hadoop.ozone.container.common.SCMTestUtils;
-import org.apache.ozone.test.tag.Flaky;
+import org.apache.ozone.test.GenericTestUtils;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.concurrent.atomic.AtomicReference;
import static java.nio.charset.StandardCharsets.UTF_8;
@@ -56,7 +61,8 @@ import static java.nio.charset.StandardCharsets.UTF_8;
*/
@Timeout(300)
public class TestGetCommittedBlockLengthAndPutKey {
-
+ private static final Logger LOG =
+ LoggerFactory.getLogger(TestGetCommittedBlockLengthAndPutKey.class);
private static MiniOzoneCluster cluster;
private static OzoneConfiguration ozoneConfig;
private static StorageContainerLocationProtocolClientSideTranslatorPB
@@ -85,9 +91,9 @@ public class TestGetCommittedBlockLengthAndPutKey {
}
@Test
- @Flaky("HDDS-6627")
public void tesGetCommittedBlockLength() throws Exception {
- ContainerProtos.GetCommittedBlockLengthResponseProto response;
+ final AtomicReference<ContainerProtos.GetCommittedBlockLengthResponseProto>
+ response = new AtomicReference<>();
ContainerWithPipeline container = storageContainerLocationClient
.allocateContainer(SCMTestUtils.getReplicationType(ozoneConfig),
HddsProtos.ReplicationFactor.ONE, OzoneConsts.OZONE);
@@ -99,7 +105,7 @@ public class TestGetCommittedBlockLengthAndPutKey {
BlockID blockID = ContainerTestHelper.getTestBlockID(containerID);
byte[] data =
- RandomStringUtils.random(RandomUtils.nextInt(0, 1024)).getBytes(UTF_8);
+ RandomStringUtils.random(RandomUtils.nextInt(1, 1024)).getBytes(UTF_8);
ContainerProtos.ContainerCommandRequestProto writeChunkRequest =
ContainerTestHelper
.getWriteChunkRequest(container.getPipeline(), blockID,
@@ -110,12 +116,20 @@ public class TestGetCommittedBlockLengthAndPutKey {
ContainerTestHelper
.getPutBlockRequest(pipeline, writeChunkRequest.getWriteChunk());
client.sendCommand(putKeyRequest);
- response = ContainerProtocolCalls
- .getCommittedBlockLength(client, blockID, null);
+ GenericTestUtils.waitFor(() -> {
+ try {
+ response.set(ContainerProtocolCalls
+ .getCommittedBlockLength(client, blockID, null));
+ } catch (IOException e) {
+ LOG.debug("Ignore the exception till wait: {}", e.getMessage());
+ return false;
+ }
+ return true;
+ }, 500, 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);
+ Assertions.assertEquals(blockID,
+ BlockID.getFromProtobuf(response.get().getBlockID()));
+ Assertions.assertEquals(data.length, response.get().getBlockLength());
xceiverClientManager.releaseClient(client, false);
}
@@ -156,7 +170,7 @@ public class TestGetCommittedBlockLengthAndPutKey {
BlockID blockID = ContainerTestHelper.getTestBlockID(containerID);
byte[] data =
- RandomStringUtils.random(RandomUtils.nextInt(0, 1024)).getBytes(UTF_8);
+ RandomStringUtils.random(RandomUtils.nextInt(1, 1024)).getBytes(UTF_8);
ContainerProtos.ContainerCommandRequestProto writeChunkRequest =
ContainerTestHelper
.getWriteChunkRequest(container.getPipeline(), blockID,
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]