DaveTeng0 commented on code in PR #6078:
URL: https://github.com/apache/ozone/pull/6078#discussion_r1466962997
##########
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/helpers/TestContainerUtils.java:
##########
@@ -122,6 +127,23 @@ public void testDatanodeIDPersistent(@TempDir File
tempDir) throws Exception {
assertWriteRead(tempDir, id1);
}
+ @Test
+ public void testVerifyInconsistentChecksumShouldFail() throws Exception {
+ ContainerData containerData = mock(ContainerData.class);
+ when(containerData.getContainerType()).thenReturn(
+ ContainerProtos.ContainerType.KeyValueContainer);
+ // mock to return different checksum
+ when(containerData.getChecksum()).thenReturn("checksum1", "checksum2");
+
conf.setBoolean(HddsConfigKeys.HDDS_CONTAINER_CHECKSUM_VERIFICATION_ENABLED,
true);
+ try {
+ ContainerUtils.verifyChecksum(containerData, conf);
+ fail("code should not reach here, exception should have been thrown.");
+ } catch (Exception e) {
+ assertTrue(e.getMessage().contains("Container checksum error"));
Review Comment:
yeah agree!
--
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]