github.com/yacovm/fabric@v2.0.0-alpha.0.20191128145320-c5d4087dc723+incompatible/scripts/run-integration-tests.sh (about)

     1  #!/bin/bash
     2  #
     3  # Copyright IBM Corp. All Rights Reserved.
     4  #
     5  # SPDX-License-Identifier: Apache-2.0
     6  
     7  # Use ginkgo to run integration tests. If arguments are provided to the
     8  # script, they are treated as the directories containing the tests to run.
     9  # When no arguments are provided, all integration tests are executed.
    10  
    11  set -e -u
    12  
    13  fabric_dir="$(cd "$(dirname "$0")/.." && pwd)"
    14  
    15  # find packages that contain "integration" in the import path
    16  integration_dirs() {
    17      local packages="$1"
    18  
    19      go list -f '{{.Dir}}' "$packages" | grep -E '/integration($|/)' | sed "s,${fabric_dir},.,g"
    20  }
    21  
    22  main() {
    23      cd "$fabric_dir"
    24  
    25      local -a dirs=("$@")
    26      if [ "${#dirs[@]}" -eq 0 ]; then
    27          while IFS=$'\n' read -r pkg; do dirs+=("$pkg"); done < <(integration_dirs "./...")
    28      fi
    29  
    30      echo "Running integration tests..."
    31      ginkgo -keepGoing --slowSpecThreshold 60 "${dirs[@]}"
    32  }
    33  
    34  main "$@"