Sha256: 6ffd9ed45e13feb285a5b1f0a637d9dfc9bc16ed1dd6e7b29e76724df899fd66

Contents?: true

Size: 1.12 KB

Versions: 7

Compression:

Stored size: 1.12 KB

Contents

#!/bin/bash
set -uo pipefail

err=0
trap 'err=1' ERR
trap 'exit 1' SIGINT

function print_header() {
  if [[ ${CI:="0"} == "1" ]]; then
    printf "+++ :kubernetes: %s\n" "${1}"
  else
    printf "\n\n\033[0;35m⎈   %s\033[0m\n" "${1}"
  fi
}

if [[ ${PARALLELISM:=0} -lt 1 ]]; then
  if [[ $(uname) == "Darwin" ]]; then
    num_cpus=$(sysctl -n hw.ncpu)
  else
    num_cpus=$(nproc --all)
  fi

  if [[ $num_cpus -le 2 ]]; then
    PARALLELISM=1
  else
    (( PARALLELISM=num_cpus ))
  fi
fi

if [[ "${CI:-0}" != "0" ]]; then
  SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
  echo "kind-kind" > "${SCRIPT_DIR}/../.local-context"
  PARALLELISM=2
fi

test_type=$1


case $test_type in
  cli_test | unit_test | serial_integration_test)
    print_header $test_type
    bundle exec rake $test_type
    ;;

  integration_test)
    print_header "Run Parallel Integration Tests (MT_CPU=$PARALLELISM)"
    PARALLELIZE_ME=1 MT_CPU=$PARALLELISM bundle exec rake integration_test
    ;;

  *)
    echo "Argument must be one of: unit_test, cli_test, serial_integration_test, integration_test"
    ;;
esac

test $err -eq 0

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
krane-3.7.0 bin/test
krane-3.6.2 bin/test
krane-3.6.1 bin/test
krane-3.5.2 bin/test
krane-3.5.1 bin/test
krane-3.5.0 bin/test
krane-3.4.2 bin/test