Add a test for forcing compression and v2s2 format

This highlights a bug in common where the compression format is reset if the format is v2s2, even if its a valid compression format.

Signed-off-by: James Hewitt <james.hewitt@uk.ibm.com>
This commit is contained in:
James Hewitt 2024-11-25 16:10:56 +00:00
parent b3c02684fd
commit 48ae52c08b
No known key found for this signature in database
GPG Key ID: EA6C3C654B6193E4
1 changed files with 41 additions and 0 deletions

View File

@ -141,6 +141,47 @@ var _ = Describe("Podman push", func() {
Expect(output).To(ContainSubstring("zstd"))
})
It("push test --force-compression --format=v2s2", func() {
if podmanTest.Host.Arch == "ppc64le" {
Skip("No registry image for ppc64le")
}
if isRootless() {
err := podmanTest.RestoreArtifact(REGISTRY_IMAGE)
Expect(err).ToNot(HaveOccurred())
}
lock := GetPortLock("5005")
defer lock.Unlock()
session := podmanTest.Podman([]string{"run", "-d", "--name", "registry", "-p", "5005:5000", REGISTRY_IMAGE, "/entrypoint.sh", "/etc/docker/registry/config.yml"})
session.WaitWithDefaultTimeout()
Expect(session).Should(ExitCleanly())
if !WaitContainerReady(podmanTest, "registry", "listening on", 20, 1) {
Skip("Cannot start docker registry.")
}
session = podmanTest.Podman([]string{"build", "-t", "imageone", "build/basicalpine"})
session.WaitWithDefaultTimeout()
Expect(session).Should(ExitCleanly())
push := podmanTest.Podman([]string{"push", "-q", "--tls-verify=false", "--force-compression=true", "--compression-format", "gzip", "--format", "v2s2", "--remove-signatures", "imageone", "localhost:5005/image"})
push.WaitWithDefaultTimeout()
Expect(push).Should(ExitCleanly())
skopeoInspect := []string{"inspect", "--tls-verify=false", "--raw", "docker://localhost:5005/image:latest"}
skopeo := SystemExec("skopeo", skopeoInspect)
skopeo.WaitWithDefaultTimeout()
Expect(skopeo).Should(ExitCleanly())
output := skopeo.OutputToString()
Expect(output).To(ContainSubstring("gzip"))
push = podmanTest.Podman([]string{"push", "-q", "--tls-verify=false", "--force-compression=true", "--compression-format", "zstd", "--format", "v2s2", "--remove-signatures", "imageone", "localhost:5005/image"})
push.WaitWithDefaultTimeout()
// the command is asking for an impossible thing; per containers/common#1869, we should detect
// that and fail with a precise error, but that does not exist, so we end up reporting this
// misleading text. When that is resolved, this test will need updating.
Expect(push).Should(ExitWithError(125, "cannot use ForceCompressionFormat with undefined default compression format"))
})
It("podman push to local registry", func() {
if podmanTest.Host.Arch == "ppc64le" {
Skip("No registry image for ppc64le")