speed up rootless tests

when running integrations tests as rootless, several tests still
unnecessarily pull images which is costly in terms of time.

Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
baude
2019-07-08 09:51:56 -05:00
parent 3fdf1a2c44
commit c187da23c4
4 changed files with 14 additions and 8 deletions

@ -8,6 +8,7 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
"github.com/containers/libpod/pkg/rootless"
. "github.com/containers/libpod/test/utils" . "github.com/containers/libpod/test/utils"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
@ -59,6 +60,9 @@ var _ = Describe("Podman push", func() {
if podmanTest.Host.Arch == "ppc64le" { if podmanTest.Host.Arch == "ppc64le" {
Skip("No registry image for ppc64le") Skip("No registry image for ppc64le")
} }
if rootless.IsRootless() {
podmanTest.RestoreArtifact(registry)
}
lock := GetPortLock("5000") lock := GetPortLock("5000")
defer lock.Unlock() defer lock.Unlock()
session := podmanTest.PodmanNoCache([]string{"run", "-d", "--name", "registry", "-p", "5000:5000", registry, "/entrypoint.sh", "/etc/docker/registry/config.yml"}) session := podmanTest.PodmanNoCache([]string{"run", "-d", "--name", "registry", "-p", "5000:5000", registry, "/entrypoint.sh", "/etc/docker/registry/config.yml"})

@ -55,7 +55,7 @@ var _ = Describe("Podman rmi", func() {
}) })
It("podman rmi all images", func() { It("podman rmi all images", func() {
podmanTest.PullImages([]string{nginx}) podmanTest.RestoreArtifact(nginx)
session := podmanTest.PodmanNoCache([]string{"rmi", "-a"}) session := podmanTest.PodmanNoCache([]string{"rmi", "-a"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
images := podmanTest.PodmanNoCache([]string{"images"}) images := podmanTest.PodmanNoCache([]string{"images"})
@ -66,7 +66,7 @@ var _ = Describe("Podman rmi", func() {
}) })
It("podman rmi all images forcibly with short options", func() { It("podman rmi all images forcibly with short options", func() {
podmanTest.PullImages([]string{nginx}) podmanTest.RestoreArtifact(nginx)
session := podmanTest.PodmanNoCache([]string{"rmi", "-fa"}) session := podmanTest.PodmanNoCache([]string{"rmi", "-fa"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0)) Expect(session.ExitCode()).To(Equal(0))

@ -11,6 +11,7 @@ import (
"syscall" "syscall"
"time" "time"
"github.com/containers/libpod/pkg/rootless"
. "github.com/containers/libpod/test/utils" . "github.com/containers/libpod/test/utils"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
@ -53,7 +54,9 @@ var _ = Describe("Podman run with --sig-proxy", func() {
os.Mkdir(udsDir, 0700) os.Mkdir(udsDir, 0700)
udsPath := filepath.Join(udsDir, "fifo") udsPath := filepath.Join(udsDir, "fifo")
syscall.Mkfifo(udsPath, 0600) syscall.Mkfifo(udsPath, 0600)
if rootless.IsRootless() {
podmanTest.RestoreArtifact(fedoraMinimal)
}
_, pid := podmanTest.PodmanPID([]string{"run", "-it", "-v", fmt.Sprintf("%s:/h:Z", udsDir), fedoraMinimal, "bash", "-c", sigCatch}) _, pid := podmanTest.PodmanPID([]string{"run", "-it", "-v", fmt.Sprintf("%s:/h:Z", udsDir), fedoraMinimal, "bash", "-c", sigCatch})
uds, _ := os.OpenFile(udsPath, os.O_RDONLY|syscall.O_NONBLOCK, 0600) uds, _ := os.OpenFile(udsPath, os.O_RDONLY|syscall.O_NONBLOCK, 0600)
@ -108,6 +111,9 @@ var _ = Describe("Podman run with --sig-proxy", func() {
Specify("signals are not forwarded to container with sig-proxy false", func() { Specify("signals are not forwarded to container with sig-proxy false", func() {
signal := syscall.SIGPOLL signal := syscall.SIGPOLL
if rootless.IsRootless() {
podmanTest.RestoreArtifact(fedoraMinimal)
}
session, pid := podmanTest.PodmanPID([]string{"run", "--name", "test2", "--sig-proxy=false", fedoraMinimal, "bash", "-c", sigCatch}) session, pid := podmanTest.PodmanPID([]string{"run", "--name", "test2", "--sig-proxy=false", fedoraMinimal, "bash", "-c", sigCatch})
ok := WaitForContainer(podmanTest) ok := WaitForContainer(podmanTest)

@ -37,10 +37,6 @@ var _ = Describe("Podman image tree", func() {
if podmanTest.RemoteTest { if podmanTest.RemoteTest {
Skip("Does not work on remote client") Skip("Does not work on remote client")
} }
session := podmanTest.PodmanNoCache([]string{"pull", "docker.io/library/busybox:latest"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
dockerfile := `FROM docker.io/library/busybox:latest dockerfile := `FROM docker.io/library/busybox:latest
RUN mkdir hello RUN mkdir hello
RUN touch test.txt RUN touch test.txt
@ -48,7 +44,7 @@ ENV foo=bar
` `
podmanTest.BuildImage(dockerfile, "test:latest", "true") podmanTest.BuildImage(dockerfile, "test:latest", "true")
session = podmanTest.PodmanNoCache([]string{"image", "tree", "test:latest"}) session := podmanTest.PodmanNoCache([]string{"image", "tree", "test:latest"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0)) Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.PodmanNoCache([]string{"image", "tree", "--whatrequires", "docker.io/library/busybox:latest"}) session = podmanTest.PodmanNoCache([]string{"image", "tree", "--whatrequires", "docker.io/library/busybox:latest"})