load helpers_pushpull 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/golang:1.19 oci:${TEST_DATA_DIR}/golang:1.19 # Setup zot server local zot_root_dir=${BATS_FILE_TMPDIR}/zot local zot_config_file=${BATS_FILE_TMPDIR}/zot_config.json local oci_data_dir=${BATS_FILE_TMPDIR}/oci mkdir -p ${zot_root_dir} mkdir -p ${oci_data_dir} cat > ${zot_config_file}< config.json echo "hello world" > artifact.txt run oras push --plain-http 127.0.0.1:8080/hello-artifact:v2 \ --config config.json:application/vnd.acme.rocket.config.v1+json artifact.txt:text/plain -d -v [ "$status" -eq 0 ] rm -f artifact.txt rm -f config.json } @test "pull oras artifact" { run oras pull --plain-http 127.0.0.1:8080/hello-artifact:v2 -d -v [ "$status" -eq 0 ] grep -q "hello world" artifact.txt rm -f artifact.txt } @test "push helm chart" { run helm package ${BATS_FILE_TMPDIR}/helm-charts/charts/zot [ "$status" -eq 0 ] local chart_version=$(awk '/version/{printf $2}' ${BATS_FILE_TMPDIR}/helm-charts/charts/zot/Chart.yaml) run helm push zot-${chart_version}.tgz oci://localhost:8080/zot-chart [ "$status" -eq 0 ] } @test "pull helm chart" { local chart_version=$(awk '/version/{printf $2}' ${BATS_FILE_TMPDIR}/helm-charts/charts/zot/Chart.yaml) run helm pull oci://localhost:8080/zot-chart/zot --version ${chart_version} [ "$status" -eq 0 ] } @test "push image with regclient" { run regctl registry set localhost:8080 --tls disabled [ "$status" -eq 0 ] run regctl image copy ocidir://${TEST_DATA_DIR}/golang:1.19 localhost:8080/test-regclient [ "$status" -eq 0 ] } @test "pull image with regclient" { run regctl image copy localhost:8080/test-regclient ocidir://${TEST_DATA_DIR}/golang:1.19 [ "$status" -eq 0 ] } @test "list repositories with regclient" { run regctl repo ls localhost:8080 [ "$status" -eq 0 ] found=0 for i in "${lines[@]}" do if [ "$i" = 'test-regclient' ]; then found=1 fi done [ "$found" -eq 1 ] } @test "list image tags with regclient" { run regctl tag ls localhost:8080/test-regclient [ "$status" -eq 0 ] found=0 for i in "${lines[@]}" do if [ "$i" = 'latest' ]; then found=1 fi done [ "$found" -eq 1 ] } @test "push manifest with regclient" { manifest=$(regctl manifest get localhost:8080/test-regclient --format=raw-body) run regctl manifest put localhost:8080/test-regclient:1.0.0 --format oci --content-type application/vnd.oci.image.manifest.v1+json --format oci <