2525import org .apache .hadoop .hdds .scm .container .balancer .ContainerBalancerConfiguration ;
2626import org .apache .hadoop .hdds .scm .container .placement .algorithms .SCMContainerPlacementCapacity ;
2727
28- import org .apache .ozone .test .tag .Unhealthy ;
2928import org .junit .jupiter .api .AfterAll ;
3029import org .junit .jupiter .api .BeforeAll ;
3130import org .junit .jupiter .api .Test ;
3231import org .junit .jupiter .api .Timeout ;
3332
3433import java .util .Optional ;
3534
35+ import static java .util .concurrent .TimeUnit .SECONDS ;
36+ import static org .apache .hadoop .hdds .HddsConfigKeys .HDDS_NODE_REPORT_INTERVAL ;
3637import static org .junit .jupiter .api .Assertions .assertFalse ;
3738import static org .junit .jupiter .api .Assertions .assertTrue ;
3839import static org .junit .jupiter .api .Assertions .assertEquals ;
@@ -53,6 +54,8 @@ public static void setup() throws Exception {
5354 ozoneConf = new OzoneConfiguration ();
5455 ozoneConf .setClass (ScmConfigKeys .OZONE_SCM_CONTAINER_PLACEMENT_IMPL_KEY ,
5556 SCMContainerPlacementCapacity .class , PlacementPolicy .class );
57+ ozoneConf .setTimeDuration (HDDS_NODE_REPORT_INTERVAL , 5 , SECONDS );
58+ ozoneConf .setBoolean ("hdds.container.balancer.trigger.du.before.move.enable" , true );
5659 cluster = MiniOzoneCluster .newBuilder (ozoneConf ).setNumDatanodes (3 ).build ();
5760 containerBalancerClient = new ContainerOperationClient (ozoneConf );
5861 cluster .waitForClusterToBeReady ();
@@ -70,9 +73,6 @@ public static void cleanup() throws Exception {
7073 * @throws Exception
7174 */
7275 @ Test
73- @ Unhealthy ("Since the cluster doesn't have " +
74- "unbalanced nodes, ContainerBalancer stops before the assertion checks " +
75- "whether balancer is running." )
7676 public void testContainerBalancerCLIOperations () throws Exception {
7777 // test normally start and stop
7878 boolean running = containerBalancerClient .getContainerBalancerStatus ();
@@ -82,11 +82,11 @@ public void testContainerBalancerCLIOperations() throws Exception {
8282 Optional <Integer > maxDatanodesPercentageToInvolvePerIteration =
8383 Optional .of (100 );
8484 Optional <Long > maxSizeToMovePerIterationInGB = Optional .of (1L );
85- Optional <Long > maxSizeEnteringTargetInGB = Optional .of (1L );
86- Optional <Long > maxSizeLeavingSourceInGB = Optional .of (1L );
87- Optional <Integer > balancingInterval = Optional .of (1 );
88- Optional <Integer > moveTimeout = Optional .of (1 );
89- Optional <Integer > moveReplicationTimeout = Optional .of (1 );
85+ Optional <Long > maxSizeEnteringTargetInGB = Optional .of (6L );
86+ Optional <Long > maxSizeLeavingSourceInGB = Optional .of (6L );
87+ Optional <Integer > balancingInterval = Optional .of (70 );
88+ Optional <Integer > moveTimeout = Optional .of (65 );
89+ Optional <Integer > moveReplicationTimeout = Optional .of (55 );
9090 Optional <Boolean > networkTopologyEnable = Optional .of (false );
9191 Optional <String > includeNodes = Optional .of ("" );
9292 Optional <String > excludeNodes = Optional .of ("" );
@@ -103,7 +103,7 @@ public void testContainerBalancerCLIOperations() throws Exception {
103103 // TODO: this is a temporary implementation for now
104104 // modify this after balancer is fully completed
105105 try {
106- Thread .sleep (100 );
106+ Thread .sleep (20000 );
107107 } catch (InterruptedException e ) { }
108108
109109 running = containerBalancerClient .getContainerBalancerStatus ();
0 commit comments