mirror of
https://github.com/project-zot/zot.git
synced 2026-06-16 20:38:08 +08:00
Manage builds with different combinations of extensions
Files were added to be built whether an extension is on or off. New build tags were added for each extension, while minimal and extended disappeared. added custom binary naming depending on extensions used and changed references from binary to binary-extended added automated blackbox tests for sync, search, scrub, metrics added contributor guidelines Signed-off-by: Alex Stan <alexandrustan96@yahoo.ro>
This commit is contained in:
committed by
Ramkumar Chinchani
parent
616d5f8a6d
commit
ada21ed842
@@ -0,0 +1,87 @@
|
||||
ROOT_DIR=$(git rev-parse --show-toplevel)
|
||||
TEST_DATA_DIR=${ROOT_DIR}/test/data/
|
||||
OS="${OS:-linux}"
|
||||
ARCH="${ARCH:-amd64}"
|
||||
ZOT_PATH=${ROOT_DIR}/bin/zot-${OS}-${ARCH}
|
||||
ZOT_MINIMAL_PATH=${ROOT_DIR}/bin/zot-${OS}-${ARCH}-minimal
|
||||
|
||||
mkdir -p ${TEST_DATA_DIR}
|
||||
|
||||
function verify_prerequisites {
|
||||
if [ ! -f ${BATS_RUN_TMPDIR}/.firstrun ]; then
|
||||
env | grep proxy >&3
|
||||
touch ${BATS_RUN_TMPDIR}/.firstrun
|
||||
fi
|
||||
|
||||
if [ ! -f ${ZOT_PATH} ]; then
|
||||
echo "you need to build ${ZOT_PATH} before running the tests" >&3
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ ! -f ${ZOT_MINIMAL_PATH} ]; then
|
||||
echo "you need to build ${ZOT_MINIMAL_PATH} before running tests" >&3
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ ! command -v curl ] &>/dev/null; then
|
||||
echo "you need to install curl as a prerequisite to running the tests" >&3
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ ! command -v jq ] &>/dev/null; then
|
||||
echo "you need to install jq as a prerequisite to running the tests" >&3
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ ! command -v skopeo ] &>/dev/null; then
|
||||
echo "you need to install skopeo as a prerequisite to running the tests" >&3
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
function zot_serve() {
|
||||
local zot_path=${1}
|
||||
local config_file=${2}
|
||||
local pid_dir=${3}
|
||||
${zot_path} serve ${config_file} &
|
||||
echo $! >>${pid_dir}/zot.pid
|
||||
}
|
||||
|
||||
function zot_stop() {
|
||||
local pid_dir=${1}
|
||||
cat ${pid_dir}/zot.pid
|
||||
kill $(cat ${pid_dir}/zot.pid)
|
||||
rm ${pid_dir}/zot.pid
|
||||
}
|
||||
|
||||
function zot_minimal_stop() {
|
||||
local pid_dir=${1}
|
||||
kill $(cat ${pid_dir}/zot-minimal.pid)
|
||||
rm ${pid_dir}/zot-minimal.pid
|
||||
}
|
||||
|
||||
function setup_zot_file_level() {
|
||||
local config_file=${1}
|
||||
zot_serve ${ZOT_PATH} ${config_file} ${BATS_FILE_TMPDIR}
|
||||
}
|
||||
|
||||
function setup_zot_minimal_file_level() {
|
||||
local config_file=${1}
|
||||
zot_serve ${ZOT_MINIMAL_PATH} ${config_file} ${BATS_FILE_TMPDIR}
|
||||
}
|
||||
|
||||
function teardown_zot_file_level() {
|
||||
zot_stop ${BATS_FILE_TMPDIR}
|
||||
}
|
||||
|
||||
function wait_zot_reachable() {
|
||||
zot_url=${1}
|
||||
curl --connect-timeout 3 \
|
||||
--max-time 3 \
|
||||
--retry 10 \
|
||||
--retry-delay 0 \
|
||||
--retry-max-time 60 \
|
||||
--retry-connrefused \
|
||||
${zot_url}
|
||||
}
|
||||
Reference in New Issue
Block a user