load helpers_sync 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_sync_per_root_dir=${BATS_FILE_TMPDIR}/zot-per local zot_sync_ondemand_root_dir=${BATS_FILE_TMPDIR}/zot-ondemand local zot_sync_per_config_file=${BATS_FILE_TMPDIR}/zot_sync_per_config.json local zot_sync_ondemand_config_file=${BATS_FILE_TMPDIR}/zot_sync_ondemand_config.json local zot_minimal_root_dir=${BATS_FILE_TMPDIR}/zot-minimal local zot_minimal_config_file=${BATS_FILE_TMPDIR}/zot_minimal_config.json local oci_data_dir=${BATS_FILE_TMPDIR}/oci mkdir -p ${zot_sync_per_root_dir} mkdir -p ${zot_sync_ondemand_root_dir} mkdir -p ${zot_minimal_root_dir} mkdir -p ${oci_data_dir} cat >${zot_sync_per_config_file} <${zot_sync_ondemand_config_file} <${zot_minimal_config_file} < config.json echo "hello world" > artifact.txt run oras push --plain-http 127.0.0.1:9000/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 "sync oras artifact periodically" { # # wait for oras artifact to be copied run sleep 5s run oras pull --plain-http 127.0.0.1:8081/hello-artifact:v2 -d -v [ "$status" -eq 0 ] grep -q "hello world" artifact.txt rm -f artifact.txt } @test "sync oras artifact on demand" { run oras pull --plain-http 127.0.0.1:8082/hello-artifact:v2 -d -v [ "$status" -eq 0 ] grep -q "hello world" artifact.txt rm -f artifact.txt } # sync helm chart @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:9000/zot-chart [ "$status" -eq 0 ] } @test "sync helm chart periodically" { # wait for helm chart to be copied run sleep 5s local chart_version=$(awk '/version/{printf $2}' ${BATS_FILE_TMPDIR}/helm-charts/charts/zot/Chart.yaml) run helm pull oci://localhost:8081/zot-chart/zot --version ${chart_version} [ "$status" -eq 0 ] } @test "sync helm chart on demand" { local chart_version=$(awk '/version/{printf $2}' ${BATS_FILE_TMPDIR}/helm-charts/charts/zot/Chart.yaml) run helm pull oci://localhost:8082/zot-chart/zot --version ${chart_version} [ "$status" -eq 0 ] } # sync OCI artifacts @test "push OCI artifact (oci image mediatype) with regclient" { run regctl registry set localhost:9000 --tls disabled run regctl registry set localhost:8081 --tls disabled run regctl registry set localhost:8082 --tls disabled run regctl artifact put localhost:9000/artifact:demo <