zotregistry.io/zot@v1.4.4-0.20231124084042-02a8ed785457/test/blackbox/helpers_cloud.bash (about) 1 ROOT_DIR=$(git rev-parse --show-toplevel) 2 TEST_DATA_DIR=${ROOT_DIR}/test/data 3 OS="${OS:-linux}" 4 ARCH="${ARCH:-amd64}" 5 ZOT_PATH=${ROOT_DIR}/bin/zot-${OS}-${ARCH} 6 7 mkdir -p ${TEST_DATA_DIR} 8 9 function verify_prerequisites { 10 if [ ! -f ${ZOT_PATH} ]; then 11 echo "you need to build ${ZOT_PATH} before running the tests" >&3 12 return 1 13 fi 14 15 if [ ! $(command -v skopeo) ]; then 16 echo "you need to install skopeo as a prerequisite to running the tests" >&3 17 return 1 18 fi 19 20 if [ ! $(command -v awslocal) ] &>/dev/null; then 21 echo "you need to install aws cli as a prerequisite to running the tests" >&3 22 return 1 23 fi 24 25 return 0 26 } 27 28 function zot_serve_strace() { 29 local config_file=${1} 30 strace -o "strace.txt" -f -e trace=openat ${ZOT_PATH} serve ${config_file} & 31 } 32 33 function zot_serve() { 34 local config_file=${1} 35 ${ZOT_PATH} serve ${config_file} & 36 } 37 38 function zot_stop() { 39 pkill zot 40 } 41 42 function wait_zot_reachable() { 43 local zot_port=${1} 44 local zot_url=http://127.0.0.1:${zot_port}/v2/_catalog 45 curl --connect-timeout 3 \ 46 --max-time 10 \ 47 --retry 10 \ 48 --retry-delay 0 \ 49 --retry-max-time 120 \ 50 --retry-connrefused \ 51 ${zot_url} 52 }