2022-11-22 20:29:57 +02:00
ROOT_DIR = $( git rev-parse --show-toplevel)
2023-11-15 20:44:31 +02:00
TEST_DATA_DIR = ${ ROOT_DIR } /test/data
2022-11-22 20:29:57 +02:00
OS = " ${ OS :- linux } "
ARCH = " ${ ARCH :- amd64 } "
ZOT_PATH = ${ ROOT_DIR } /bin/zot-${ OS } -${ ARCH }
2023-04-07 19:49:24 +03:00
mkdir -p ${ TEST_DATA_DIR }
2022-11-22 20:29:57 +02:00
function verify_prerequisites {
if [ ! -f ${ ZOT_PATH } ] ; then
echo " you need to build ${ ZOT_PATH } before running the tests " >& 3
return 1
fi
2023-08-30 22:24:28 +03:00
if [ ! $( command -v skopeo) ] ; then
2022-11-22 20:29:57 +02:00
echo "you need to install skopeo as a prerequisite to running the tests" >& 3
return 1
fi
2023-08-30 22:24:28 +03:00
if [ ! $( command -v awslocal) ] & >/dev/null; then
2022-11-22 20:29:57 +02:00
echo "you need to install aws cli as a prerequisite to running the tests" >& 3
return 1
fi
return 0
}
function zot_serve_strace( ) {
local config_file = ${ 1 }
strace -o "strace.txt" -f -e trace = openat ${ ZOT_PATH } serve ${ config_file } &
}
2023-04-07 19:49:24 +03:00
function zot_serve( ) {
local config_file = ${ 1 }
${ ZOT_PATH } serve ${ config_file } &
}
2022-11-22 20:29:57 +02:00
function zot_stop( ) {
pkill zot
}
function wait_zot_reachable( ) {
2023-08-30 22:24:28 +03:00
local zot_port = ${ 1 }
local zot_url = http://127.0.0.1:${ zot_port } /v2/_catalog
2022-11-22 20:29:57 +02:00
curl --connect-timeout 3 \
2023-04-07 19:49:24 +03:00
--max-time 10 \
2022-11-22 20:29:57 +02:00
--retry 10 \
--retry-delay 0 \
2023-04-07 19:49:24 +03:00
--retry-max-time 120 \
2022-11-22 20:29:57 +02:00
--retry-connrefused \
${ zot_url }
}