Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blobcacheinfo,test: blobs must be resued when pushing across registry #5153

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions tests/blobcache.bats
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,41 @@ function _check_matches() {
expect_output --from="$unmatched" "$5" "$6 should not match"
}

# Integration test for https://github.com/containers/image/pull/1645
@test "blobcache: blobs must be reused when pushing across registry" {
start_registry
run_buildah login --tls-verify=false --authfile ${TEST_SCRATCH_DIR}/test.auth --username testuser --password testpassword localhost:${REGISTRY_PORT}
outputdir=${TEST_SCRATCH_DIR}/outputdir
mkdir -p ${outputdir}
run podman run --rm --mount type=bind,src=${TEST_SCRATCH_DIR}/test.auth,target=/test.auth,Z --mount type=bind,src=${outputdir},target=/output,Z --net host quay.io/skopeo/stable copy --preserve-digests --authfile=/test.auth --tls-verify=false docker://registry.fedoraproject.org/fedora-minimal dir:/output

run_buildah rmi --all -f
run_buildah pull dir:${outputdir}
run_buildah images -a --format '{{.ID}}'
cid=$output
run_buildah --log-level debug push --tls-verify=false --authfile ${TEST_SCRATCH_DIR}/test.auth $cid docker://localhost:${REGISTRY_PORT}/test
# must not contain "Skipping blob" since push must happen
assert "$output" !~ "Skipping blob"

# Clear local image and c/image's blob-info-cache
run_buildah rmi --all -f
if is_rootless;
then
run rm $HOME/.local/share/containers/cache/blob-info-cache-v1.sqlite
assert "$status" -eq 0 "status of `run rm $HOME/.local/share/containers/cache/blob-info-cache-v1.sqlite` must be 0"
else
run rm /var/lib/containers/cache/blob-info-cache-v1.sqlite
assert "$status" -eq 0 "status of `run rm /var/lib/containers/cache/blob-info-cache-v1.sqlite` must be 0"
fi

# In first push blob must be skipped after vendoring https://github.com/containers/image/pull/1645
run_buildah pull dir:${outputdir}
run_buildah images -a --format '{{.ID}}'
cid=$output
run_buildah --log-level debug push --tls-verify=false --authfile ${TEST_SCRATCH_DIR}/test.auth $cid docker://localhost:${REGISTRY_PORT}/test
expect_output --substring "Skipping blob"
}

@test "blobcache-commit" {
blobcachedir=${TEST_SCRATCH_DIR}/cache
mkdir -p ${blobcachedir}
Expand Down
Loading