github.com/hyperledger-labs/bdls@v2.1.1+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 -eu
    12  
    13  fabric_dir="$(cd "$(dirname "$0")/.." && pwd)"
    14  cd ${fabric_dir}
    15  
    16  declare -a test_dirs
    17  test_dirs=($(
    18   go list -f '{{if or (len .TestGoFiles | ne 0) (len .XTestGoFiles | ne 0)}}{{println .Dir}}{{end}}' ./... | \
    19   grep integration | \
    20   sed "s,${fabric_dir},.,g"
    21  ))
    22  
    23  total_agents=${SYSTEM_TOTALJOBSINPHASE:-1}   # standard VSTS variables available using parallel execution; total number of parallel jobs running
    24  agent_number=${SYSTEM_JOBPOSITIONINPHASE:-1} # current job position
    25  
    26  declare -a dirs
    27  test_count=${#test_dirs[@]}
    28  for ((i = "$agent_number"; i <= "$test_count"; )); do
    29    dirs+=("${test_dirs[$i - 1]}")
    30    i=$((${i} + ${total_agents}))
    31  done
    32  
    33  printf "\nRunning the following test suites:\n\n$(echo ${dirs[*]} | tr -s ' ' '\n')\n\nStarting tests...\n\n"
    34  ginkgo -keepGoing --slowSpecThreshold 60 ${dirs[*]}