瀏覽代碼

HDDS-1793. Acceptance test of ozone-topology cluster is failing

Closes #1096
Doroszlai, Attila 5 年之前
父節點
當前提交
c5e3ab5a4d

+ 0 - 6
hadoop-ozone/dist/src/main/compose/ozone-topology/docker-compose.yaml

@@ -19,7 +19,6 @@ services:
    datanode_1:
       image: apache/ozone-runner:${HADOOP_RUNNER_VERSION}
       privileged: true #required by the profiler
-      container_name: datanode_1
       volumes:
         - ../..:/opt/hadoop
       ports:
@@ -34,7 +33,6 @@ services:
    datanode_2:
       image: apache/ozone-runner:${HADOOP_RUNNER_VERSION}
       privileged: true #required by the profiler
-      container_name: datanode_2
       volumes:
         - ../..:/opt/hadoop
       ports:
@@ -49,7 +47,6 @@ services:
    datanode_3:
       image: apache/ozone-runner:${HADOOP_RUNNER_VERSION}
       privileged: true #required by the profiler
-      container_name: datanode_3
       volumes:
         - ../..:/opt/hadoop
       ports:
@@ -64,7 +61,6 @@ services:
    datanode_4:
       image: apache/ozone-runner:${HADOOP_RUNNER_VERSION}
       privileged: true #required by the profiler
-      container_name: datanode_4
       volumes:
         - ../..:/opt/hadoop
       ports:
@@ -79,7 +75,6 @@ services:
    om:
       image: apache/ozone-runner:${HADOOP_RUNNER_VERSION}
       privileged: true #required by the profiler
-      container_name: om
       volumes:
          - ../..:/opt/hadoop
       ports:
@@ -95,7 +90,6 @@ services:
    scm:
       image: apache/ozone-runner:${HADOOP_RUNNER_VERSION}
       privileged: true #required by the profiler
-      container_name: scm
       volumes:
          - ../..:/opt/hadoop
       ports:

+ 1 - 1
hadoop-ozone/dist/src/main/compose/ozone-topology/test.sh

@@ -21,7 +21,7 @@ export COMPOSE_DIR
 # shellcheck source=/dev/null
 source "$COMPOSE_DIR/../testlib.sh"
 
-start_docker_env
+start_docker_env 4
 
 #Due to the limitation of the current auditparser test, it should be the
 #first test in a clean cluster.

+ 17 - 11
hadoop-ozone/dist/src/main/compose/testlib.sh

@@ -28,9 +28,12 @@ mkdir -p "$RESULT_DIR"
 #Should be writeable from the docker containers where user is different.
 chmod ogu+w "$RESULT_DIR"
 
-## @description wait until 3 datanodes are up (or 30 seconds)
+## @description wait until datanodes are up (or 30 seconds)
 ## @param the docker-compose file
+## @param number of datanodes to wait for (default: 3)
 wait_for_datanodes(){
+  local compose_file=$1
+  local -i datanode_count=${2:-3}
 
   #Reset the timer
   SECONDS=0
@@ -40,19 +43,19 @@ wait_for_datanodes(){
 
      #This line checks the number of HEALTHY datanodes registered in scm over the
      # jmx HTTP servlet
-     datanodes=$(docker-compose -f "$1" exec -T scm curl -s 'http://localhost:9876/jmx?qry=Hadoop:service=SCMNodeManager,name=SCMNodeManagerInfo' | jq -r '.beans[0].NodeCount[] | select(.key=="HEALTHY") | .value')
-      if [[ "$datanodes" == "3" ]]; then
+     datanodes=$(docker-compose -f "${compose_file}" exec -T scm curl -s 'http://localhost:9876/jmx?qry=Hadoop:service=SCMNodeManager,name=SCMNodeManagerInfo' | jq -r '.beans[0].NodeCount[] | select(.key=="HEALTHY") | .value')
+     if [[ "$datanodes" ]]; then
+       if [[ ${datanodes} -ge ${datanode_count} ]]; then
 
-        #It's up and running. Let's return from the function.
+         #It's up and running. Let's return from the function.
          echo "$datanodes datanodes are up and registered to the scm"
          return
-      else
+       else
 
-         #Print it only if a number. Could be not a number if scm is not yet started
-         if [[ "$datanodes" ]]; then
-            echo "$datanodes datanode is up and healthy (until now)"
+           #Print it only if a number. Could be not a number if scm is not yet started
+           echo "$datanodes datanode is up and healthy (until now)"
          fi
-      fi
+     fi
 
       sleep 2
    done
@@ -60,10 +63,13 @@ wait_for_datanodes(){
 }
 
 ## @description  Starts a docker-compose based test environment
+## @param number of datanodes to start and wait for (default: 3)
 start_docker_env(){
+  local -i datanode_count=${1:-3}
+
   docker-compose -f "$COMPOSE_FILE" down
-  docker-compose -f "$COMPOSE_FILE" up -d --scale datanode=3
-  wait_for_datanodes "$COMPOSE_FILE"
+  docker-compose -f "$COMPOSE_FILE" up -d --scale datanode="${datanode_count}"
+  wait_for_datanodes "$COMPOSE_FILE" "${datanode_count}"
   sleep 10
 }