summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/build.go2
-rw-r--r--cmd/podman/exec.go10
-rw-r--r--cmd/podman/refresh.go1
-rw-r--r--docs/podman-container-refresh.1.md25
-rw-r--r--docs/podman-container.1.md12
-rw-r--r--docs/podman-image.1.md7
-rw-r--r--docs/podman-system.1.md2
-rw-r--r--docs/podman.1.md2
-rw-r--r--libpod/container_api.go5
-rw-r--r--libpod/oci.go16
-rw-r--r--pkg/rootless/rootless_linux.go3
-rw-r--r--test/e2e/checkpoint_test.go7
-rw-r--r--test/e2e/load_test.go4
-rw-r--r--test/e2e/pod_create_test.go2
-rw-r--r--test/e2e/pull_test.go36
-rw-r--r--test/e2e/push_test.go70
-rw-r--r--test/e2e/run_cleanup_test.go6
-rw-r--r--test/e2e/run_networking_test.go33
-rw-r--r--test/e2e/run_ns_test.go3
-rw-r--r--test/e2e/run_privileged_test.go3
-rw-r--r--test/e2e/run_test.go1
-rw-r--r--test/e2e/systemd_test.go22
-rwxr-xr-xtest/test_podman_baseline.sh2
-rw-r--r--test/utils/utils.go1
24 files changed, 127 insertions, 148 deletions
diff --git a/cmd/podman/build.go b/cmd/podman/build.go
index 8ea9e6957..cfeabfb4e 100644
--- a/cmd/podman/build.go
+++ b/cmd/podman/build.go
@@ -53,7 +53,7 @@ func init() {
flags.SetInterspersed(false)
budFlags := buildahcli.GetBudFlags(&budFlagsValues)
- flag := budFlags.Lookup("pull-always")
+ flag := budFlags.Lookup("pull")
flag.Value.Set("true")
flag.DefValue = "true"
layerFlags := buildahcli.GetLayerFlags(&layerValues)
diff --git a/cmd/podman/exec.go b/cmd/podman/exec.go
index 032262497..4917fb606 100644
--- a/cmd/podman/exec.go
+++ b/cmd/podman/exec.go
@@ -105,5 +105,13 @@ func execCmd(c *cliconfig.ExecValues) error {
envs = append(envs, fmt.Sprintf("%s=%s", k, v))
}
- return ctr.Exec(c.Tty, c.Privileged, envs, cmd, c.User, c.Workdir)
+ streams := new(libpod.AttachStreams)
+ streams.OutputStream = os.Stdout
+ streams.ErrorStream = os.Stderr
+ streams.InputStream = os.Stdin
+ streams.AttachOutput = true
+ streams.AttachError = true
+ streams.AttachInput = true
+
+ return ctr.Exec(c.Tty, c.Privileged, envs, cmd, c.User, c.Workdir, streams)
}
diff --git a/cmd/podman/refresh.go b/cmd/podman/refresh.go
index 641748452..193be6953 100644
--- a/cmd/podman/refresh.go
+++ b/cmd/podman/refresh.go
@@ -26,6 +26,7 @@ var (
)
func init() {
+ _refreshCommand.Hidden = true
refreshCommand.Command = _refreshCommand
refreshCommand.SetUsageTemplate(UsageTemplate())
}
diff --git a/docs/podman-container-refresh.1.md b/docs/podman-container-refresh.1.md
deleted file mode 100644
index 26552faa6..000000000
--- a/docs/podman-container-refresh.1.md
+++ /dev/null
@@ -1,25 +0,0 @@
-% podman-container-refresh(1)
-
-## NAME
-podman\-container\-refresh - Refresh all containers
-
-## SYNOPSIS
-**podman container refresh**
-
-## DESCRIPTION
-The refresh command refreshes the state of all containers to pick up database
-schema or general configuration changes. It is not necessary during normal
-operation, and will typically be invoked by package managers after finishing an
-upgrade of the Podman package.
-
-As part of refresh, all running containers will be restarted.
-
-## EXAMPLES ##
-
-```
-$ podman container refresh
-[root@localhost /]#
-```
-
-## SEE ALSO
-podman(1), podman-run(1)
diff --git a/docs/podman-container.1.md b/docs/podman-container.1.md
index 86ffd32c4..1ba957480 100644
--- a/docs/podman-container.1.md
+++ b/docs/podman-container.1.md
@@ -14,25 +14,22 @@ The container command allows you to manage containers
| Command | Man Page | Description |
| --------- | --------------------------------------------------- | ---------------------------------------------------------------------------- |
| attach | [podman-attach(1)](podman-attach.1.md) | Attach to a running container. |
-| checkpoint | [podman-container-checkpoint(1)](podman-container-checkpoint.1.md) | Checkpoints one or more containers. |
+| checkpoint | [podman-container-checkpoint(1)](podman-container-checkpoint.1.md) | Checkpoints one or more containers. |
| cleanup | [podman-container-cleanup(1)](podman-container-cleanup.1.md) | Cleanup containers network and mountpoints. |
| commit | [podman-commit(1)](podman-commit.1.md) | Create new image based on the changed container. |
| create | [podman-create(1)](podman-create.1.md) | Create a new container. |
| diff | [podman-diff(1)](podman-diff.1.md) | Inspect changes on a container or image's filesystem. |
| exec | [podman-exec(1)](podman-exec.1.md) | Execute a command in a running container. |
-| exists | [podman-exists(1)](podman-container-exists.1.md) | Check if a container exists in local storage |
+| exists | [podman-container-exists(1)](podman-container-exists.1.md) | Check if a container exists in local storage |
| export | [podman-export(1)](podman-export.1.md) | Export a container's filesystem contents as a tar archive. |
| inspect | [podman-inspect(1)](podman-inspect.1.md) | Display a container or image's configuration. |
| kill | [podman-kill(1)](podman-kill.1.md) | Kill the main process in one or more containers. |
-| list | [podman-ps(1)](podman-ps.1.md) | List the containers on the system. |
+| list | [podman-ps(1)](podman-ps.1.md) | List the containers on the system.(alias ls) |
| logs | [podman-logs(1)](podman-logs.1.md) | Display the logs of a container. |
-| ls | [podman-ps(1)](podman-ps.1.md) | List the containers on the system. |
| mount | [podman-mount(1)](podman-mount.1.md) | Mount a working container's root filesystem. |
| pause | [podman-pause(1)](podman-pause.1.md) | Pause one or more containers. |
| port | [podman-port(1)](podman-port.1.md) | List port mappings for the container. |
| prune | [podman-container-prune(1)](podman-container-prune.1.md)| Remove all stopped containers from local storage. |
-| ps | [podman-ps(1)](podman-ps.1.md) | List the containers on the system. |
-| refresh | [podman-refresh(1)](podman-container-refresh.1.md) | Refresh the state of all containers |
| restart | [podman-restart(1)](podman-restart.1.md) | Restart one or more containers. |
| restore | [podman-container-restore(1)](podman-container-restore.1.md) | Restores one or more containers from a checkpoint. |
| rm | [podman-rm(1)](podman-rm.1.md) | Remove one or more containers. |
@@ -42,8 +39,7 @@ The container command allows you to manage containers
| stats | [podman-stats(1)](podman-stats.1.md) | Display a live stream of one or more container's resource usage statistics. |
| stop | [podman-stop(1)](podman-stop.1.md) | Stop one or more running containers. |
| top | [podman-top(1)](podman-top.1.md) | Display the running processes of a container. |
-| umount | [podman-umount(1)](podman-umount.1.md) | Unmount a working container's root filesystem. |
-| unmount | [podman-umount(1)](podman-umount.1.md) | Unmount a working container's root filesystem. |
+| umount | [podman-umount(1)](podman-umount.1.md) | Unmount a working container's root filesystem.(Alias unmount) |
| unpause | [podman-unpause(1)](podman-unpause.1.md) | Unpause one or more containers. |
| wait | [podman-wait(1)](podman-wait.1.md) | Wait on one or more containers to stop and print their exit codes. |
diff --git a/docs/podman-image.1.md b/docs/podman-image.1.md
index 95e8b7e48..b4ae752f6 100644
--- a/docs/podman-image.1.md
+++ b/docs/podman-image.1.md
@@ -14,17 +14,16 @@ The image command allows you to manage images
| Command | Man Page | Description |
| -------- | ----------------------------------------------- | --------------------------------------------------------------------------- |
| build | [podman-build(1)](podman-build.1.md) | Build a container using a Dockerfile. |
-| exists | [podman-exists(1)](podman-image-exists.1.md) | Check if a image exists in local storage. |
+| exists | [podman-image-exists(1)](podman-image-exists.1.md) | Check if a image exists in local storage. |
| history | [podman-history(1)](podman-history.1.md) | Show the history of an image. |
| import | [podman-import(1)](podman-import.1.md) | Import a tarball and save it as a filesystem image. |
| inspect | [podman-inspect(1)](podman-inspect.1.md) | Display a image or image's configuration. |
-| list | [podman-images(1)](podman-images.1.md) | List the container images on the system. |
+| list | [podman-images(1)](podman-images.1.md) | List the container images on the system.(alias ls) |
| load | [podman-load(1)](podman-load.1.md) | Load an image from the docker archive. |
-| ls | [podman-images(1)](podman-images.1.md) | List the container images on the system. |
| prune | [podman-image-prune(1)](podman-image-prune.1.md)| Removed all unused images from the local store. |
| pull | [podman-pull(1)](podman-pull.1.md) | Pull an image from a registry. |
| push | [podman-push(1)](podman-push.1.md) | Push an image from local storage to elsewhere. |
-| rm | [podman-rm(1)](podman-rmi.1.md) | Removes one or more locally stored images. |
+| rm | [podman-rmi(1)](podman-rmi.1.md) | Removes one or more locally stored images. |
| save | [podman-save(1)](podman-save.1.md) | Save an image to docker-archive or oci. |
| sign | [podman-image-sign(1)](podman-image-sign.1.md) | Sign an image. |
| tag | [podman-tag(1)](podman-tag.1.md) | Add an additional name to a local image. |
diff --git a/docs/podman-system.1.md b/docs/podman-system.1.md
index d088d4d9a..6d87648e8 100644
--- a/docs/podman-system.1.md
+++ b/docs/podman-system.1.md
@@ -13,7 +13,7 @@ The system command allows you to manage the podman systems
| Command | Man Page | Description |
| ------- | --------------------------------------------------- | ---------------------------------------------------------------------------- |
-| info | [podman-system-info(1)](podman-info.1.md) | Displays Podman related system information. |
+| info | [podman-info(1)](podman-info.1.md) | Displays Podman related system information. |
| prune | [podman-system-prune(1)](podman-system-prune.1.md) | Remove all unused data |
| renumber | [podman-system-renumber(1)](podman-system-renumber.1.md)| Migrate lock numbers to handle a change in maximum number of locks. |
diff --git a/docs/podman.1.md b/docs/podman.1.md
index 43f288fd7..bc03d3c5a 100644
--- a/docs/podman.1.md
+++ b/docs/podman.1.md
@@ -137,7 +137,6 @@ the exit codes follow the `chroot` standard, see below:
| [podman-exec(1)](podman-exec.1.md) | Execute a command in a running container. |
| [podman-export(1)](podman-export.1.md) | Export a container's filesystem contents as a tar archive. |
| [podman-generate(1)](podman-generate.1.md)| Generate structured data based for a containers and pods. |
-| [podman-help(1)](podman-history.1.md) | Show help information on podman. |
| [podman-history(1)](podman-history.1.md) | Show the history of an image. |
| [podman-image(1)](podman-image.1.md) | Manage Images. |
| [podman-images(1)](podman-images.1.md) | List images in local storage. |
@@ -157,7 +156,6 @@ the exit codes follow the `chroot` standard, see below:
| [podman-ps(1)](podman-ps.1.md) | Prints out information about containers. |
| [podman-pull(1)](podman-pull.1.md) | Pull an image from a registry. |
| [podman-push(1)](podman-push.1.md) | Push an image from local storage to elsewhere. |
-| [podman-refresh(1)](podman-refresh.1.md) | Refresh state of all containers to handle database changes. |
| [podman-restart(1)](podman-restart.1.md) | Restart one or more containers. |
| [podman-rm(1)](podman-rm.1.md) | Remove one or more containers. |
| [podman-rmi(1)](podman-rmi.1.md) | Removes one or more locally stored images. |
diff --git a/libpod/container_api.go b/libpod/container_api.go
index 09d7f220d..6bef3c47d 100644
--- a/libpod/container_api.go
+++ b/libpod/container_api.go
@@ -203,9 +203,8 @@ func (c *Container) Kill(signal uint) error {
}
// Exec starts a new process inside the container
-// TODO allow specifying streams to attach to
// TODO investigate allowing exec without attaching
-func (c *Container) Exec(tty, privileged bool, env, cmd []string, user, workDir string) error {
+func (c *Container) Exec(tty, privileged bool, env, cmd []string, user, workDir string, streams *AttachStreams) error {
var capList []string
locked := false
@@ -267,7 +266,7 @@ func (c *Container) Exec(tty, privileged bool, env, cmd []string, user, workDir
logrus.Debugf("Creating new exec session in container %s with session id %s", c.ID(), sessionID)
- execCmd, err := c.runtime.ociRuntime.execContainer(c, cmd, capList, env, tty, workDir, hostUser, sessionID)
+ execCmd, err := c.runtime.ociRuntime.execContainer(c, cmd, capList, env, tty, workDir, hostUser, sessionID, streams)
if err != nil {
return errors.Wrapf(err, "error exec %s", c.ID())
}
diff --git a/libpod/oci.go b/libpod/oci.go
index 26d2c6ef1..4bf76f619 100644
--- a/libpod/oci.go
+++ b/libpod/oci.go
@@ -733,7 +733,7 @@ func (r *OCIRuntime) unpauseContainer(ctr *Container) error {
// TODO: Add --detach support
// TODO: Convert to use conmon
// TODO: add --pid-file and use that to generate exec session tracking
-func (r *OCIRuntime) execContainer(c *Container, cmd, capAdd, env []string, tty bool, cwd, user, sessionID string) (*exec.Cmd, error) {
+func (r *OCIRuntime) execContainer(c *Container, cmd, capAdd, env []string, tty bool, cwd, user, sessionID string, streams *AttachStreams) (*exec.Cmd, error) {
if len(cmd) == 0 {
return nil, errors.Wrapf(ErrInvalidArg, "must provide a command to execute")
}
@@ -789,9 +789,17 @@ func (r *OCIRuntime) execContainer(c *Container, cmd, capAdd, env []string, tty
logrus.Debugf("Starting runtime %s with following arguments: %v", r.path, args)
execCmd := exec.Command(r.path, args...)
- execCmd.Stdout = os.Stdout
- execCmd.Stderr = os.Stderr
- execCmd.Stdin = os.Stdin
+
+ if streams.AttachOutput {
+ execCmd.Stdout = streams.OutputStream
+ }
+ if streams.AttachInput {
+ execCmd.Stdin = streams.InputStream
+ }
+ if streams.AttachError {
+ execCmd.Stderr = streams.ErrorStream
+ }
+
execCmd.Env = append(execCmd.Env, fmt.Sprintf("XDG_RUNTIME_DIR=%s", runtimeDir))
if err := execCmd.Start(); err != nil {
diff --git a/pkg/rootless/rootless_linux.go b/pkg/rootless/rootless_linux.go
index 9a192c0fa..98692707f 100644
--- a/pkg/rootless/rootless_linux.go
+++ b/pkg/rootless/rootless_linux.go
@@ -93,7 +93,8 @@ func tryMappingTool(tool string, pid int, hostID int, mappings []idtools.IDMap)
Args: args,
}
- if err := cmd.Run(); err != nil {
+ if output, err := cmd.CombinedOutput(); err != nil {
+ logrus.Debugf("error from %s: %s", tool, output)
return errors.Wrapf(err, "cannot setup namespace using %s", tool)
}
return nil
diff --git a/test/e2e/checkpoint_test.go b/test/e2e/checkpoint_test.go
index fda6eb085..11332708b 100644
--- a/test/e2e/checkpoint_test.go
+++ b/test/e2e/checkpoint_test.go
@@ -30,6 +30,13 @@ var _ = Describe("Podman checkpoint", func() {
if !criu.CheckForCriu() {
Skip("CRIU is missing or too old.")
}
+ // TODO: Remove the skip when the current CRIU SELinux problem is solved.
+ // See: https://github.com/containers/libpod/issues/2334
+ hostInfo := podmanTest.Host
+ if hostInfo.Distribution == "fedora" {
+ Skip("Checkpointing containers on Fedora currently broken.")
+ }
+
})
AfterEach(func() {
diff --git a/test/e2e/load_test.go b/test/e2e/load_test.go
index c85810454..571754347 100644
--- a/test/e2e/load_test.go
+++ b/test/e2e/load_test.go
@@ -59,7 +59,7 @@ var _ = Describe("Podman load", func() {
Expect(save.ExitCode()).To(Equal(0))
compress := SystemExec("gzip", []string{outfile})
- compress.WaitWithDefaultTimeout()
+ Expect(compress.ExitCode()).To(Equal(0))
outfile = outfile + ".gz"
rmi := podmanTest.Podman([]string{"rmi", ALPINE})
@@ -174,7 +174,6 @@ var _ = Describe("Podman load", func() {
It("podman load localhost registry from scratch", func() {
outfile := filepath.Join(podmanTest.TempDir, "load_test.tar.gz")
-
setup := podmanTest.Podman([]string{"tag", ALPINE, "hello:world"})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
@@ -255,7 +254,6 @@ var _ = Describe("Podman load", func() {
save.WaitWithDefaultTimeout()
Expect(save.ExitCode()).To(Equal(0))
session := SystemExec("xz", []string{outfile})
- session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
rmi := podmanTest.Podman([]string{"rmi", BB})
diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go
index cb2b0e7b0..4717267a1 100644
--- a/test/e2e/pod_create_test.go
+++ b/test/e2e/pod_create_test.go
@@ -95,7 +95,6 @@ var _ = Describe("Podman pod create", func() {
Expect(webserver.ExitCode()).To(Equal(0))
check := SystemExec("nc", []string{"-z", "localhost", "80"})
- check.WaitWithDefaultTimeout()
Expect(check.ExitCode()).To(Equal(1))
})
@@ -111,7 +110,6 @@ var _ = Describe("Podman pod create", func() {
Expect(webserver.ExitCode()).To(Equal(0))
check := SystemExec("nc", []string{"-z", "localhost", "80"})
- check.WaitWithDefaultTimeout()
Expect(check.ExitCode()).To(Equal(0))
})
diff --git a/test/e2e/pull_test.go b/test/e2e/pull_test.go
index faad8202e..d9b9c7213 100644
--- a/test/e2e/pull_test.go
+++ b/test/e2e/pull_test.go
@@ -6,10 +6,12 @@ import (
"os"
"fmt"
+ "path/filepath"
+ "strings"
+
. "github.com/containers/libpod/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
- "strings"
)
var _ = Describe("Podman pull", func() {
@@ -92,58 +94,56 @@ var _ = Describe("Podman pull", 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", "docker-archive:/tmp/alp.tar"})
+ session = podmanTest.Podman([]string{"pull", fmt.Sprintf("docker-archive:%s", tarfn)})
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() {
- 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", "oci-archive:/tmp/oci-alp.tar"})
+ session = podmanTest.Podman([]string{"pull", fmt.Sprintf("oci-archive:%s", tarfn)})
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() {
- setup := SystemExec("mkdir", []string{"-p", "/tmp/podmantestdir"})
- setup.WaitWithDefaultTimeout()
- session := podmanTest.Podman([]string{"push", "alpine", "dir:/tmp/podmantestdir"})
+ dirpath := filepath.Join(podmanTest.TempDir, "alpine")
+ os.MkdirAll(dirpath, os.ModePerm)
+ imgPath := fmt.Sprintf("dir:%s", dirpath)
+
+ session := podmanTest.Podman([]string{"push", "alpine", imgPath})
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", "dir:/tmp/podmantestdir"})
+ session = podmanTest.Podman([]string{"pull", imgPath})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- session = podmanTest.Podman([]string{"rmi", "podmantestdir"})
+ session = podmanTest.Podman([]string{"rmi", "alpine"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
-
- clean := SystemExec("rm", []string{"-fr", "/tmp/podmantestdir"})
- clean.WaitWithDefaultTimeout()
})
It("podman pull check quiet", func() {
diff --git a/test/e2e/push_test.go b/test/e2e/push_test.go
index 42aefd1f7..fee117783 100644
--- a/test/e2e/push_test.go
+++ b/test/e2e/push_test.go
@@ -51,13 +51,11 @@ var _ = Describe("Podman push", 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()
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() {
@@ -85,20 +83,21 @@ var _ = Describe("Podman push", func() {
authPath := filepath.Join(podmanTest.TempDir, "auth")
os.Mkdir(authPath, os.ModePerm)
os.MkdirAll("/etc/containers/certs.d/localhost:5000", os.ModePerm)
- debug := SystemExec("ls", []string{"-l", podmanTest.TempDir})
- debug.WaitWithDefaultTimeout()
+ defer os.RemoveAll("/etc/containers/certs.d/localhost:5000")
cwd, _ := os.Getwd()
certPath := filepath.Join(cwd, "../", "certs")
if IsCommandAvailable("getenforce") {
ge := SystemExec("getenforce", []string{})
- ge.WaitWithDefaultTimeout()
+ Expect(ge.ExitCode()).To(Equal(0))
if ge.OutputToString() == "Enforcing" {
se := SystemExec("setenforce", []string{"0"})
- se.WaitWithDefaultTimeout()
-
- defer SystemExec("setenforce", []string{"1"})
+ Expect(se.ExitCode()).To(Equal(0))
+ defer func() {
+ se2 := SystemExec("setenforce", []string{"1"})
+ Expect(se2.ExitCode()).To(Equal(0))
+ }()
}
}
podmanTest.RestoreArtifact(registry)
@@ -111,8 +110,6 @@ var _ = Describe("Podman push", func() {
f.WriteString(session.OutputToString())
f.Sync()
- debug = SystemExec("cat", []string{filepath.Join(authPath, "htpasswd")})
- debug.WaitWithDefaultTimeout()
session = podmanTest.Podman([]string{"run", "-d", "-p", "5000:5000", "--name", "registry", "-v",
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))
setup := SystemExec("cp", []string{filepath.Join(certPath, "domain.crt"), "/etc/containers/certs.d/localhost:5000/ca.crt"})
- setup.WaitWithDefaultTimeout()
- defer os.RemoveAll("/etc/containers/certs.d/localhost:5000")
+ Expect(setup.ExitCode()).To(Equal(0))
push = podmanTest.Podman([]string{"push", "--creds=podmantest:wrongpasswd", ALPINE, "localhost:5000/credstest"})
push.WaitWithDefaultTimeout()
@@ -155,23 +151,22 @@ var _ = Describe("Podman push", 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()
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() {
setup := SystemExec("bash", []string{"-c", "systemctl status docker 2>&1"})
- setup.WaitWithDefaultTimeout()
if setup.LineInOutputContains("Active: inactive") {
setup = SystemExec("systemctl", []string{"start", "docker"})
- setup.WaitWithDefaultTimeout()
-
- defer SystemExec("systemctl", []string{"stop", "docker"})
+ defer func() {
+ stop := SystemExec("systemctl", []string{"stop", "docker"})
+ Expect(stop.ExitCode()).To(Equal(0))
+ }()
} else if setup.ExitCode() != 0 {
Skip("Docker is not available")
}
@@ -181,22 +176,19 @@ var _ = Describe("Podman push", func() {
Expect(session.ExitCode()).To(Equal(0))
check := SystemExec("docker", []string{"images", "--format", "{{.Repository}}:{{.Tag}}"})
- check.WaitWithDefaultTimeout()
Expect(check.ExitCode()).To(Equal(0))
Expect(check.OutputToString()).To(ContainSubstring("alpine:podmantest"))
clean := SystemExec("docker", []string{"rmi", "alpine:podmantest"})
- clean.WaitWithDefaultTimeout()
Expect(clean.ExitCode()).To(Equal(0))
})
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()
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() {
@@ -208,33 +200,29 @@ var _ = Describe("Podman push", func() {
os.MkdirAll(ostreePath, os.ModePerm)
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.WaitWithDefaultTimeout()
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() {
- 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()
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() {
- 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()
Expect(session.ExitCode()).To(Equal(0))
- clean := SystemExec("rm", []string{"/tmp/alp-oci"})
- clean.WaitWithDefaultTimeout()
- Expect(clean.ExitCode()).To(Equal(0))
})
})
diff --git a/test/e2e/run_cleanup_test.go b/test/e2e/run_cleanup_test.go
index aa823b4e6..1f2a4085d 100644
--- a/test/e2e/run_cleanup_test.go
+++ b/test/e2e/run_cleanup_test.go
@@ -36,14 +36,16 @@ var _ = Describe("Podman run exit", func() {
It("podman run -d mount cleanup test", func() {
mount := SystemExec("mount", nil)
- mount.WaitWithDefaultTimeout()
+ Expect(mount.ExitCode()).To(Equal(0))
+
out1 := mount.OutputToString()
result := podmanTest.Podman([]string{"create", "-dt", ALPINE, "echo", "hello"})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
mount = SystemExec("mount", nil)
- mount.WaitWithDefaultTimeout()
+ Expect(mount.ExitCode()).To(Equal(0))
+
out2 := mount.OutputToString()
Expect(out1).To(Equal(out2))
})
diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go
index a07e4d047..c89a4f487 100644
--- a/test/e2e/run_networking_test.go
+++ b/test/e2e/run_networking_test.go
@@ -58,7 +58,6 @@ var _ = Describe("Podman run networking", func() {
session.Wait(30)
Expect(session.ExitCode()).To(Equal(0))
results := SystemExec("iptables", []string{"-t", "nat", "-L"})
- results.Wait(30)
Expect(results.ExitCode()).To(Equal(0))
Expect(results.OutputToString()).To(ContainSubstring("222"))
Expect(results.OutputToString()).To(ContainSubstring("223"))
@@ -69,12 +68,10 @@ var _ = Describe("Podman run networking", func() {
session.Wait(30)
Expect(session.ExitCode()).To(Equal(0))
results := SystemExec("iptables", []string{"-t", "nat", "-L"})
- results.Wait(30)
Expect(results.ExitCode()).To(Equal(0))
Expect(results.OutputToString()).To(ContainSubstring("8000"))
ncBusy := SystemExec("nc", []string{"-l", "-p", "80"})
- ncBusy.Wait(10)
Expect(ncBusy.ExitCode()).ToNot(Equal(0))
})
@@ -183,26 +180,40 @@ var _ = Describe("Podman run networking", func() {
if Containerized() {
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.Wait(90)
Expect(session.ExitCode()).To(Equal(0))
- SystemExec("ip", []string{"netns", "delete", "xxx"})
})
It("podman run n user created network namespace with resolv.conf", func() {
if Containerized() {
Skip("Can not be run within a container.")
}
- SystemExec("ip", []string{"netns", "add", "xxx"})
- SystemExec("mkdir", []string{"-p", "/etc/netns/xxx"})
- SystemExec("bash", []string{"-c", "echo nameserver 11.11.11.11 > /etc/netns/xxx/resolv.conf"})
- session := podmanTest.Podman([]string{"run", "--net", "ns:/run/netns/xxx", ALPINE, "cat", "/etc/resolv.conf"})
+ addXXX2 := SystemExec("ip", []string{"netns", "add", "xxx2"})
+ Expect(addXXX2.ExitCode()).To(Equal(0))
+ defer func() {
+ 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)
Expect(session.ExitCode()).To(Equal(0))
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() {
diff --git a/test/e2e/run_ns_test.go b/test/e2e/run_ns_test.go
index 9962185f2..3d95c3a0b 100644
--- a/test/e2e/run_ns_test.go
+++ b/test/e2e/run_ns_test.go
@@ -53,7 +53,6 @@ var _ = Describe("Podman run ns", func() {
It("podman run ipcns test", func() {
setup := SystemExec("ls", []string{"--inode", "-d", "/dev/shm"})
- setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
hostShm := setup.OutputToString()
@@ -65,7 +64,6 @@ var _ = Describe("Podman run ns", func() {
It("podman run ipcns ipcmk host test", func() {
setup := SystemExec("ipcmk", []string{"-M", "1024"})
- setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
output := strings.Split(setup.OutputToString(), " ")
ipc := output[len(output)-1]
@@ -74,7 +72,6 @@ var _ = Describe("Podman run ns", func() {
Expect(session.ExitCode()).To(Equal(0))
setup = SystemExec("ipcrm", []string{"-m", ipc})
- setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
})
diff --git a/test/e2e/run_privileged_test.go b/test/e2e/run_privileged_test.go
index 0c0de30c5..ee6e8e950 100644
--- a/test/e2e/run_privileged_test.go
+++ b/test/e2e/run_privileged_test.go
@@ -46,7 +46,6 @@ var _ = Describe("Podman privileged container tests", func() {
It("podman privileged CapEff", func() {
cap := SystemExec("grep", []string{"CapEff", "/proc/self/status"})
- cap.WaitWithDefaultTimeout()
Expect(cap.ExitCode()).To(Equal(0))
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() {
cap := SystemExec("grep", []string{"CapEff", "/proc/self/status"})
- cap.WaitWithDefaultTimeout()
Expect(cap.ExitCode()).To(Equal(0))
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.WaitWithDefaultTimeout()
if cap.ExitCode() != 0 {
Skip("Can't determine NoNewPrivs")
}
diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go
index 6bd49de33..93ee5036f 100644
--- a/test/e2e/run_test.go
+++ b/test/e2e/run_test.go
@@ -387,7 +387,6 @@ var _ = Describe("Podman run", func() {
err = ioutil.WriteFile(keyFile, []byte(mountString), 0755)
Expect(err).To(BeNil())
execSession := SystemExec("ln", []string{"-s", targetDir, filepath.Join(secretsDir, "mysymlink")})
- execSession.WaitWithDefaultTimeout()
Expect(execSession.ExitCode()).To(Equal(0))
session := podmanTest.Podman([]string{"--default-mounts-file=" + mountsFile, "run", "--rm", ALPINE, "cat", "/run/secrets/test.txt"})
diff --git a/test/e2e/systemd_test.go b/test/e2e/systemd_test.go
index a7e7a1500..252361288 100644
--- a/test/e2e/systemd_test.go
+++ b/test/e2e/systemd_test.go
@@ -53,31 +53,27 @@ WantedBy=multi-user.target
sys_file := ioutil.WriteFile("/etc/systemd/system/redis.service", []byte(systemd_unit_file), 0644)
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.WaitWithDefaultTimeout()
Expect(create.ExitCode()).To(Equal(0))
- enable := SystemExec("bash", []string{"-c", "systemctl daemon-reload && systemctl enable --now redis"})
- enable.WaitWithDefaultTimeout()
+ enable := SystemExec("bash", []string{"-c", "systemctl daemon-reload"})
Expect(enable.ExitCode()).To(Equal(0))
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.WaitWithDefaultTimeout()
+ Expect(logs.ExitCode()).To(Equal(0))
status := SystemExec("bash", []string{"-c", "systemctl status redis"})
- status.WaitWithDefaultTimeout()
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))
})
})
diff --git a/test/test_podman_baseline.sh b/test/test_podman_baseline.sh
index 8a878b4e7..664fd2b03 100755
--- a/test/test_podman_baseline.sh
+++ b/test/test_podman_baseline.sh
@@ -195,7 +195,7 @@ podman rmi --all
########
# 1.004608 MB is 1,004,608 bytes. The container overhead is 4608 bytes (or 9 512 byte pages), so this allocates 1 MB of usable storage
-PODMANBASE="-s overlay --storage-opt overlay.size=1.004608M --root /tmp/podman_test/crio"
+PODMANBASE="--storage-driver overlay --storage-opt overlay.size=1.004608M --root /tmp/podman_test/crio"
TMPDIR=/tmp/podman_test
mkdir $TMPDIR
dd if=/dev/zero of=$TMPDIR/virtfs bs=1024 count=30720
diff --git a/test/utils/utils.go b/test/utils/utils.go
index 098779321..499466f5a 100644
--- a/test/utils/utils.go
+++ b/test/utils/utils.go
@@ -326,6 +326,7 @@ func SystemExec(command string, args []string) *PodmanSession {
if err != nil {
Fail(fmt.Sprintf("unable to run command: %s %s", command, strings.Join(args, " ")))
}
+ session.Wait(defaultWaitTimeout)
return &PodmanSession{session}
}