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 4f3e767b69 HDDS-6493. Improve TestOmKeyInfoCodec error handling (#3718)
4f3e767b69 is described below

commit 4f3e767b69374ad932683d7c6e67f99513be7b93
Author: Harsha R <[email protected]>
AuthorDate: Thu Aug 25 22:50:01 2022 +0530

    HDDS-6493. Improve TestOmKeyInfoCodec error handling (#3718)
---
 .../hadoop/ozone/om/codec/TestOmKeyInfoCodec.java  | 45 +++++++++-------------
 1 file changed, 19 insertions(+), 26 deletions(-)

diff --git 
a/hadoop-ozone/interface-storage/src/test/java/org/apache/hadoop/ozone/om/codec/TestOmKeyInfoCodec.java
 
b/hadoop-ozone/interface-storage/src/test/java/org/apache/hadoop/ozone/om/codec/TestOmKeyInfoCodec.java
index 96a53ebc4b..24a1e809bd 100644
--- 
a/hadoop-ozone/interface-storage/src/test/java/org/apache/hadoop/ozone/om/codec/TestOmKeyInfoCodec.java
+++ 
b/hadoop-ozone/interface-storage/src/test/java/org/apache/hadoop/ozone/om/codec/TestOmKeyInfoCodec.java
@@ -40,7 +40,7 @@ import java.util.List;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
+
 
 /**
  * This class tests OmKeyInfoCodec.
@@ -92,43 +92,36 @@ public class TestOmKeyInfoCodec {
   }
 
   @Test
-  public void test() {
+  public void test() throws IOException {
     testOmKeyInfoCodecWithoutPipeline(1);
     testOmKeyInfoCodecWithoutPipeline(2);
     testOmKeyInfoCodecCompatibility(1);
     testOmKeyInfoCodecCompatibility(2);
   }
 
-  public void testOmKeyInfoCodecWithoutPipeline(int chunkNum) {
+  public void testOmKeyInfoCodecWithoutPipeline(int chunkNum)
+      throws IOException {
     OmKeyInfoCodec codec = new OmKeyInfoCodec(true);
     OmKeyInfo originKey = getKeyInfo(chunkNum);
-    try {
-      byte[] rawData = codec.toPersistedFormat(originKey);
-      OmKeyInfo key = codec.fromPersistedFormat(rawData);
-      System.out.println("Chunk number = " + chunkNum +
-          ", Serialized key size without pipeline = " + rawData.length);
-      assertNull(key.getLatestVersionLocations().getLocationList().get(0)
-          .getPipeline());
-      assertNotNull(key.getFileChecksum());
-      assertEquals(key.getFileChecksum(), checksum);
-    } catch (IOException e) {
-      fail("Should success");
-    }
+    byte[] rawData = codec.toPersistedFormat(originKey);
+    OmKeyInfo key = codec.fromPersistedFormat(rawData);
+    System.out.println("Chunk number = " + chunkNum +
+        ", Serialized key size without pipeline = " + rawData.length);
+    assertNull(key.getLatestVersionLocations().getLocationList().get(0)
+        .getPipeline());
+    assertNotNull(key.getFileChecksum());
+    assertEquals(key.getFileChecksum(), checksum);
   }
 
-  public void testOmKeyInfoCodecCompatibility(int chunkNum) {
+  public void testOmKeyInfoCodecCompatibility(int chunkNum) throws IOException 
{
     OmKeyInfoCodec codecWithoutPipeline = new OmKeyInfoCodec(true);
     OmKeyInfoCodec codecWithPipeline = new OmKeyInfoCodec(false);
     OmKeyInfo originKey = getKeyInfo(chunkNum);
-    try {
-      byte[] rawData = codecWithPipeline.toPersistedFormat(originKey);
-      OmKeyInfo key = codecWithoutPipeline.fromPersistedFormat(rawData);
-      System.out.println("Chunk number = " + chunkNum +
-          ", Serialized key size with pipeline = " + rawData.length);
-      assertNotNull(key.getLatestVersionLocations().getLocationList().get(0)
-          .getPipeline());
-    } catch (IOException e) {
-      fail("Should success");
-    }
+    byte[] rawData = codecWithPipeline.toPersistedFormat(originKey);
+    OmKeyInfo key = codecWithoutPipeline.fromPersistedFormat(rawData);
+    System.out.println("Chunk number = " + chunkNum +
+        ", Serialized key size with pipeline = " + rawData.length);
+    assertNotNull(key.getLatestVersionLocations().getLocationList().get(0)
+        .getPipeline());
   }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to