# Note: Intended to be run as "make run-blackbox-tests" or "make run-blackbox-ci" # Makefile target installs & checks all necessary tooling # Extra tools that are not covered in Makefile target needs to be added in verify_prerequisites() load helpers_zot load helpers_metrics function verify_prerequisites() { if [ ! $(command -v curl) ]; then echo "you need to install curl as a prerequisite to running the tests" >&3 return 1 fi if [ ! $(command -v htpasswd) ]; then echo "you need to install htpasswd as a prerequisite to running the tests" >&3 return 1 fi return 0 } function setup_file() { # verify prerequisites are available if ! $(verify_prerequisites); then exit 1 fi # Setup zot server zot_root_dir=${BATS_FILE_TMPDIR}/zot echo ${zot_root_dir} >&3 zot_log_file=${zot_root_dir}/zot-log.json zot_config_file=${BATS_FILE_TMPDIR}/zot_config.json zot_htpasswd_file=${BATS_FILE_TMPDIR}/zot_htpasswd zot_port=$(get_free_port) echo ${zot_port} > ${BATS_FILE_TMPDIR}/zot.port htpasswd -Bbn ${AUTH_USER} ${AUTH_PASS} >> ${zot_htpasswd_file} htpasswd -Bbn ${METRICS_USER} ${METRICS_PASS} >> ${zot_htpasswd_file} mkdir -p ${zot_root_dir} touch ${zot_log_file} cat >${zot_config_file} <