From dbf08c872acfc7883d70a38cde8eaec6ceed2da6 Mon Sep 17 00:00:00 2001 From: Lei313 <47049042+ThinkerLei@users.noreply.github.com> Date: Tue, 12 Mar 2024 12:25:33 +0800 Subject: [PATCH] HDFS-17422. Enhance the stability of the unit test TestDFSAdmin (#6621). Contributed by lei w and Hualong Zhang. Signed-off-by: He Xiaoqiao --- .../org/apache/hadoop/hdfs/tools/TestDFSAdmin.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSAdmin.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSAdmin.java index 451a419aa1..392866e86e 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSAdmin.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSAdmin.java @@ -1353,8 +1353,14 @@ public void testDecommissionDataNodesReconfig() decommissioningNode1.getIpcPort(); String node2Addr = decommissioningNode2.getIpAddr() + ":" + decommissioningNode2.getIpcPort(); - assertTrue(outsForFinishReconf.get(0).contains(node1Addr) - && outsForFinishReconf.get(0).contains(node2Addr)); + int finishedReconfCount = 0; + for (String outMessage : outsForFinishReconf) { + finishedReconfCount = outMessage.contains(node1Addr) ? + finishedReconfCount + 1 : finishedReconfCount + 0; + finishedReconfCount = outMessage.contains(node2Addr) ? + finishedReconfCount + 1 : finishedReconfCount + 0; + } + assertTrue(finishedReconfCount == 2); } }