github.com/m3db/m3@v1.5.0/scripts/docker-integration-tests/coordinator_noop/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/coordinator_noop 8 COMPOSE_FILE=$SCRIPT_PATH/docker-compose.yml 9 export REVISION 10 11 echo "Run coordinator with no etcd" 12 docker-compose -f ${COMPOSE_FILE} up -d --renew-anon-volumes coordinator01 13 docker-compose -f ${COMPOSE_FILE} up -d --renew-anon-volumes etcd01 14 15 function defer { 16 docker-compose -f ${COMPOSE_FILE} down || echo "unable to shutdown containers" # CI fails to stop all containers sometimes 17 } 18 trap defer EXIT 19 20 I=0 21 RES="" 22 while [[ "$I" -le 5 ]]; do 23 if curl -vvvsSf -X POST localhost:7201/api/v1/services/m3coordinator/placement/init -d '{ 24 "instances": [ 25 { 26 "id": "m3coordinator01", 27 "zone": "embedded", 28 "endpoint": "m3coordinator01:7507", 29 "hostname": "m3coordinator01", 30 "port": 7507 31 } 32 ] 33 }'; then 34 break 35 fi 36 # Need some time for coordinators to come up. 37 sleep 2 38 I=$((I+1)) 39 done 40 41 if ! curl -vvvsSf localhost:7201/api/v1/services/m3coordinator/placement; then 42 echo "could not fetch existing placement" 43 exit 1 44 fi 45 46 QUERY_EXP='{"status":"error","error":"operation not valid for noop client"}' 47 RES=$(curl "localhost:7201/m3query/api/v1/query_range?start=$(date '+%s')&end=$(date '+%s')&step=10&query=foo") 48 if [[ "$RES" != "$QUERY_EXP" ]]; then 49 echo "Expected resp '$QUERY_EXP', GOT '$RES'" 50 exit 1 51 fi