mirror of
https://github.com/containers/podman.git
synced 2025-06-19 08:09:12 +08:00
test for buildah version in container images.
Check to see if we are recording the version of buildah used to build the image as a label in the image. Also we should make sure the filter "since" works. We are only testing "after", which we don't document. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@ -7,6 +7,7 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/containers/buildah"
|
||||||
. "github.com/containers/podman/v2/test/utils"
|
. "github.com/containers/podman/v2/test/utils"
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
@ -239,4 +240,16 @@ RUN printenv http_proxy`
|
|||||||
Expect(ok).To(BeTrue())
|
Expect(ok).To(BeTrue())
|
||||||
os.Unsetenv("http_proxy")
|
os.Unsetenv("http_proxy")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
It("podman build and check identity", func() {
|
||||||
|
session := podmanTest.Podman([]string{"build", "-f", "Containerfile.path", "--no-cache", "-t", "test", "build/basicalpine"})
|
||||||
|
session.WaitWithDefaultTimeout()
|
||||||
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
|
|
||||||
|
// Verify that OS and Arch are being set
|
||||||
|
inspect := podmanTest.PodmanNoCache([]string{"image", "inspect", "--format", "{{ index .Config.Labels }}", "test"})
|
||||||
|
inspect.WaitWithDefaultTimeout()
|
||||||
|
data := inspect.OutputToString()
|
||||||
|
Expect(data).To(ContainSubstring(buildah.Version))
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
@ -198,7 +198,7 @@ WORKDIR /test
|
|||||||
Expect(result.OutputToString()).To(Equal("/test"))
|
Expect(result.OutputToString()).To(Equal("/test"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman images filter after image", func() {
|
It("podman images filter since image", func() {
|
||||||
podmanTest.RestoreAllArtifacts()
|
podmanTest.RestoreAllArtifacts()
|
||||||
rmi := podmanTest.PodmanNoCache([]string{"rmi", "busybox"})
|
rmi := podmanTest.PodmanNoCache([]string{"rmi", "busybox"})
|
||||||
rmi.WaitWithDefaultTimeout()
|
rmi.WaitWithDefaultTimeout()
|
||||||
@ -207,7 +207,7 @@ WORKDIR /test
|
|||||||
dockerfile := `FROM quay.io/libpod/alpine:latest
|
dockerfile := `FROM quay.io/libpod/alpine:latest
|
||||||
`
|
`
|
||||||
podmanTest.BuildImage(dockerfile, "foobar.com/before:latest", "false")
|
podmanTest.BuildImage(dockerfile, "foobar.com/before:latest", "false")
|
||||||
result := podmanTest.PodmanNoCache([]string{"images", "-q", "-f", "after=quay.io/libpod/alpine:latest"})
|
result := podmanTest.PodmanNoCache([]string{"images", "-q", "-f", "since=quay.io/libpod/alpine:latest"})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).Should(Exit(0))
|
Expect(result).Should(Exit(0))
|
||||||
Expect(len(result.OutputToStringArray())).To(Equal(0))
|
Expect(len(result.OutputToStringArray())).To(Equal(0))
|
||||||
|
@ -221,6 +221,11 @@ EOF
|
|||||||
run_podman run --rm build_test pwd
|
run_podman run --rm build_test pwd
|
||||||
is "$output" "$workdir" "pwd command in container"
|
is "$output" "$workdir" "pwd command in container"
|
||||||
|
|
||||||
|
# Determine buildah version, so we can confirm it gets into Labels
|
||||||
|
run_podman info --format '{{ .Host.BuildahVersion }}'
|
||||||
|
is "$output" "[1-9][0-9.-]\+" ".Host.BuildahVersion is reasonable"
|
||||||
|
buildah_version=$output
|
||||||
|
|
||||||
# Confirm that 'podman inspect' shows the expected values
|
# Confirm that 'podman inspect' shows the expected values
|
||||||
# FIXME: can we rely on .Env[0] being PATH, and the rest being in order??
|
# FIXME: can we rely on .Env[0] being PATH, and the rest being in order??
|
||||||
run_podman image inspect build_test
|
run_podman image inspect build_test
|
||||||
@ -239,6 +244,7 @@ Cmd[0] | /bin/mydefaultcmd
|
|||||||
Cmd[1] | $s_echo
|
Cmd[1] | $s_echo
|
||||||
WorkingDir | $workdir
|
WorkingDir | $workdir
|
||||||
Labels.$label_name | $label_value
|
Labels.$label_name | $label_value
|
||||||
|
Labels.\"io.buildah.version\" | $buildah_version
|
||||||
"
|
"
|
||||||
|
|
||||||
parse_table "$tests" | while read field expect; do
|
parse_table "$tests" | while read field expect; do
|
||||||
|
Reference in New Issue
Block a user