umamaheswararao commented on code in PR #3489:
URL: https://github.com/apache/ozone/pull/3489#discussion_r891694752


##########
hadoop-ozone/ozonefs-common/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneClientUtils.java:
##########
@@ -72,6 +76,34 @@ public void testEmptyKeyName() throws IOException {
     assertNull(checksum);
   }
 
+  @Test
+  public void testGetFileChecksumForECFileShouldReturnNull()
+      throws IOException {
+    OzoneVolume volume = mock(OzoneVolume.class);
+    OzoneBucket bucket = mock(OzoneBucket.class);
+    ClientProtocol clientProtocol = mock(ClientProtocol.class);
+    OzoneManagerProtocol ozoneManagerProtocol =
+        mock(OzoneManagerProtocol.class);
+    try {
+      OmKeyInfo omKeyInfo = new OmKeyInfo.Builder()
+          .setReplicationConfig(new ECReplicationConfig("rs-3-2-1024K"))
+          .setVolumeName("vol").setBucketName("bucket").setKeyName("mykey")
+          .setDataSize(10).setCreationTime(1).setModificationTime(1).build();
+      Mockito.when(clientProtocol.getOzoneManagerClient())
+          .thenReturn(ozoneManagerProtocol);
+      
Mockito.when(ozoneManagerProtocol.lookupKey(any())).thenReturn(omKeyInfo);
+      FileChecksum checksum = OzoneClientUtils
+          .getFileChecksumWithCombineMode(volume, bucket, "test", 1,
+              OzoneClientConfig.ChecksumCombineMode.MD5MD5CRC, clientProtocol);
+      assertNull(checksum);
+    } finally {
+      Mockito.reset(volume);
+      Mockito.reset(bucket);
+      Mockito.reset(volume);
+      Mockito.reset(volume);

Review Comment:
   Oops, this is my mistake. I meant to clean all other mocks :-)



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