[
https://issues.apache.org/jira/browse/HDDS-8750?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17728891#comment-17728891
]
Tsz-wo Sze commented on HDDS-8750:
----------------------------------
{code}
+++
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/ContainerKeyPrefixImpl.java
@@ -88,4 +88,13 @@ public boolean equals(Object o) {
&& Objects.equals(this.keyPrefix, that.keyPrefix)
&& this.keyVersion == that.keyVersion;
}
+
+ @Override
+ public String toString() {
+ return "ContainerKeyPrefixImpl{" +
+ "containerId=" + containerId +
+ ", keyPrefix='" + keyPrefix + '\'' +
+ ", keyVersion=" + keyVersion +
+ '}';
+ }
}
{code}
Added the toString() method above. Then, the failure is
{code}
org.opentest4j.AssertionFailedError:
Expected :ContainerKeyPrefixImpl{containerId=1685752580943,
keyPrefix='TestKeyPrefix', keyVersion=-1}
Actual :ContainerKeyPrefixImpl{containerId=1685752580943, keyPrefix='Test',
keyVersion=7311963922270415224}
<Click to see difference>
at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55)
at
org.junit.jupiter.api.AssertionUtils.failNotEqual(AssertionUtils.java:62)
at
org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
at
org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:177)
at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1141)
at
org.apache.hadoop.ozone.recon.TestReconCodecs.testContainerKeyPrefixCodec(TestReconCodecs.java:47)
...
{code}
> ContainerKeyPrefixCodec and ContainerKeyPrefixCodec are inconsistent
> --------------------------------------------------------------------
>
> Key: HDDS-8750
> URL: https://issues.apache.org/jira/browse/HDDS-8750
> Project: Apache Ozone
> Issue Type: Sub-task
> Reporter: Tsz-wo Sze
> Assignee: Tsz-wo Sze
> Priority: Major
>
> The following change to the test will cause failure.
> {code}
> +++
> b/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/TestReconCodecs.java
> @@ -35,7 +35,7 @@ public class TestReconCodecs {
> @Test
> public void testContainerKeyPrefixCodec() throws IOException {
> ContainerKeyPrefix containerKeyPrefix = ContainerKeyPrefix.get(
> - System.currentTimeMillis(), "TestKeyPrefix", 0);
> + System.currentTimeMillis(), "TestKeyPrefix", -1);
>
> Codec<ContainerKeyPrefix> codec = ContainerKeyPrefixCodec.get();
> byte[] persistedFormat = codec.toPersistedFormat(containerKeyPrefix);
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]