This is an automated email from the ASF dual-hosted git repository.

myskov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new f7b428d784 HDDS-11503. Add Robot test to verify Container Balancer for 
EC containers. (#7311)
f7b428d784 is described below

commit f7b428d784b68df7e9c116bdf0bd2b4cb7e5007b
Author: Daniil Prizva <[email protected]>
AuthorDate: Fri Oct 18 08:49:41 2024 +0300

    HDDS-11503. Add Robot test to verify Container Balancer for EC containers. 
(#7311)
---
 .../compose/ozone-balancer/docker-compose.yaml     | 46 ++++++++++++++++++++++
 .../compose/ozone-balancer/{test.sh => test-ec.sh} |  8 ++--
 .../ozone-balancer/{test.sh => test-ratis.sh}      |  8 ++--
 .../src/main/smoketest/balancer/testBalancer.robot | 21 +++++-----
 4 files changed, 66 insertions(+), 17 deletions(-)

diff --git 
a/hadoop-ozone/dist/src/main/compose/ozone-balancer/docker-compose.yaml 
b/hadoop-ozone/dist/src/main/compose/ozone-balancer/docker-compose.yaml
index 5220d71669..e2d7272b03 100644
--- a/hadoop-ozone/dist/src/main/compose/ozone-balancer/docker-compose.yaml
+++ b/hadoop-ozone/dist/src/main/compose/ozone-balancer/docker-compose.yaml
@@ -39,6 +39,8 @@ services:
       volumes:
          - tmpfs1:/data
          - ../..:/opt/hadoop
+      deploy:
+         replicas: ${DATANODE1_REPLICA:-1}
    datanode2:
       <<: *common-config
       ports:
@@ -50,6 +52,8 @@ services:
       volumes:
          - tmpfs2:/data
          - ../..:/opt/hadoop
+      deploy:
+         replicas: ${DATANODE2_REPLICA:-1}
    datanode3:
       <<: *common-config
       ports:
@@ -61,6 +65,8 @@ services:
       volumes:
          - tmpfs3:/data
          - ../..:/opt/hadoop
+      deploy:
+         replicas: ${DATANODE3_REPLICA:-1}
    datanode4:
       <<: *common-config
       ports:
@@ -72,6 +78,34 @@ services:
       volumes:
          - tmpfs4:/data
          - ../..:/opt/hadoop
+      deploy:
+         replicas: ${DATANODE4_REPLICA:-1}
+   datanode5:
+      <<: *common-config
+      ports:
+         - 19864
+         - 9882
+      environment:
+         <<: *replication
+      command: [ "ozone","datanode" ]
+      volumes:
+         - tmpfs5:/data
+         - ../..:/opt/hadoop
+      deploy:
+         replicas: ${DATANODE5_REPLICA:-1}
+   datanode6:
+      <<: *common-config
+      ports:
+         - 19864
+         - 9882
+      environment:
+         <<: *replication
+      command: [ "ozone","datanode" ]
+      volumes:
+         - tmpfs6:/data
+         - ../..:/opt/hadoop
+      deploy:
+         replicas: ${DATANODE6_REPLICA:-1}
    om1:
       <<: *common-config
       environment:
@@ -175,3 +209,15 @@ volumes:
          o: "size=1g,uid=4000"
          device: tmpfs
          type: tmpfs
+   tmpfs5:
+      driver: local
+      driver_opts:
+         o: "size=1g,uid=5000"
+         device: tmpfs
+         type: tmpfs
+   tmpfs6:
+      driver: local
+      driver_opts:
+         o: "size=1g,uid=6000"
+         device: tmpfs
+         type: tmpfs
\ No newline at end of file
diff --git a/hadoop-ozone/dist/src/main/compose/ozone-balancer/test.sh 
b/hadoop-ozone/dist/src/main/compose/ozone-balancer/test-ec.sh
similarity index 79%
copy from hadoop-ozone/dist/src/main/compose/ozone-balancer/test.sh
copy to hadoop-ozone/dist/src/main/compose/ozone-balancer/test-ec.sh
index e79979877b..7365d104fa 100644
--- a/hadoop-ozone/dist/src/main/compose/ozone-balancer/test.sh
+++ b/hadoop-ozone/dist/src/main/compose/ozone-balancer/test-ec.sh
@@ -17,7 +17,7 @@
 
 #suite:balancer
 
-COMPOSE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
+COMPOSE_DIR="$( cd "$( dirname "${BASH_SOURCE0}" )" >/dev/null 2>&1 && pwd )"
 export COMPOSE_DIR
 export OM_SERVICE_ID="om"
 export OM=om1
@@ -27,7 +27,5 @@ export OZONE_REPLICATION_FACTOR=3
 # shellcheck source=/dev/null
 source "$COMPOSE_DIR/../testlib.sh"
 
-# We need 4 dataNodes in this tests
-start_docker_env 4
-
-execute_robot_test ${OM} balancer/testBalancer.robot
+start_docker_env
+execute_robot_test ${OM} -v REPLICATION:rs-3-2-1024k -v TYPE:EC -v KEYS:7 -v 
LOWER_LIMIT:1.5 -v UPPER_LIMIT:2.5 -N ozone-balancer-EC 
balancer/testBalancer.robot
diff --git a/hadoop-ozone/dist/src/main/compose/ozone-balancer/test.sh 
b/hadoop-ozone/dist/src/main/compose/ozone-balancer/test-ratis.sh
similarity index 82%
rename from hadoop-ozone/dist/src/main/compose/ozone-balancer/test.sh
rename to hadoop-ozone/dist/src/main/compose/ozone-balancer/test-ratis.sh
index e79979877b..a358aea79a 100644
--- a/hadoop-ozone/dist/src/main/compose/ozone-balancer/test.sh
+++ b/hadoop-ozone/dist/src/main/compose/ozone-balancer/test-ratis.sh
@@ -24,10 +24,12 @@ export OM=om1
 export SCM=scm1
 export OZONE_REPLICATION_FACTOR=3
 
+export DATANODE2_REPLICA=0
+export DATANODE5_REPLICA=0
+
 # shellcheck source=/dev/null
 source "$COMPOSE_DIR/../testlib.sh"
 
-# We need 4 dataNodes in this tests
-start_docker_env 4
+start_docker_env
 
-execute_robot_test ${OM} balancer/testBalancer.robot
+execute_robot_test ${OM} -v REPLICATION:THREE -v TYPE:RATIS -v KEYS:3 -v 
LOWER_LIMIT:3 -v UPPER_LIMIT:3.5 -N ozone-balancer-RATIS 
balancer/testBalancer.robot
diff --git a/hadoop-ozone/dist/src/main/smoketest/balancer/testBalancer.robot 
b/hadoop-ozone/dist/src/main/smoketest/balancer/testBalancer.robot
index 4299afe5f2..06d8a3416f 100644
--- a/hadoop-ozone/dist/src/main/smoketest/balancer/testBalancer.robot
+++ b/hadoop-ozone/dist/src/main/smoketest/balancer/testBalancer.robot
@@ -16,6 +16,7 @@
 *** Settings ***
 Documentation       Smoketest ozone cluster startup
 Library             OperatingSystem
+Library             String
 Library             Collections
 Resource            ../commonlib.robot
 Resource            ../ozone-lib/shell.robot
@@ -35,7 +36,7 @@ Prepare For Tests
     Execute             dd if=/dev/urandom of=/tmp/100mb bs=1048576 count=100
     Run Keyword if      '${SECURITY_ENABLED}' == 'true'     Kinit test user    
testuser    testuser.keytab
     Execute                 ozone sh volume create /${VOLUME}
-    Execute                 ozone sh bucket create /${VOLUME}/${BUCKET}
+    Execute                 ozone sh bucket create --replication 
${REPLICATION} --type ${TYPE} /${VOLUME}/${BUCKET}
 
 
 Datanode In Maintenance Mode
@@ -67,7 +68,7 @@ Run Container Balancer
 Wait Finish Of Balancing
     ${result} =             Execute                         ozone admin 
containerbalancer status
                             Should Contain                  ${result}          
   ContainerBalancer is Running.
-                            Wait Until Keyword Succeeds      3min    10sec    
ContainerBalancer is Not Running
+                            Wait Until Keyword Succeeds      6min    10sec    
ContainerBalancer is Not Running
                             Sleep                   60000ms
 
 Verify Verbose Balancer Status
@@ -111,7 +112,7 @@ Create Multiple Keys
             ${fileName} =           Set Variable            file-${INDEX}.txt
             ${key} =    Set Variable    /${VOLUME}/${BUCKET}/${fileName}
             LOG             ${fileName}
-            Create Key    ${key}    ${file}
+            Create Key    ${key}    ${file}    --replication=${REPLICATION} 
--type=${TYPE}
             Key Should Match Local File    ${key}      ${file}
     END
 
@@ -126,14 +127,14 @@ Get Uuid
 
 Close All Containers
     FOR     ${INDEX}    IN RANGE    15
-        ${container} =      Execute          ozone admin container list 
--state OPEN | jq -r 'select(.replicationConfig.replicationFactor == "THREE") | 
.containerID' | head -1
+        ${container} =      Execute          ozone admin container list 
--state OPEN | jq -r 'select(.replicationConfig.data == 3) | .containerID' | 
head -1
         EXIT FOR LOOP IF    "${container}" == "${EMPTY}"
                             ${message} =    Execute And Ignore Error    ozone 
admin container close "${container}"
                             Run Keyword If    '${message}' != '${EMPTY}'      
Should Contain   ${message}   is in closing state
         ${output} =         Execute          ozone admin container info 
"${container}"
                             Should contain   ${output}   CLOS
     END
-    Wait until keyword succeeds    3min    10sec    All container is closed
+    Wait until keyword succeeds    4min    10sec    All container is closed
 
 All container is closed
     ${output} =         Execute           ozone admin container list --state 
OPEN
@@ -146,7 +147,7 @@ Get Datanode Ozone Used Bytes Info
     [return]          ${result}
 
 ** Test Cases ***
-Verify Container Balancer for RATIS containers
+Verify Container Balancer for RATIS/EC containers
     Prepare For Tests
 
     Datanode In Maintenance Mode
@@ -154,7 +155,7 @@ Verify Container Balancer for RATIS containers
     ${uuid} =                   Get Uuid
     Datanode Usageinfo          ${uuid}
 
-    Create Multiple Keys          3
+    Create Multiple Keys          ${KEYS}
 
     Close All Containers
 
@@ -175,8 +176,10 @@ Verify Container Balancer for RATIS containers
 
     ${datanodeOzoneUsedBytesInfoAfterContainerBalancing} =    Get Datanode 
Ozone Used Bytes Info          ${uuid}
     Should Not Be Equal As Integers     ${datanodeOzoneUsedBytesInfo}    
${datanodeOzoneUsedBytesInfoAfterContainerBalancing}
-    Should Be True    ${datanodeOzoneUsedBytesInfoAfterContainerBalancing} < 
${SIZE} * 3.5
-    Should Be True    ${datanodeOzoneUsedBytesInfoAfterContainerBalancing} > 
${SIZE} * 3
+    #We need to ensure that after balancing, the amount of data recorded on 
each datanode falls within the following ranges:
+    #{SIZE}*3 < used < {SIZE}*3.5 for RATIS containers, and {SIZE}*1.5 < used 
< {SIZE}*2.5 for EC containers.
+    Should Be True    ${datanodeOzoneUsedBytesInfoAfterContainerBalancing} < 
${SIZE} * ${UPPER_LIMIT}
+    Should Be True    ${datanodeOzoneUsedBytesInfoAfterContainerBalancing} > 
${SIZE} * ${LOWER_LIMIT}
 
 
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to