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

     1  #!/usr/bin/env bash
     2  
     3  set -ex
     4  
     5  TESTS=(
     6  	scripts/docker-integration-tests/cold_writes_simple/test.sh
     7  	scripts/docker-integration-tests/prometheus_replication/test.sh
     8  	scripts/docker-integration-tests/carbon/test.sh
     9  	scripts/docker-integration-tests/aggregator/test.sh
    10  	scripts/docker-integration-tests/aggregator_legacy/test.sh
    11  	scripts/docker-integration-tests/query_fanout/test.sh
    12  	scripts/docker-integration-tests/repair/test.sh
    13  	scripts/docker-integration-tests/replication/test.sh
    14  	scripts/docker-integration-tests/multi_cluster_write/test.sh
    15  	scripts/docker-integration-tests/coordinator_config_rules/test.sh
    16  	scripts/docker-integration-tests/coordinator_noop/test.sh
    17  	scripts/docker-integration-tests/prom_remote_write_backend/test.sh
    18  )
    19  
    20  # Some systems, including our default Buildkite hosts, don't come with netcat
    21  # installed and we may not have perms to install it. "Install" it in the worst
    22  # possible way.
    23  if ! command -v nc && [[ "$BUILDKITE" == "true" ]]; then
    24  	echo "installing netcat"
    25  	NCDIR="$(mktemp -d)"
    26  
    27  	yumdownloader -y --destdir "$NCDIR" --resolve nc
    28  	(
    29  		cd "$NCDIR"
    30  		RPM=$(find . -maxdepth 1 -name '*.rpm' | tail -n1)
    31  		rpm2cpio "$RPM" | cpio -id
    32  	)
    33  
    34  	export PATH="$PATH:$NCDIR/usr/bin"
    35  
    36  	function cleanup_nc() {
    37  		rm -rf "$NCDIR"
    38  	}
    39  
    40  	trap cleanup_nc EXIT
    41  fi
    42  
    43  if [[ -z "$SKIP_SETUP" ]] || [[ "$SKIP_SETUP" == "false" ]]; then
    44  	scripts/docker-integration-tests/setup.sh
    45  fi
    46  
    47  NUM_TESTS=${#TESTS[@]}
    48  MIN_IDX=$((NUM_TESTS*BUILDKITE_PARALLEL_JOB/BUILDKITE_PARALLEL_JOB_COUNT))
    49  MAX_IDX=$(((NUM_TESTS*(BUILDKITE_PARALLEL_JOB+1)/BUILDKITE_PARALLEL_JOB_COUNT)-1))
    50  
    51  ITER=0
    52  for test in "${TESTS[@]}"; do
    53  	if [[ $ITER -ge $MIN_IDX && $ITER -le $MAX_IDX ]]; then
    54  		# Ensure all docker containers have been stopped so we don't run into issues
    55  		# trying to bind ports.
    56  		docker rm -f $(docker ps -aq) 2>/dev/null || true
    57  		echo "----------------------------------------------"
    58  		echo "running $test"
    59  		if ! (export M3_PATH=$(pwd) && $test); then
    60  			echo "--- :bk-status-failed: $test FAILED"
    61  			exit 1
    62  		fi
    63  	fi
    64  	ITER="$((ITER+1))"
    65  done