zotregistry.io/zot@v1.4.4-0.20231124084042-02a8ed785457/test/blackbox/ci.sh (about)

     1  #!/bin/bash
     2  
     3  set -e
     4  
     5  BATS_FLAGS=${BATS_FLAGS:-"--print-output-on-failure"}
     6  SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
     7  BATS=${SCRIPTPATH}/../../hack/tools/bin/bats
     8  PATH=$PATH:${SCRIPTPATH}/../../hack/tools/bin
     9  
    10  tests=("pushpull" "pushpull_authn" "delete_images" "referrers" "metadata" "anonymous_policy"
    11         "annotations" "detect_manifest_collision" "cve" "sync" "sync_docker" "sync_replica_cluster"
    12         "scrub" "garbage_collect" "metrics" "metrics_minimal")
    13  
    14  for test in ${tests[*]}; do
    15      ${BATS} ${BATS_FLAGS} ${SCRIPTPATH}/${test}.bats > ${test}.log & pids+=($!)
    16  done
    17  
    18  i=0
    19  success="true"
    20  for pid in ${pids[*]}; do
    21      if ! wait $pid; then
    22          echo "${tests[$i]} test returns an error !!!"
    23          cat ${tests[$i]}.log
    24          success="false"
    25          # we still need to wait for other PIDs to finish for the script to return properly
    26      else
    27          echo "${tests[$i]} test completed successfully."
    28      fi
    29      rm ${tests[$i]}.log
    30      i=$((i+1))
    31  done
    32  
    33  if [ "$success" == "false" ]; then
    34      exit 1
    35  fi
    36  
    37  echo "Successfully run all tests"