Skip to content

Commit

Permalink
Add a test for forcing compression and v2s2 format
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Jamstah committed Nov 29, 2024
1 parent 9d3d0c7 commit c5ea73e
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions test/e2e/push_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit c5ea73e

Please sign in to comment.