mirror of
https://github.com/containers/podman.git
synced 2025-05-31 07:27:13 +08:00
Integration Test Improvements #3
Third round of speed improvements to the integration tests. Signed-off-by: baude <bbaude@redhat.com> Closes: #1193 Approved by: rhatdan
This commit is contained in:
@ -78,8 +78,7 @@ var _ = Describe("Podman commit", func() {
|
||||
})
|
||||
|
||||
It("podman commit container with change flag", func() {
|
||||
podmanTest.RestoreArtifact(fedoraMinimal)
|
||||
test := podmanTest.Podman([]string{"run", "--name", "test1", "-d", fedoraMinimal, "ls"})
|
||||
test := podmanTest.Podman([]string{"run", "--name", "test1", "-d", ALPINE, "ls"})
|
||||
test.WaitWithDefaultTimeout()
|
||||
Expect(test.ExitCode()).To(Equal(0))
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
|
||||
|
@ -29,13 +29,15 @@ var (
|
||||
INTEGRATION_ROOT string
|
||||
STORAGE_OPTIONS = "--storage-driver vfs"
|
||||
ARTIFACT_DIR = "/tmp/.artifacts"
|
||||
CACHE_IMAGES = []string{ALPINE, BB, fedoraMinimal, nginx}
|
||||
CACHE_IMAGES = []string{ALPINE, BB, fedoraMinimal, nginx, redis, registry}
|
||||
RESTORE_IMAGES = []string{ALPINE, BB}
|
||||
ALPINE = "docker.io/library/alpine:latest"
|
||||
BB = "docker.io/library/busybox:latest"
|
||||
BB_GLIBC = "docker.io/library/busybox:glibc"
|
||||
fedoraMinimal = "registry.fedoraproject.org/fedora-minimal:latest"
|
||||
nginx = "quay.io/baude/alpine_nginx:latest"
|
||||
redis = "docker.io/library/redis:alpine"
|
||||
registry = "docker.io/library/registry:2"
|
||||
defaultWaitTimeout = 90
|
||||
)
|
||||
|
||||
|
@ -193,9 +193,8 @@ var _ = Describe("Podman load", func() {
|
||||
|
||||
It("podman load localhost repo from dir", func() {
|
||||
outfile := filepath.Join(podmanTest.TempDir, "load")
|
||||
podmanTest.RestoreArtifact(fedoraMinimal)
|
||||
|
||||
setup := podmanTest.Podman([]string{"tag", "fedora-minimal", "hello:world"})
|
||||
setup := podmanTest.Podman([]string{"tag", BB, "hello:world"})
|
||||
setup.WaitWithDefaultTimeout()
|
||||
Expect(setup.ExitCode()).To(Equal(0))
|
||||
|
||||
@ -218,16 +217,16 @@ var _ = Describe("Podman load", func() {
|
||||
})
|
||||
|
||||
It("podman load xz compressed image", func() {
|
||||
outfile := filepath.Join(podmanTest.TempDir, "alpine.tar")
|
||||
outfile := filepath.Join(podmanTest.TempDir, "bb.tar")
|
||||
|
||||
save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE})
|
||||
save := podmanTest.Podman([]string{"save", "-o", outfile, BB})
|
||||
save.WaitWithDefaultTimeout()
|
||||
Expect(save.ExitCode()).To(Equal(0))
|
||||
session := podmanTest.SystemExec("xz", []string{outfile})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
|
||||
rmi := podmanTest.Podman([]string{"rmi", ALPINE})
|
||||
rmi := podmanTest.Podman([]string{"rmi", BB})
|
||||
rmi.WaitWithDefaultTimeout()
|
||||
Expect(rmi.ExitCode()).To(Equal(0))
|
||||
|
||||
|
@ -58,7 +58,8 @@ var _ = Describe("Podman push", func() {
|
||||
})
|
||||
|
||||
It("podman push to local registry", func() {
|
||||
session := podmanTest.Podman([]string{"run", "-d", "--name", "registry", "-p", "5000:5000", "docker.io/library/registry:2", "/entrypoint.sh", "/etc/docker/registry/config.yml"})
|
||||
podmanTest.RestoreArtifact(registry)
|
||||
session := podmanTest.Podman([]string{"run", "-d", "--name", "registry", "-p", "5000:5000", registry, "/entrypoint.sh", "/etc/docker/registry/config.yml"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
|
||||
@ -91,8 +92,8 @@ var _ = Describe("Podman push", func() {
|
||||
defer podmanTest.SystemExec("setenforce", []string{"1"})
|
||||
}
|
||||
}
|
||||
|
||||
session := podmanTest.Podman([]string{"run", "--entrypoint", "htpasswd", "registry:2", "-Bbn", "podmantest", "test"})
|
||||
podmanTest.RestoreArtifact(registry)
|
||||
session := podmanTest.Podman([]string{"run", "--entrypoint", "htpasswd", registry, "-Bbn", "podmantest", "test"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
|
||||
@ -108,7 +109,7 @@ var _ = Describe("Podman push", func() {
|
||||
strings.Join([]string{authPath, "/auth"}, ":"), "-e", "REGISTRY_AUTH=htpasswd", "-e",
|
||||
"REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm", "-e", "REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd",
|
||||
"-v", strings.Join([]string{certPath, "/certs"}, ":"), "-e", "REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt",
|
||||
"-e", "REGISTRY_HTTP_TLS_KEY=/certs/domain.key", "registry:2"})
|
||||
"-e", "REGISTRY_HTTP_TLS_KEY=/certs/domain.key", registry})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
|
||||
|
@ -53,7 +53,7 @@ var _ = Describe("Podman refresh", func() {
|
||||
})
|
||||
|
||||
Specify("Refresh with running container restarts container", func() {
|
||||
createSession := podmanTest.Podman([]string{"run", "-d", ALPINE, "sleep", "120"})
|
||||
createSession := podmanTest.Podman([]string{"run", "-dt", ALPINE, "top"})
|
||||
createSession.WaitWithDefaultTimeout()
|
||||
Expect(createSession.ExitCode()).To(Equal(0))
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
|
||||
|
@ -150,7 +150,7 @@ var _ = Describe("Podman rmi", func() {
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
|
||||
session = podmanTest.Podman([]string{"run", "--name", "c_test1", ALPINE, "true"})
|
||||
session = podmanTest.Podman([]string{"create", "--name", "c_test1", ALPINE, "true"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
|
||||
@ -158,7 +158,7 @@ var _ = Describe("Podman rmi", func() {
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
|
||||
session = podmanTest.Podman([]string{"run", "--name", "c_test2", "test1", "true"})
|
||||
session = podmanTest.Podman([]string{"create", "--name", "c_test2", "test1", "true"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
|
||||
|
@ -35,13 +35,10 @@ var _ = Describe("Podman run exit", func() {
|
||||
mount := podmanTest.SystemExec("mount", nil)
|
||||
mount.WaitWithDefaultTimeout()
|
||||
out1 := mount.OutputToString()
|
||||
result := podmanTest.Podman([]string{"run", "-d", ALPINE, "echo", "hello"})
|
||||
result := podmanTest.Podman([]string{"create", "-dt", ALPINE, "echo", "hello"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result.ExitCode()).To(Equal(0))
|
||||
|
||||
result = podmanTest.SystemExec("sleep", []string{"5"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
|
||||
mount = podmanTest.SystemExec("mount", nil)
|
||||
mount.WaitWithDefaultTimeout()
|
||||
out2 := mount.OutputToString()
|
||||
|
@ -490,11 +490,12 @@ var _ = Describe("Podman run", func() {
|
||||
})
|
||||
|
||||
It("podman run with built-in volume image", func() {
|
||||
session := podmanTest.Podman([]string{"run", "--rm", "docker.io/library/redis:alpine", "ls"})
|
||||
podmanTest.RestoreArtifact(redis)
|
||||
session := podmanTest.Podman([]string{"run", "--rm", redis, "ls"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
|
||||
session = podmanTest.Podman([]string{"rmi", "docker.io/library/redis:alpine"})
|
||||
session = podmanTest.Podman([]string{"rmi", redis})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
|
||||
@ -524,7 +525,8 @@ USER mail`
|
||||
err = ioutil.WriteFile(volFile, []byte(data), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
session := podmanTest.Podman([]string{"create", "--volume", vol + ":/myvol", "docker.io/library/redis:alpine", "sh"})
|
||||
podmanTest.RestoreArtifact(redis)
|
||||
session := podmanTest.Podman([]string{"create", "--volume", vol + ":/myvol", redis, "sh"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
ctrID := session.OutputToString()
|
||||
@ -539,7 +541,8 @@ USER mail`
|
||||
})
|
||||
|
||||
It("podman run --volumes-from flag with built-in volumes", func() {
|
||||
session := podmanTest.Podman([]string{"create", "docker.io/library/redis:alpine", "sh"})
|
||||
podmanTest.RestoreArtifact(redis)
|
||||
session := podmanTest.Podman([]string{"create", redis, "sh"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
ctrID := session.OutputToString()
|
||||
|
@ -123,7 +123,8 @@ var _ = Describe("Podman search", func() {
|
||||
})
|
||||
|
||||
It("podman search attempts HTTP if tls-verify flag is set false", func() {
|
||||
fakereg := podmanTest.Podman([]string{"run", "-d", "--name", "registry", "-p", "5000:5000", "docker.io/library/registry:2", "/entrypoint.sh", "/etc/docker/registry/config.yml"})
|
||||
podmanTest.RestoreArtifact(registry)
|
||||
fakereg := podmanTest.Podman([]string{"run", "-d", "--name", "registry", "-p", "5000:5000", registry, "/entrypoint.sh", "/etc/docker/registry/config.yml"})
|
||||
fakereg.WaitWithDefaultTimeout()
|
||||
Expect(fakereg.ExitCode()).To(Equal(0))
|
||||
|
||||
@ -142,7 +143,8 @@ var _ = Describe("Podman search", func() {
|
||||
})
|
||||
|
||||
It("podman search in local registry", func() {
|
||||
registry := podmanTest.Podman([]string{"run", "-d", "--name", "registry3", "-p", "5000:5000", "docker.io/library/registry:2", "/entrypoint.sh", "/etc/docker/registry/config.yml"})
|
||||
podmanTest.RestoreArtifact(registry)
|
||||
registry := podmanTest.Podman([]string{"run", "-d", "--name", "registry3", "-p", "5000:5000", registry, "/entrypoint.sh", "/etc/docker/registry/config.yml"})
|
||||
registry.WaitWithDefaultTimeout()
|
||||
Expect(registry.ExitCode()).To(Equal(0))
|
||||
|
||||
@ -161,7 +163,8 @@ var _ = Describe("Podman search", func() {
|
||||
})
|
||||
|
||||
It("podman search attempts HTTP if registry is in registries.insecure and force secure is false", func() {
|
||||
registry := podmanTest.Podman([]string{"run", "-d", "--name", "registry4", "-p", "5000:5000", "docker.io/library/registry:2", "/entrypoint.sh", "/etc/docker/registry/config.yml"})
|
||||
podmanTest.RestoreArtifact(registry)
|
||||
registry := podmanTest.Podman([]string{"run", "-d", "--name", "registry4", "-p", "5000:5000", registry, "/entrypoint.sh", "/etc/docker/registry/config.yml"})
|
||||
registry.WaitWithDefaultTimeout()
|
||||
Expect(registry.ExitCode()).To(Equal(0))
|
||||
|
||||
@ -192,7 +195,8 @@ var _ = Describe("Podman search", func() {
|
||||
})
|
||||
|
||||
It("podman search doesn't attempt HTTP if force secure is true", func() {
|
||||
registry := podmanTest.Podman([]string{"run", "-d", "-p", "5000:5000", "--name", "registry5", "registry:2"})
|
||||
podmanTest.RestoreArtifact(registry)
|
||||
registry := podmanTest.Podman([]string{"run", "-d", "-p", "5000:5000", "--name", "registry5", registry})
|
||||
registry.WaitWithDefaultTimeout()
|
||||
Expect(registry.ExitCode()).To(Equal(0))
|
||||
|
||||
@ -222,7 +226,8 @@ var _ = Describe("Podman search", func() {
|
||||
})
|
||||
|
||||
It("podman search doesn't attempt HTTP if registry is not listed as insecure", func() {
|
||||
registry := podmanTest.Podman([]string{"run", "-d", "-p", "5000:5000", "--name", "registry6", "registry:2"})
|
||||
podmanTest.RestoreArtifact(registry)
|
||||
registry := podmanTest.Podman([]string{"run", "-d", "-p", "5000:5000", "--name", "registry6", registry})
|
||||
registry.WaitWithDefaultTimeout()
|
||||
Expect(registry.ExitCode()).To(Equal(0))
|
||||
|
||||
@ -252,17 +257,18 @@ var _ = Describe("Podman search", func() {
|
||||
})
|
||||
|
||||
It("podman search doesn't attempt HTTP if one registry is not listed as insecure", func() {
|
||||
registry := podmanTest.Podman([]string{"run", "-d", "-p", "5000:5000", "--name", "registry7", "registry:2"})
|
||||
registry.WaitWithDefaultTimeout()
|
||||
Expect(registry.ExitCode()).To(Equal(0))
|
||||
podmanTest.RestoreArtifact(registry)
|
||||
registryLocal := podmanTest.Podman([]string{"run", "-d", "-p", "5000:5000", "--name", "registry7", registry})
|
||||
registryLocal.WaitWithDefaultTimeout()
|
||||
Expect(registryLocal.ExitCode()).To(Equal(0))
|
||||
|
||||
if !WaitContainerReady(&podmanTest, "registry7", "listening on", 20, 1) {
|
||||
Skip("Can not start docker registry.")
|
||||
}
|
||||
|
||||
registry = podmanTest.Podman([]string{"run", "-d", "-p", "6000:5000", "--name", "registry8", "registry:2"})
|
||||
registry.WaitWithDefaultTimeout()
|
||||
Expect(registry.ExitCode()).To(Equal(0))
|
||||
registryLocal = podmanTest.Podman([]string{"run", "-d", "-p", "6000:5000", "--name", "registry8", registry})
|
||||
registryLocal.WaitWithDefaultTimeout()
|
||||
Expect(registryLocal.ExitCode()).To(Equal(0))
|
||||
|
||||
if !WaitContainerReady(&podmanTest, "registry8", "listening on", 20, 1) {
|
||||
Skip("Can not start docker registry.")
|
||||
|
Reference in New Issue
Block a user