load helpers_zot 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 jq) ]; then echo "you need to install jq 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 # Download test data to folder common for the entire suite, not just this file skopeo --insecure-policy copy --format=oci docker://ghcr.io/project-zot/test-images/busybox:1.36 oci:${TEST_DATA_DIR}/busybox:1.36 # Setup zot server local zot_root_dir=${BATS_FILE_TMPDIR}/zot local zot_config_file=${BATS_FILE_TMPDIR}/zot_config.json local 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} echo ${zot_root_dir} >&3 mkdir -p ${zot_root_dir} cat > ${zot_config_file}< ${BATS_FILE_TMPDIR}/mnist.onnx.check sha256_out=$(sha256sum ${BATS_FILE_TMPDIR}/mnist.onnx.check | awk '{print $1}') [ "$sha256_in" = "$sha256_out" ] }