# Note: Intended to be run as "make run-blackbox-tests" or "make run-blackbox-dedupe-nightly" # 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_cloud load helpers_wait 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/alpine:3.17.3 oci:${TEST_DATA_DIR}/alpine:1 # Setup zot server local zot_root_dir=${BATS_FILE_TMPDIR}/zot local zot_config_file_dedupe=${BATS_FILE_TMPDIR}/zot_config_dedupe.json local zot_config_file_nodedupe=${BATS_FILE_TMPDIR}/zot_config_nodedupe.json local ZOT_LOG_FILE_DEDUPE=${BATS_FILE_TMPDIR}/zot-log-dedupe.json local ZOT_LOG_FILE_NODEDUPE=${BATS_FILE_TMPDIR}/zot-log-nodedupe.json touch ${ZOT_LOG_FILE_NODEDUPE} mkdir -p ${zot_root_dir} cat > ${zot_config_file_dedupe}< ${zot_config_file_nodedupe}<&3 run wait_for_string "dedupe rebuild: finished" ${ZOT_LOG_FILE} "5m" [ "$status" -eq 0 ] end=`date +%s` runtime=$((end-start)) echo "restoring blobs finished in $runtime sec" >&3 sleep 10 # wait a bit more because dedupe runs in background. } @test "pulling a previous deduped image should work" { wait_zot_reachable 8080 # alpine1 should have original blobs already echo "pulling first image" >&3 run skopeo --insecure-policy copy --src-tls-verify=false \ docker://127.0.0.1:8080/alpine1:1 \ oci:${TEST_DATA_DIR}/alpine1:1 [ "$status" -eq 0 ] echo "pulling second image" >&3 # alpine2 should have original blobs after restoring blobs run skopeo --insecure-policy copy --src-tls-verify=false \ docker://127.0.0.1:8080/alpine2:1 \ oci:${TEST_DATA_DIR}/alpine2:1 [ "$status" -eq 0 ] }