Merge pull request #2481 from cevich/sysexec_waitcomplete
Fix SystemExec completion race
This commit is contained in:
commit
55f80719a6
|
|
@ -59,7 +59,7 @@ var _ = Describe("Podman load", func() {
|
||||||
Expect(save.ExitCode()).To(Equal(0))
|
Expect(save.ExitCode()).To(Equal(0))
|
||||||
|
|
||||||
compress := SystemExec("gzip", []string{outfile})
|
compress := SystemExec("gzip", []string{outfile})
|
||||||
compress.WaitWithDefaultTimeout()
|
Expect(compress.ExitCode()).To(Equal(0))
|
||||||
outfile = outfile + ".gz"
|
outfile = outfile + ".gz"
|
||||||
|
|
||||||
rmi := podmanTest.Podman([]string{"rmi", ALPINE})
|
rmi := podmanTest.Podman([]string{"rmi", ALPINE})
|
||||||
|
|
@ -174,7 +174,6 @@ var _ = Describe("Podman load", func() {
|
||||||
|
|
||||||
It("podman load localhost registry from scratch", func() {
|
It("podman load localhost registry from scratch", func() {
|
||||||
outfile := filepath.Join(podmanTest.TempDir, "load_test.tar.gz")
|
outfile := filepath.Join(podmanTest.TempDir, "load_test.tar.gz")
|
||||||
|
|
||||||
setup := podmanTest.Podman([]string{"tag", ALPINE, "hello:world"})
|
setup := podmanTest.Podman([]string{"tag", ALPINE, "hello:world"})
|
||||||
setup.WaitWithDefaultTimeout()
|
setup.WaitWithDefaultTimeout()
|
||||||
Expect(setup.ExitCode()).To(Equal(0))
|
Expect(setup.ExitCode()).To(Equal(0))
|
||||||
|
|
@ -255,7 +254,6 @@ var _ = Describe("Podman load", func() {
|
||||||
save.WaitWithDefaultTimeout()
|
save.WaitWithDefaultTimeout()
|
||||||
Expect(save.ExitCode()).To(Equal(0))
|
Expect(save.ExitCode()).To(Equal(0))
|
||||||
session := SystemExec("xz", []string{outfile})
|
session := SystemExec("xz", []string{outfile})
|
||||||
session.WaitWithDefaultTimeout()
|
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
|
|
||||||
rmi := podmanTest.Podman([]string{"rmi", BB})
|
rmi := podmanTest.Podman([]string{"rmi", BB})
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,6 @@ var _ = Describe("Podman pod create", func() {
|
||||||
Expect(webserver.ExitCode()).To(Equal(0))
|
Expect(webserver.ExitCode()).To(Equal(0))
|
||||||
|
|
||||||
check := SystemExec("nc", []string{"-z", "localhost", "80"})
|
check := SystemExec("nc", []string{"-z", "localhost", "80"})
|
||||||
check.WaitWithDefaultTimeout()
|
|
||||||
Expect(check.ExitCode()).To(Equal(1))
|
Expect(check.ExitCode()).To(Equal(1))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -111,7 +110,6 @@ var _ = Describe("Podman pod create", func() {
|
||||||
Expect(webserver.ExitCode()).To(Equal(0))
|
Expect(webserver.ExitCode()).To(Equal(0))
|
||||||
|
|
||||||
check := SystemExec("nc", []string{"-z", "localhost", "80"})
|
check := SystemExec("nc", []string{"-z", "localhost", "80"})
|
||||||
check.WaitWithDefaultTimeout()
|
|
||||||
Expect(check.ExitCode()).To(Equal(0))
|
Expect(check.ExitCode()).To(Equal(0))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,12 @@ import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
. "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"
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("Podman pull", func() {
|
var _ = Describe("Podman pull", func() {
|
||||||
|
|
@ -92,58 +94,56 @@ var _ = Describe("Podman pull", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman pull from docker-archive", func() {
|
It("podman pull from docker-archive", func() {
|
||||||
session := podmanTest.Podman([]string{"save", "-o", "/tmp/alp.tar", "alpine"})
|
tarfn := filepath.Join(podmanTest.TempDir, "alp.tar")
|
||||||
|
session := podmanTest.Podman([]string{"save", "-o", tarfn, "alpine"})
|
||||||
|
session.WaitWithDefaultTimeout()
|
||||||
|
|
||||||
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
|
session = podmanTest.Podman([]string{"rmi", "alpine"})
|
||||||
|
session.WaitWithDefaultTimeout()
|
||||||
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
|
session = podmanTest.Podman([]string{"pull", fmt.Sprintf("docker-archive:%s", tarfn)})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
session = podmanTest.Podman([]string{"rmi", "alpine"})
|
session = podmanTest.Podman([]string{"rmi", "alpine"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
session = podmanTest.Podman([]string{"pull", "docker-archive:/tmp/alp.tar"})
|
|
||||||
session.WaitWithDefaultTimeout()
|
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
|
||||||
session = podmanTest.Podman([]string{"rmi", "alpine"})
|
|
||||||
session.WaitWithDefaultTimeout()
|
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
|
||||||
clean := SystemExec("rm", []string{"/tmp/alp.tar"})
|
|
||||||
clean.WaitWithDefaultTimeout()
|
|
||||||
Expect(clean.ExitCode()).To(Equal(0))
|
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman pull from oci-archive", func() {
|
It("podman pull from oci-archive", func() {
|
||||||
session := podmanTest.Podman([]string{"save", "--format", "oci-archive", "-o", "/tmp/oci-alp.tar", "alpine"})
|
tarfn := filepath.Join(podmanTest.TempDir, "oci-alp.tar")
|
||||||
|
session := podmanTest.Podman([]string{"save", "--format", "oci-archive", "-o", tarfn, "alpine"})
|
||||||
|
session.WaitWithDefaultTimeout()
|
||||||
|
|
||||||
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
|
session = podmanTest.Podman([]string{"rmi", "alpine"})
|
||||||
|
session.WaitWithDefaultTimeout()
|
||||||
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
|
session = podmanTest.Podman([]string{"pull", fmt.Sprintf("oci-archive:%s", tarfn)})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
session = podmanTest.Podman([]string{"rmi", "alpine"})
|
session = podmanTest.Podman([]string{"rmi", "alpine"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
session = podmanTest.Podman([]string{"pull", "oci-archive:/tmp/oci-alp.tar"})
|
|
||||||
session.WaitWithDefaultTimeout()
|
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
|
||||||
session = podmanTest.Podman([]string{"rmi", "alpine"})
|
|
||||||
session.WaitWithDefaultTimeout()
|
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
|
||||||
clean := SystemExec("rm", []string{"/tmp/oci-alp.tar"})
|
|
||||||
clean.WaitWithDefaultTimeout()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman pull from local directory", func() {
|
It("podman pull from local directory", func() {
|
||||||
setup := SystemExec("mkdir", []string{"-p", "/tmp/podmantestdir"})
|
dirpath := filepath.Join(podmanTest.TempDir, "alpine")
|
||||||
setup.WaitWithDefaultTimeout()
|
os.MkdirAll(dirpath, os.ModePerm)
|
||||||
session := podmanTest.Podman([]string{"push", "alpine", "dir:/tmp/podmantestdir"})
|
imgPath := fmt.Sprintf("dir:%s", dirpath)
|
||||||
|
|
||||||
|
session := podmanTest.Podman([]string{"push", "alpine", imgPath})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
session = podmanTest.Podman([]string{"rmi", "alpine"})
|
session = podmanTest.Podman([]string{"rmi", "alpine"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
session = podmanTest.Podman([]string{"pull", "dir:/tmp/podmantestdir"})
|
session = podmanTest.Podman([]string{"pull", imgPath})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
session = podmanTest.Podman([]string{"rmi", "podmantestdir"})
|
session = podmanTest.Podman([]string{"rmi", "alpine"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
|
|
||||||
clean := SystemExec("rm", []string{"-fr", "/tmp/podmantestdir"})
|
|
||||||
clean.WaitWithDefaultTimeout()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman pull check quiet", func() {
|
It("podman pull check quiet", func() {
|
||||||
|
|
|
||||||
|
|
@ -51,13 +51,11 @@ var _ = Describe("Podman push", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman push to dir", func() {
|
It("podman push to dir", func() {
|
||||||
session := podmanTest.Podman([]string{"push", "--remove-signatures", ALPINE, "dir:/tmp/busybox"})
|
bbdir := filepath.Join(podmanTest.TempDir, "busybox")
|
||||||
|
session := podmanTest.Podman([]string{"push", "--remove-signatures", ALPINE,
|
||||||
|
fmt.Sprintf("dir:%s", bbdir)})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
|
|
||||||
clean := SystemExec("rm", []string{"-fr", "/tmp/busybox"})
|
|
||||||
clean.WaitWithDefaultTimeout()
|
|
||||||
Expect(clean.ExitCode()).To(Equal(0))
|
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman push to local registry", func() {
|
It("podman push to local registry", func() {
|
||||||
|
|
@ -85,20 +83,21 @@ var _ = Describe("Podman push", func() {
|
||||||
authPath := filepath.Join(podmanTest.TempDir, "auth")
|
authPath := filepath.Join(podmanTest.TempDir, "auth")
|
||||||
os.Mkdir(authPath, os.ModePerm)
|
os.Mkdir(authPath, os.ModePerm)
|
||||||
os.MkdirAll("/etc/containers/certs.d/localhost:5000", os.ModePerm)
|
os.MkdirAll("/etc/containers/certs.d/localhost:5000", os.ModePerm)
|
||||||
debug := SystemExec("ls", []string{"-l", podmanTest.TempDir})
|
defer os.RemoveAll("/etc/containers/certs.d/localhost:5000")
|
||||||
debug.WaitWithDefaultTimeout()
|
|
||||||
|
|
||||||
cwd, _ := os.Getwd()
|
cwd, _ := os.Getwd()
|
||||||
certPath := filepath.Join(cwd, "../", "certs")
|
certPath := filepath.Join(cwd, "../", "certs")
|
||||||
|
|
||||||
if IsCommandAvailable("getenforce") {
|
if IsCommandAvailable("getenforce") {
|
||||||
ge := SystemExec("getenforce", []string{})
|
ge := SystemExec("getenforce", []string{})
|
||||||
ge.WaitWithDefaultTimeout()
|
Expect(ge.ExitCode()).To(Equal(0))
|
||||||
if ge.OutputToString() == "Enforcing" {
|
if ge.OutputToString() == "Enforcing" {
|
||||||
se := SystemExec("setenforce", []string{"0"})
|
se := SystemExec("setenforce", []string{"0"})
|
||||||
se.WaitWithDefaultTimeout()
|
Expect(se.ExitCode()).To(Equal(0))
|
||||||
|
defer func() {
|
||||||
defer SystemExec("setenforce", []string{"1"})
|
se2 := SystemExec("setenforce", []string{"1"})
|
||||||
|
Expect(se2.ExitCode()).To(Equal(0))
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
podmanTest.RestoreArtifact(registry)
|
podmanTest.RestoreArtifact(registry)
|
||||||
|
|
@ -111,8 +110,6 @@ var _ = Describe("Podman push", func() {
|
||||||
|
|
||||||
f.WriteString(session.OutputToString())
|
f.WriteString(session.OutputToString())
|
||||||
f.Sync()
|
f.Sync()
|
||||||
debug = SystemExec("cat", []string{filepath.Join(authPath, "htpasswd")})
|
|
||||||
debug.WaitWithDefaultTimeout()
|
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "-d", "-p", "5000:5000", "--name", "registry", "-v",
|
session = podmanTest.Podman([]string{"run", "-d", "-p", "5000:5000", "--name", "registry", "-v",
|
||||||
strings.Join([]string{authPath, "/auth"}, ":"), "-e", "REGISTRY_AUTH=htpasswd", "-e",
|
strings.Join([]string{authPath, "/auth"}, ":"), "-e", "REGISTRY_AUTH=htpasswd", "-e",
|
||||||
|
|
@ -138,8 +135,7 @@ var _ = Describe("Podman push", func() {
|
||||||
Expect(push.ExitCode()).To(Equal(0))
|
Expect(push.ExitCode()).To(Equal(0))
|
||||||
|
|
||||||
setup := SystemExec("cp", []string{filepath.Join(certPath, "domain.crt"), "/etc/containers/certs.d/localhost:5000/ca.crt"})
|
setup := SystemExec("cp", []string{filepath.Join(certPath, "domain.crt"), "/etc/containers/certs.d/localhost:5000/ca.crt"})
|
||||||
setup.WaitWithDefaultTimeout()
|
Expect(setup.ExitCode()).To(Equal(0))
|
||||||
defer os.RemoveAll("/etc/containers/certs.d/localhost:5000")
|
|
||||||
|
|
||||||
push = podmanTest.Podman([]string{"push", "--creds=podmantest:wrongpasswd", ALPINE, "localhost:5000/credstest"})
|
push = podmanTest.Podman([]string{"push", "--creds=podmantest:wrongpasswd", ALPINE, "localhost:5000/credstest"})
|
||||||
push.WaitWithDefaultTimeout()
|
push.WaitWithDefaultTimeout()
|
||||||
|
|
@ -155,23 +151,22 @@ var _ = Describe("Podman push", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman push to docker-archive", func() {
|
It("podman push to docker-archive", func() {
|
||||||
session := podmanTest.Podman([]string{"push", ALPINE, "docker-archive:/tmp/alp:latest"})
|
tarfn := filepath.Join(podmanTest.TempDir, "alp.tar")
|
||||||
|
session := podmanTest.Podman([]string{"push", ALPINE,
|
||||||
|
fmt.Sprintf("docker-archive:%s:latest", tarfn)})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
clean := SystemExec("rm", []string{"/tmp/alp"})
|
|
||||||
clean.WaitWithDefaultTimeout()
|
|
||||||
Expect(clean.ExitCode()).To(Equal(0))
|
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman push to docker daemon", func() {
|
It("podman push to docker daemon", func() {
|
||||||
setup := SystemExec("bash", []string{"-c", "systemctl status docker 2>&1"})
|
setup := SystemExec("bash", []string{"-c", "systemctl status docker 2>&1"})
|
||||||
setup.WaitWithDefaultTimeout()
|
|
||||||
|
|
||||||
if setup.LineInOutputContains("Active: inactive") {
|
if setup.LineInOutputContains("Active: inactive") {
|
||||||
setup = SystemExec("systemctl", []string{"start", "docker"})
|
setup = SystemExec("systemctl", []string{"start", "docker"})
|
||||||
setup.WaitWithDefaultTimeout()
|
defer func() {
|
||||||
|
stop := SystemExec("systemctl", []string{"stop", "docker"})
|
||||||
defer SystemExec("systemctl", []string{"stop", "docker"})
|
Expect(stop.ExitCode()).To(Equal(0))
|
||||||
|
}()
|
||||||
} else if setup.ExitCode() != 0 {
|
} else if setup.ExitCode() != 0 {
|
||||||
Skip("Docker is not available")
|
Skip("Docker is not available")
|
||||||
}
|
}
|
||||||
|
|
@ -181,22 +176,19 @@ var _ = Describe("Podman push", func() {
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
|
|
||||||
check := SystemExec("docker", []string{"images", "--format", "{{.Repository}}:{{.Tag}}"})
|
check := SystemExec("docker", []string{"images", "--format", "{{.Repository}}:{{.Tag}}"})
|
||||||
check.WaitWithDefaultTimeout()
|
|
||||||
Expect(check.ExitCode()).To(Equal(0))
|
Expect(check.ExitCode()).To(Equal(0))
|
||||||
Expect(check.OutputToString()).To(ContainSubstring("alpine:podmantest"))
|
Expect(check.OutputToString()).To(ContainSubstring("alpine:podmantest"))
|
||||||
|
|
||||||
clean := SystemExec("docker", []string{"rmi", "alpine:podmantest"})
|
clean := SystemExec("docker", []string{"rmi", "alpine:podmantest"})
|
||||||
clean.WaitWithDefaultTimeout()
|
|
||||||
Expect(clean.ExitCode()).To(Equal(0))
|
Expect(clean.ExitCode()).To(Equal(0))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman push to oci-archive", func() {
|
It("podman push to oci-archive", func() {
|
||||||
session := podmanTest.Podman([]string{"push", ALPINE, "oci-archive:/tmp/alp.tar:latest"})
|
tarfn := filepath.Join(podmanTest.TempDir, "alp.tar")
|
||||||
|
session := podmanTest.Podman([]string{"push", ALPINE,
|
||||||
|
fmt.Sprintf("oci-archive:%s:latest", tarfn)})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
clean := SystemExec("rm", []string{"/tmp/alp.tar"})
|
|
||||||
clean.WaitWithDefaultTimeout()
|
|
||||||
Expect(clean.ExitCode()).To(Equal(0))
|
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman push to local ostree", func() {
|
It("podman push to local ostree", func() {
|
||||||
|
|
@ -208,33 +200,29 @@ var _ = Describe("Podman push", func() {
|
||||||
os.MkdirAll(ostreePath, os.ModePerm)
|
os.MkdirAll(ostreePath, os.ModePerm)
|
||||||
|
|
||||||
setup := SystemExec("ostree", []string{strings.Join([]string{"--repo=", ostreePath}, ""), "init"})
|
setup := SystemExec("ostree", []string{strings.Join([]string{"--repo=", ostreePath}, ""), "init"})
|
||||||
setup.WaitWithDefaultTimeout()
|
Expect(setup.ExitCode()).To(Equal(0))
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"push", ALPINE, strings.Join([]string{"ostree:alp@", ostreePath}, "")})
|
session := podmanTest.Podman([]string{"push", ALPINE, strings.Join([]string{"ostree:alp@", ostreePath}, "")})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
|
|
||||||
clean := SystemExec("rm", []string{"-rf", ostreePath})
|
|
||||||
clean.WaitWithDefaultTimeout()
|
|
||||||
Expect(clean.ExitCode()).To(Equal(0))
|
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman push to docker-archive no reference", func() {
|
It("podman push to docker-archive no reference", func() {
|
||||||
session := podmanTest.Podman([]string{"push", ALPINE, "docker-archive:/tmp/alp"})
|
tarfn := filepath.Join(podmanTest.TempDir, "alp.tar")
|
||||||
|
session := podmanTest.Podman([]string{"push", ALPINE,
|
||||||
|
fmt.Sprintf("docker-archive:%s", tarfn)})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
clean := SystemExec("rm", []string{"/tmp/alp"})
|
|
||||||
clean.WaitWithDefaultTimeout()
|
|
||||||
Expect(clean.ExitCode()).To(Equal(0))
|
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman push to oci-archive no reference", func() {
|
It("podman push to oci-archive no reference", func() {
|
||||||
session := podmanTest.Podman([]string{"push", ALPINE, "oci-archive:/tmp/alp-oci"})
|
ociarc := filepath.Join(podmanTest.TempDir, "alp-oci")
|
||||||
|
session := podmanTest.Podman([]string{"push", ALPINE,
|
||||||
|
fmt.Sprintf("oci-archive:%s", ociarc)})
|
||||||
|
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
clean := SystemExec("rm", []string{"/tmp/alp-oci"})
|
|
||||||
clean.WaitWithDefaultTimeout()
|
|
||||||
Expect(clean.ExitCode()).To(Equal(0))
|
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -36,14 +36,16 @@ var _ = Describe("Podman run exit", func() {
|
||||||
|
|
||||||
It("podman run -d mount cleanup test", func() {
|
It("podman run -d mount cleanup test", func() {
|
||||||
mount := SystemExec("mount", nil)
|
mount := SystemExec("mount", nil)
|
||||||
mount.WaitWithDefaultTimeout()
|
Expect(mount.ExitCode()).To(Equal(0))
|
||||||
|
|
||||||
out1 := mount.OutputToString()
|
out1 := mount.OutputToString()
|
||||||
result := podmanTest.Podman([]string{"create", "-dt", ALPINE, "echo", "hello"})
|
result := podmanTest.Podman([]string{"create", "-dt", ALPINE, "echo", "hello"})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result.ExitCode()).To(Equal(0))
|
Expect(result.ExitCode()).To(Equal(0))
|
||||||
|
|
||||||
mount = SystemExec("mount", nil)
|
mount = SystemExec("mount", nil)
|
||||||
mount.WaitWithDefaultTimeout()
|
Expect(mount.ExitCode()).To(Equal(0))
|
||||||
|
|
||||||
out2 := mount.OutputToString()
|
out2 := mount.OutputToString()
|
||||||
Expect(out1).To(Equal(out2))
|
Expect(out1).To(Equal(out2))
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,6 @@ var _ = Describe("Podman run networking", func() {
|
||||||
session.Wait(30)
|
session.Wait(30)
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
results := SystemExec("iptables", []string{"-t", "nat", "-L"})
|
results := SystemExec("iptables", []string{"-t", "nat", "-L"})
|
||||||
results.Wait(30)
|
|
||||||
Expect(results.ExitCode()).To(Equal(0))
|
Expect(results.ExitCode()).To(Equal(0))
|
||||||
Expect(results.OutputToString()).To(ContainSubstring("222"))
|
Expect(results.OutputToString()).To(ContainSubstring("222"))
|
||||||
Expect(results.OutputToString()).To(ContainSubstring("223"))
|
Expect(results.OutputToString()).To(ContainSubstring("223"))
|
||||||
|
|
@ -69,12 +68,10 @@ var _ = Describe("Podman run networking", func() {
|
||||||
session.Wait(30)
|
session.Wait(30)
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
results := SystemExec("iptables", []string{"-t", "nat", "-L"})
|
results := SystemExec("iptables", []string{"-t", "nat", "-L"})
|
||||||
results.Wait(30)
|
|
||||||
Expect(results.ExitCode()).To(Equal(0))
|
Expect(results.ExitCode()).To(Equal(0))
|
||||||
Expect(results.OutputToString()).To(ContainSubstring("8000"))
|
Expect(results.OutputToString()).To(ContainSubstring("8000"))
|
||||||
|
|
||||||
ncBusy := SystemExec("nc", []string{"-l", "-p", "80"})
|
ncBusy := SystemExec("nc", []string{"-l", "-p", "80"})
|
||||||
ncBusy.Wait(10)
|
|
||||||
Expect(ncBusy.ExitCode()).ToNot(Equal(0))
|
Expect(ncBusy.ExitCode()).ToNot(Equal(0))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -183,26 +180,40 @@ var _ = Describe("Podman run networking", func() {
|
||||||
if Containerized() {
|
if Containerized() {
|
||||||
Skip("Can not be run within a container.")
|
Skip("Can not be run within a container.")
|
||||||
}
|
}
|
||||||
SystemExec("ip", []string{"netns", "add", "xxx"})
|
addXXX := SystemExec("ip", []string{"netns", "add", "xxx"})
|
||||||
|
Expect(addXXX.ExitCode()).To(Equal(0))
|
||||||
|
defer func() {
|
||||||
|
delXXX := SystemExec("ip", []string{"netns", "delete", "xxx"})
|
||||||
|
Expect(delXXX.ExitCode()).To(Equal(0))
|
||||||
|
}()
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"run", "-dt", "--net", "ns:/run/netns/xxx", ALPINE, "wget", "www.podman.io"})
|
session := podmanTest.Podman([]string{"run", "-dt", "--net", "ns:/run/netns/xxx", ALPINE, "wget", "www.podman.io"})
|
||||||
session.Wait(90)
|
session.Wait(90)
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
SystemExec("ip", []string{"netns", "delete", "xxx"})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run n user created network namespace with resolv.conf", func() {
|
It("podman run n user created network namespace with resolv.conf", func() {
|
||||||
if Containerized() {
|
if Containerized() {
|
||||||
Skip("Can not be run within a container.")
|
Skip("Can not be run within a container.")
|
||||||
}
|
}
|
||||||
SystemExec("ip", []string{"netns", "add", "xxx"})
|
addXXX2 := SystemExec("ip", []string{"netns", "add", "xxx2"})
|
||||||
SystemExec("mkdir", []string{"-p", "/etc/netns/xxx"})
|
Expect(addXXX2.ExitCode()).To(Equal(0))
|
||||||
SystemExec("bash", []string{"-c", "echo nameserver 11.11.11.11 > /etc/netns/xxx/resolv.conf"})
|
defer func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--net", "ns:/run/netns/xxx", ALPINE, "cat", "/etc/resolv.conf"})
|
delXXX2 := SystemExec("ip", []string{"netns", "delete", "xxx2"})
|
||||||
|
Expect(delXXX2.ExitCode()).To(Equal(0))
|
||||||
|
}()
|
||||||
|
|
||||||
|
mdXXX2 := SystemExec("mkdir", []string{"-p", "/etc/netns/xxx2"})
|
||||||
|
Expect(mdXXX2.ExitCode()).To(Equal(0))
|
||||||
|
defer os.RemoveAll("/etc/netns/xxx2")
|
||||||
|
|
||||||
|
nsXXX2 := SystemExec("bash", []string{"-c", "echo nameserver 11.11.11.11 > /etc/netns/xxx2/resolv.conf"})
|
||||||
|
Expect(nsXXX2.ExitCode()).To(Equal(0))
|
||||||
|
|
||||||
|
session := podmanTest.Podman([]string{"run", "--net", "ns:/run/netns/xxx2", ALPINE, "cat", "/etc/resolv.conf"})
|
||||||
session.Wait(90)
|
session.Wait(90)
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("11.11.11.11"))
|
Expect(session.OutputToString()).To(ContainSubstring("11.11.11.11"))
|
||||||
SystemExec("ip", []string{"netns", "delete", "xxx"})
|
|
||||||
SystemExec("rm", []string{"-rf", "/etc/netns/xxx"})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run network in bogus user created network namespace", func() {
|
It("podman run network in bogus user created network namespace", func() {
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,6 @@ var _ = Describe("Podman run ns", func() {
|
||||||
|
|
||||||
It("podman run ipcns test", func() {
|
It("podman run ipcns test", func() {
|
||||||
setup := SystemExec("ls", []string{"--inode", "-d", "/dev/shm"})
|
setup := SystemExec("ls", []string{"--inode", "-d", "/dev/shm"})
|
||||||
setup.WaitWithDefaultTimeout()
|
|
||||||
Expect(setup.ExitCode()).To(Equal(0))
|
Expect(setup.ExitCode()).To(Equal(0))
|
||||||
hostShm := setup.OutputToString()
|
hostShm := setup.OutputToString()
|
||||||
|
|
||||||
|
|
@ -65,7 +64,6 @@ var _ = Describe("Podman run ns", func() {
|
||||||
|
|
||||||
It("podman run ipcns ipcmk host test", func() {
|
It("podman run ipcns ipcmk host test", func() {
|
||||||
setup := SystemExec("ipcmk", []string{"-M", "1024"})
|
setup := SystemExec("ipcmk", []string{"-M", "1024"})
|
||||||
setup.WaitWithDefaultTimeout()
|
|
||||||
Expect(setup.ExitCode()).To(Equal(0))
|
Expect(setup.ExitCode()).To(Equal(0))
|
||||||
output := strings.Split(setup.OutputToString(), " ")
|
output := strings.Split(setup.OutputToString(), " ")
|
||||||
ipc := output[len(output)-1]
|
ipc := output[len(output)-1]
|
||||||
|
|
@ -74,7 +72,6 @@ var _ = Describe("Podman run ns", func() {
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
|
|
||||||
setup = SystemExec("ipcrm", []string{"-m", ipc})
|
setup = SystemExec("ipcrm", []string{"-m", ipc})
|
||||||
setup.WaitWithDefaultTimeout()
|
|
||||||
Expect(setup.ExitCode()).To(Equal(0))
|
Expect(setup.ExitCode()).To(Equal(0))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,6 @@ var _ = Describe("Podman privileged container tests", func() {
|
||||||
|
|
||||||
It("podman privileged CapEff", func() {
|
It("podman privileged CapEff", func() {
|
||||||
cap := SystemExec("grep", []string{"CapEff", "/proc/self/status"})
|
cap := SystemExec("grep", []string{"CapEff", "/proc/self/status"})
|
||||||
cap.WaitWithDefaultTimeout()
|
|
||||||
Expect(cap.ExitCode()).To(Equal(0))
|
Expect(cap.ExitCode()).To(Equal(0))
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"run", "--privileged", "busybox", "grep", "CapEff", "/proc/self/status"})
|
session := podmanTest.Podman([]string{"run", "--privileged", "busybox", "grep", "CapEff", "/proc/self/status"})
|
||||||
|
|
@ -57,7 +56,6 @@ var _ = Describe("Podman privileged container tests", func() {
|
||||||
|
|
||||||
It("podman cap-add CapEff", func() {
|
It("podman cap-add CapEff", func() {
|
||||||
cap := SystemExec("grep", []string{"CapEff", "/proc/self/status"})
|
cap := SystemExec("grep", []string{"CapEff", "/proc/self/status"})
|
||||||
cap.WaitWithDefaultTimeout()
|
|
||||||
Expect(cap.ExitCode()).To(Equal(0))
|
Expect(cap.ExitCode()).To(Equal(0))
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"run", "--cap-add", "all", "busybox", "grep", "CapEff", "/proc/self/status"})
|
session := podmanTest.Podman([]string{"run", "--cap-add", "all", "busybox", "grep", "CapEff", "/proc/self/status"})
|
||||||
|
|
@ -97,7 +95,6 @@ var _ = Describe("Podman privileged container tests", func() {
|
||||||
}
|
}
|
||||||
|
|
||||||
cap := SystemExec("grep", []string{"NoNewPrivs", "/proc/self/status"})
|
cap := SystemExec("grep", []string{"NoNewPrivs", "/proc/self/status"})
|
||||||
cap.WaitWithDefaultTimeout()
|
|
||||||
if cap.ExitCode() != 0 {
|
if cap.ExitCode() != 0 {
|
||||||
Skip("Can't determine NoNewPrivs")
|
Skip("Can't determine NoNewPrivs")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -387,7 +387,6 @@ var _ = Describe("Podman run", func() {
|
||||||
err = ioutil.WriteFile(keyFile, []byte(mountString), 0755)
|
err = ioutil.WriteFile(keyFile, []byte(mountString), 0755)
|
||||||
Expect(err).To(BeNil())
|
Expect(err).To(BeNil())
|
||||||
execSession := SystemExec("ln", []string{"-s", targetDir, filepath.Join(secretsDir, "mysymlink")})
|
execSession := SystemExec("ln", []string{"-s", targetDir, filepath.Join(secretsDir, "mysymlink")})
|
||||||
execSession.WaitWithDefaultTimeout()
|
|
||||||
Expect(execSession.ExitCode()).To(Equal(0))
|
Expect(execSession.ExitCode()).To(Equal(0))
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"--default-mounts-file=" + mountsFile, "run", "--rm", ALPINE, "cat", "/run/secrets/test.txt"})
|
session := podmanTest.Podman([]string{"--default-mounts-file=" + mountsFile, "run", "--rm", ALPINE, "cat", "/run/secrets/test.txt"})
|
||||||
|
|
|
||||||
|
|
@ -53,31 +53,27 @@ WantedBy=multi-user.target
|
||||||
|
|
||||||
sys_file := ioutil.WriteFile("/etc/systemd/system/redis.service", []byte(systemd_unit_file), 0644)
|
sys_file := ioutil.WriteFile("/etc/systemd/system/redis.service", []byte(systemd_unit_file), 0644)
|
||||||
Expect(sys_file).To(BeNil())
|
Expect(sys_file).To(BeNil())
|
||||||
|
defer func() {
|
||||||
|
stop := SystemExec("bash", []string{"-c", "systemctl stop redis"})
|
||||||
|
os.Remove("/etc/systemd/system/redis.service")
|
||||||
|
SystemExec("bash", []string{"-c", "systemctl daemon-reload"})
|
||||||
|
Expect(stop.ExitCode()).To(Equal(0))
|
||||||
|
}()
|
||||||
|
|
||||||
create := podmanTest.Podman([]string{"create", "-d", "--name", "redis", "redis"})
|
create := podmanTest.Podman([]string{"create", "-d", "--name", "redis", "redis"})
|
||||||
create.WaitWithDefaultTimeout()
|
create.WaitWithDefaultTimeout()
|
||||||
Expect(create.ExitCode()).To(Equal(0))
|
Expect(create.ExitCode()).To(Equal(0))
|
||||||
|
|
||||||
enable := SystemExec("bash", []string{"-c", "systemctl daemon-reload && systemctl enable --now redis"})
|
enable := SystemExec("bash", []string{"-c", "systemctl daemon-reload"})
|
||||||
enable.WaitWithDefaultTimeout()
|
|
||||||
Expect(enable.ExitCode()).To(Equal(0))
|
Expect(enable.ExitCode()).To(Equal(0))
|
||||||
|
|
||||||
start := SystemExec("bash", []string{"-c", "systemctl start redis"})
|
start := SystemExec("bash", []string{"-c", "systemctl start redis"})
|
||||||
start.WaitWithDefaultTimeout()
|
Expect(start.ExitCode()).To(Equal(0))
|
||||||
|
|
||||||
logs := SystemExec("bash", []string{"-c", "journalctl -n 20 -u redis"})
|
logs := SystemExec("bash", []string{"-c", "journalctl -n 20 -u redis"})
|
||||||
logs.WaitWithDefaultTimeout()
|
Expect(logs.ExitCode()).To(Equal(0))
|
||||||
|
|
||||||
status := SystemExec("bash", []string{"-c", "systemctl status redis"})
|
status := SystemExec("bash", []string{"-c", "systemctl status redis"})
|
||||||
status.WaitWithDefaultTimeout()
|
|
||||||
Expect(status.OutputToString()).To(ContainSubstring("active (running)"))
|
Expect(status.OutputToString()).To(ContainSubstring("active (running)"))
|
||||||
|
|
||||||
cleanup := SystemExec("bash", []string{"-c", "systemctl stop redis && systemctl disable redis"})
|
|
||||||
cleanup.WaitWithDefaultTimeout()
|
|
||||||
Expect(cleanup.ExitCode()).To(Equal(0))
|
|
||||||
os.Remove("/etc/systemd/system/redis.service")
|
|
||||||
sys_clean := SystemExec("bash", []string{"-c", "systemctl daemon-reload"})
|
|
||||||
sys_clean.WaitWithDefaultTimeout()
|
|
||||||
Expect(sys_clean.ExitCode()).To(Equal(0))
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -326,6 +326,7 @@ func SystemExec(command string, args []string) *PodmanSession {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Fail(fmt.Sprintf("unable to run command: %s %s", command, strings.Join(args, " ")))
|
Fail(fmt.Sprintf("unable to run command: %s %s", command, strings.Join(args, " ")))
|
||||||
}
|
}
|
||||||
|
session.Wait(defaultWaitTimeout)
|
||||||
return &PodmanSession{session}
|
return &PodmanSession{session}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue