[
https://issues.apache.org/jira/browse/HDFS-17225?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17775172#comment-17775172
]
Ayush Saxena commented on HDFS-17225:
-
Fails in assertion, forĀ
{{{}decommissionDuration{}}}, asserting the duration seems to be a bad idea, we
fetch the value from Mbean then from Namenode directly, if we have latency b/w
both calls, this duration will always be different.
Easy to reproduce:
Put a sleep
{code:java}
Map> decomNodes =
(Map>) JSON.parse(decomNodesInfo);
+ Thread.sleep(2000);
assertEquals(fsn.getDecomNodes(), decomNodesInfo);
assertEquals(fsn.getNumDecommissioningDataNodes(), decomNodes.size());
{code}
I think we should remove {{decommissionDuration}} from the comparison. If there
is some Json util which removes it from the String, that can be used. Else we
already have a map above.
Change the code like this:
{code:java}
// Remove decommissionDuration to avoid flakiness
decomNodes.values().forEach(x -> x.remove("decommissionDuration"));
Map> decomNodesFsn =
(Map>) JSON.parse(fsn.getDecomNodes());
decomNodesFsn.values().forEach(x -> x.remove("decommissionDuration"));
assertEquals(decomNodesFsn, decomNodes);
{code}
And remove this {{assertEquals(fsn.getDecomNodes(), decomNodesInfo);}}
> Fix TestNameNodeMXBean#testDecommissioningNodes
> ---
>
> Key: HDFS-17225
> URL: https://issues.apache.org/jira/browse/HDFS-17225
> Project: Hadoop HDFS
> Issue Type: Improvement
>Reporter: Ayush Saxena
>Priority: Major
>
> Fails in assertion
> {noformat}
> org.junit.ComparisonFailure: expected:<...commissionDuration":[2]}}> but
> was:<...commissionDuration":[1]}}>
> at org.junit.Assert.assertEquals(Assert.java:117)
> at org.junit.Assert.assertEquals(Assert.java:146)
> at
> org.apache.hadoop.hdfs.server.namenode.TestNameNodeMXBean.testDecommissioningNodes(TestNameNodeMXBean.java:432){noformat}
> [https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-6185/1/testReport/org.apache.hadoop.hdfs.server.namenode/TestNameNodeMXBean/testDecommissioningNodes/]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
-
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org