github.com/m3db/m3@v1.5.0/scripts/docker-integration-tests/dedicated_etcd_embedded_coordinator/test.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  set -xe
     4  
     5  source "$M3_PATH"/scripts/docker-integration-tests/common.sh
     6  REVISION=$(git rev-parse HEAD)
     7  SCRIPT_PATH="$M3_PATH"/scripts/docker-integration-tests/dedicated_etcd_embedded_coordinator
     8  COMPOSE_FILE=$SCRIPT_PATH/docker-compose.yml
     9  export REVISION
    10  
    11  echo "Run etcd and m3dbnode containers"
    12  docker-compose -f ${COMPOSE_FILE} up -d --renew-anon-volumes etcd01
    13  docker-compose -f ${COMPOSE_FILE} up -d --renew-anon-volumes dbnode01
    14  
    15  DUMP_DIR="${SCRIPT_PATH}/dump"
    16  DUMP_ZIP="${DUMP_DIR}/dump.zip"
    17  
    18  function defer {
    19    if [ -d $DUMP_DIR ]; then 
    20      rm -rf $DUMP_DIR
    21    fi
    22    docker-compose -f ${COMPOSE_FILE} down || echo "unable to shutdown containers" # CI fails to stop all containers sometimes
    23  }
    24  trap defer EXIT
    25  
    26  # Should be able to setup single db node with custom environment and zone
    27  # using the embedded coordinator without special headers
    28  DBNODE_ID="dbnode01" ZONE="bar-zone" setup_single_m3db_node
    29  
    30  echo "Test the debug dump endpoint works with custom env and zone"
    31  mkdir -p $DUMP_DIR
    32  curl -s http://localhost:9004/debug/dump > $DUMP_ZIP
    33  
    34  unzip -d $DUMP_DIR $DUMP_ZIP
    35  
    36  EXPECTED_FILES="cpu.prof heap.prof goroutine.prof host.json namespace.json placement-m3db.json"
    37  for file in $(echo "${EXPECTED_FILES}" | tr " " "\n"); do
    38    if ! [ -f "${DUMP_DIR}/${file}" ]; then
    39      echo "Expected ${file} but not in dump:"
    40      echo $(ls $DUMP_DIR)
    41      exit 1
    42    fi
    43  done