Skip to content

Commit 25d5571

Browse files
committed
Fix TestDFSAdmin#testAllDatanodesReconfig fails
1 parent ecba359 commit 25d5571

File tree

1 file changed

+14
-2
lines changed
  • hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools

1 file changed

+14
-2
lines changed

hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSAdmin.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
import org.apache.hadoop.security.UserGroupInformation;
9090
import org.apache.hadoop.security.authorize.DefaultImpersonationProvider;
9191
import org.apache.hadoop.test.GenericTestUtils;
92+
import org.apache.hadoop.test.LambdaTestUtils;
9293
import org.apache.hadoop.test.PathUtils;
9394
import org.apache.hadoop.util.Lists;
9495
import org.apache.hadoop.util.ToolRunner;
@@ -1236,8 +1237,7 @@ public Integer run() throws Exception {
12361237

12371238
@Test
12381239
@Order(1)
1239-
public void testAllDatanodesReconfig()
1240-
throws IOException, InterruptedException, TimeoutException {
1240+
public void testAllDatanodesReconfig() throws Exception {
12411241
ReconfigurationUtil reconfigurationUtil = mock(ReconfigurationUtil.class);
12421242
cluster.getDataNodes().get(0).setReconfigurationUtil(reconfigurationUtil);
12431243
cluster.getDataNodes().get(1).setReconfigurationUtil(reconfigurationUtil);
@@ -1251,6 +1251,18 @@ public void testAllDatanodesReconfig()
12511251

12521252
int result = admin.startReconfiguration("datanode", "livenodes");
12531253
assertThat(result).isEqualTo(0);
1254+
LambdaTestUtils.await(10000, 100, () -> {
1255+
List<String> outs = new ArrayList<>();
1256+
List<String> errs = new ArrayList<>();
1257+
try {
1258+
getReconfigurationStatus("datanode", "livenodes", outs, errs);
1259+
} catch (IOException | InterruptedException e) {
1260+
LOG.error(String.format(
1261+
"call getReconfigurationStatus on datanode[livenodes] failed."), e);
1262+
}
1263+
return !outs.isEmpty() && outs.get(0).contains("finished");
1264+
});
1265+
12541266
final List<String> outsForStartReconf = new ArrayList<>();
12551267
final List<String> errsForStartReconf = new ArrayList<>();
12561268
reconfigurationOutErrFormatter("startReconfiguration", "datanode",

0 commit comments

Comments
 (0)