8989import org .apache .hadoop .security .UserGroupInformation ;
9090import org .apache .hadoop .security .authorize .DefaultImpersonationProvider ;
9191import org .apache .hadoop .test .GenericTestUtils ;
92+ import org .apache .hadoop .test .LambdaTestUtils ;
9293import org .apache .hadoop .test .PathUtils ;
9394import org .apache .hadoop .util .Lists ;
9495import 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 );
@@ -1249,8 +1249,20 @@ public void testAllDatanodesReconfig()
12491249 when (reconfigurationUtil .parseChangedProperties (any (Configuration .class ),
12501250 any (Configuration .class ))).thenReturn (changes );
12511251
1252- int result = admin .startReconfiguration ("datanode" , "livenodes" );
1253- assertThat (result ).isEqualTo (0 );
1252+ LambdaTestUtils .await (3000 , 50 , () -> {
1253+ int result = admin .startReconfiguration ("datanode" , "livenodes" );
1254+ assertThat (result ).isEqualTo (0 );
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