aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTING.md14
-rw-r--r--cmd/podman/build.go2
-rw-r--r--cmd/podman/common.go9
-rw-r--r--cmd/podman/containers_prune.go1
-rw-r--r--cmd/podman/exec.go10
-rw-r--r--cmd/podman/images_prune.go1
-rw-r--r--cmd/podman/info.go1
-rw-r--r--cmd/podman/play_kube.go11
-rw-r--r--cmd/podman/pod_create.go4
-rw-r--r--cmd/podman/pod_ps.go5
-rw-r--r--cmd/podman/ps.go5
-rw-r--r--cmd/podman/refresh.go6
-rw-r--r--cmd/podman/system_renumber.go1
-rw-r--r--cmd/podman/varlink.go3
-rw-r--r--cmd/podman/version.go1
-rw-r--r--cmd/podman/volume_ls.go5
-rw-r--r--cmd/podman/volume_prune.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
-rwxr-xr-xhack/podman-commands.sh122
-rw-r--r--libpod/container_api.go5
-rw-r--r--libpod/container_internal_linux.go19
-rw-r--r--libpod/oci.go29
-rw-r--r--pkg/rootless/rootless_linux.go3
-rw-r--r--test/e2e/checkpoint_test.go18
-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
40 files changed, 289 insertions, 218 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index b1b166fef..3778d6d7d 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -329,10 +329,16 @@ author hold special privileges on the github repository. Others can be used by
unintentionally. Instead, just write ``LGTM``, or
spell it out.
-* ``[skip ci]``: Within the HEAD commit will cause Cirrus CI to ***NOT*** execute
- tests on the PR. This is useful in basically two cases: 1) You're still working
- and don't want to waste resources. 2) You haven't modified any code that would
- be exercised by the tests. For example, documentation updates (outside of code).
+* ``/hold`` and ``/unhold``: Override the automatic handling of a request. Either
+ put it on hold (no handling) or remove the hold (normal handling).
+
+* ``[ci skip]``: [Adding `[ci skip]` within the HEAD commit](https://cirrus-ci.org/guide/writing-tasks/#conditional-task-execution)
+ will cause Cirrus CI to ***NOT*** execute tests for the PR or after merge. This
+ is useful in only one instance: Your changes are absolutely not exercised by
+ any test. For example, documentation changes. ***IMPORTANT NOTE*** **Other
+ automation may interpret the lack of test results as "PASSED" and unintentionall
+ merge a PR. Consider also using `/hold` in a comment, to add additional
+ protection.**
[The complete list may be found on the command-help page.](https://prow.k8s.io/command-help)
However, not all commands are implemented for this repository. If in doubt, ask a maintainer.
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/common.go b/cmd/podman/common.go
index f9dfa3759..d3387b8f4 100644
--- a/cmd/podman/common.go
+++ b/cmd/podman/common.go
@@ -59,6 +59,14 @@ func checkAllAndLatest(c *cobra.Command, args []string, ignoreArgLen bool) error
return nil
}
+// noSubArgs checks that there are no further positional parameters
+func noSubArgs(c *cobra.Command, args []string) error {
+ if len(args) > 0 {
+ return errors.Errorf("`%s` takes no arguments", c.CommandPath())
+ }
+ return nil
+}
+
// getAllOrLatestContainers tries to return the correct list of containers
// depending if --all, --latest or <container-id> is used.
// It requires the Context (c) and the Runtime (runtime). As different
@@ -519,7 +527,6 @@ func scrubServer(server string) string {
func UsageTemplate() string {
return `Usage:{{if .Runnable}}
{{.UseLine}}{{end}}{{if .HasAvailableSubCommands}}
-
{{.CommandPath}} [command]{{end}}{{if gt (len .Aliases) 0}}
Aliases:
diff --git a/cmd/podman/containers_prune.go b/cmd/podman/containers_prune.go
index 6e4960429..0d0e75332 100644
--- a/cmd/podman/containers_prune.go
+++ b/cmd/podman/containers_prune.go
@@ -21,6 +21,7 @@ var (
`
_pruneContainersCommand = &cobra.Command{
Use: "prune",
+ Args: noSubArgs,
Short: "Remove all stopped containers",
Long: pruneContainersDescription,
RunE: func(cmd *cobra.Command, args []string) error {
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/images_prune.go b/cmd/podman/images_prune.go
index 79dcd097c..427374f68 100644
--- a/cmd/podman/images_prune.go
+++ b/cmd/podman/images_prune.go
@@ -18,6 +18,7 @@ var (
`
_pruneImagesCommand = &cobra.Command{
Use: "prune",
+ Args: noSubArgs,
Short: "Remove unused images",
Long: pruneImagesDescription,
RunE: func(cmd *cobra.Command, args []string) error {
diff --git a/cmd/podman/info.go b/cmd/podman/info.go
index a1473dac9..e87f4e151 100644
--- a/cmd/podman/info.go
+++ b/cmd/podman/info.go
@@ -19,6 +19,7 @@ var (
infoDescription = "Display podman system information"
_infoCommand = &cobra.Command{
Use: "info",
+ Args: noSubArgs,
Long: infoDescription,
Short: `Display information pertaining to the host, current storage stats, and build of podman. Useful for the user and when reporting issues.`,
RunE: func(cmd *cobra.Command, args []string) error {
diff --git a/cmd/podman/play_kube.go b/cmd/podman/play_kube.go
index 6f23e340e..ac46ad5c6 100644
--- a/cmd/podman/play_kube.go
+++ b/cmd/podman/play_kube.go
@@ -90,8 +90,17 @@ func playKubeYAMLCmd(c *cliconfig.KubePlayValues) error {
return errors.Wrapf(err, "unable to read %s as YAML", args[0])
}
+ // check for name collision between pod and container
+ podName := podYAML.ObjectMeta.Name
+ for _, n := range podYAML.Spec.Containers {
+ if n.Name == podName {
+ fmt.Printf("a container exists with the same name (%s) as the pod in your YAML file; changing pod name to %s_pod\n", podName, podName)
+ podName = fmt.Sprintf("%s_pod", podName)
+ }
+ }
+
podOptions = append(podOptions, libpod.WithInfraContainer())
- podOptions = append(podOptions, libpod.WithPodName(podYAML.ObjectMeta.Name))
+ podOptions = append(podOptions, libpod.WithPodName(podName))
// TODO for now we just used the default kernel namespaces; we need to add/subtract this from yaml
nsOptions, err := shared.GetNamespaceOptions(strings.Split(DefaultKernelNamespaces, ","))
diff --git a/cmd/podman/pod_create.go b/cmd/podman/pod_create.go
index f1bbecb84..43c211b2c 100644
--- a/cmd/podman/pod_create.go
+++ b/cmd/podman/pod_create.go
@@ -24,6 +24,7 @@ var (
_podCreateCommand = &cobra.Command{
Use: "create",
+ Args: noSubArgs,
Short: "Create a new empty pod",
Long: podCreateDescription,
RunE: func(cmd *cobra.Command, args []string) error {
@@ -59,9 +60,6 @@ func podCreateCmd(c *cliconfig.PodCreateValues) error {
podIdFile *os.File
)
- if len(c.InputArgs) > 0 {
- return errors.New("podman pod create does not accept any arguments")
- }
runtime, err := adapter.GetRuntime(&c.PodmanCommand)
if err != nil {
return errors.Wrapf(err, "error creating libpod runtime")
diff --git a/cmd/podman/pod_ps.go b/cmd/podman/pod_ps.go
index 70e077651..8e48740e6 100644
--- a/cmd/podman/pod_ps.go
+++ b/cmd/podman/pod_ps.go
@@ -121,6 +121,7 @@ var (
_podPsCommand = &cobra.Command{
Use: "ps",
Aliases: []string{"ls", "list"},
+ Args: noSubArgs,
Short: "List pods",
Long: podPsDescription,
RunE: func(cmd *cobra.Command, args []string) error {
@@ -160,10 +161,6 @@ func podPsCmd(c *cliconfig.PodPsValues) error {
}
defer runtime.Shutdown(false)
- if len(c.InputArgs) > 0 {
- return errors.Errorf("too many arguments, ps takes no arguments")
- }
-
opts := podPsOptions{
NoTrunc: c.NoTrunc,
Quiet: c.Quiet,
diff --git a/cmd/podman/ps.go b/cmd/podman/ps.go
index fe4173fdd..acb5fd7da 100644
--- a/cmd/podman/ps.go
+++ b/cmd/podman/ps.go
@@ -159,6 +159,7 @@ var (
psDescription = "Prints out information about the containers"
_psCommand = cobra.Command{
Use: "ps",
+ Args: noSubArgs,
Short: "List containers",
Long: psDescription,
RunE: func(cmd *cobra.Command, args []string) error {
@@ -215,10 +216,6 @@ func psCmd(c *cliconfig.PsValues) error {
defer runtime.Shutdown(false)
- if len(c.InputArgs) > 0 {
- return errors.Errorf("too many arguments, ps takes no arguments")
- }
-
opts := shared.PsOptions{
All: c.All,
Format: c.Format,
diff --git a/cmd/podman/refresh.go b/cmd/podman/refresh.go
index 641748452..1e4a31a52 100644
--- a/cmd/podman/refresh.go
+++ b/cmd/podman/refresh.go
@@ -15,6 +15,7 @@ var (
refreshDescription = "The refresh command resets the state of all containers to handle database changes after a Podman upgrade. All running containers will be restarted."
_refreshCommand = &cobra.Command{
Use: "refresh",
+ Args: noSubArgs,
Short: "Refresh container state",
Long: refreshDescription,
RunE: func(cmd *cobra.Command, args []string) error {
@@ -26,15 +27,12 @@ var (
)
func init() {
+ _refreshCommand.Hidden = true
refreshCommand.Command = _refreshCommand
refreshCommand.SetUsageTemplate(UsageTemplate())
}
func refreshCmd(c *cliconfig.RefreshValues) error {
- if len(c.InputArgs) > 0 {
- return errors.Errorf("refresh does not accept any arguments")
- }
-
runtime, err := libpodruntime.GetRuntime(&c.PodmanCommand)
if err != nil {
return errors.Wrapf(err, "error creating libpod runtime")
diff --git a/cmd/podman/system_renumber.go b/cmd/podman/system_renumber.go
index c8ce628b1..31137b9f6 100644
--- a/cmd/podman/system_renumber.go
+++ b/cmd/podman/system_renumber.go
@@ -18,6 +18,7 @@ var (
_renumberCommand = &cobra.Command{
Use: "renumber",
+ Args: noSubArgs,
Short: "Migrate lock numbers",
Long: renumberDescription,
RunE: func(cmd *cobra.Command, args []string) error {
diff --git a/cmd/podman/varlink.go b/cmd/podman/varlink.go
index f19d03885..5cc79ef96 100644
--- a/cmd/podman/varlink.go
+++ b/cmd/podman/varlink.go
@@ -49,6 +49,9 @@ func varlinkCmd(c *cliconfig.VarlinkValues) error {
if len(args) < 1 {
return errors.Errorf("you must provide a varlink URI")
}
+ if len(args) > 1 {
+ return errors.Errorf("too many arguments. Requires exactly 1")
+ }
timeout := time.Duration(c.Timeout) * time.Millisecond
// Create a single runtime for varlink
diff --git a/cmd/podman/version.go b/cmd/podman/version.go
index c65ba94f9..b3615ce23 100644
--- a/cmd/podman/version.go
+++ b/cmd/podman/version.go
@@ -17,6 +17,7 @@ var (
versionCommand cliconfig.VersionValues
_versionCommand = &cobra.Command{
Use: "version",
+ Args: noSubArgs,
Short: "Display the Podman Version Information",
RunE: func(cmd *cobra.Command, args []string) error {
versionCommand.InputArgs = args
diff --git a/cmd/podman/volume_ls.go b/cmd/podman/volume_ls.go
index 5adfc1e91..6855f38e0 100644
--- a/cmd/podman/volume_ls.go
+++ b/cmd/podman/volume_ls.go
@@ -49,6 +49,7 @@ and the output format can be changed to JSON or a user specified Go template.
_volumeLsCommand = &cobra.Command{
Use: "ls",
Aliases: []string{"list"},
+ Args: noSubArgs,
Short: "List volumes",
Long: volumeLsDescription,
RunE: func(cmd *cobra.Command, args []string) error {
@@ -76,10 +77,6 @@ func volumeLsCmd(c *cliconfig.VolumeLsValues) error {
}
defer runtime.Shutdown(false)
- if len(c.InputArgs) > 0 {
- return errors.Errorf("too many arguments, ls takes no arguments")
- }
-
opts := volumeLsOptions{
Quiet: c.Quiet,
}
diff --git a/cmd/podman/volume_prune.go b/cmd/podman/volume_prune.go
index 1f7931aa4..370f072eb 100644
--- a/cmd/podman/volume_prune.go
+++ b/cmd/podman/volume_prune.go
@@ -24,6 +24,7 @@ using force.
`
_volumePruneCommand = &cobra.Command{
Use: "prune",
+ Args: noSubArgs,
Short: "Remove all unused volumes",
Long: volumePruneDescription,
RunE: func(cmd *cobra.Command, args []string) error {
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/hack/podman-commands.sh b/hack/podman-commands.sh
index e4c63ab59..754f2923d 100755
--- a/hack/podman-commands.sh
+++ b/hack/podman-commands.sh
@@ -1,40 +1,82 @@
-#!/bin/sh
-./bin/podman --help | sed -n -Ee '0,/Available Commands/d' -e '/^Flags/q;p' | sed '/^$/d' | awk '{ print $1 }' > /tmp/podman.cmd
-man ./docs/podman.1 | sed -n -e '0,/COMMANDS/d' -e '/^FILES/q;p' | grep podman | cut -f2 -d- | cut -f1 -d\( > /tmp/podman.man
-echo diff -B -u /tmp/podman.cmd /tmp/podman.man
-diff -B -u /tmp/podman.cmd /tmp/podman.man
-
-./bin/podman image --help | sed -n -e '0,/Available Commands/d' -e '/^Flags/q;p' | sed '/^$/d' | awk '{ print $1 }' > /tmp/podman-image.cmd
-man ./docs/podman-image.1 | sed -n -Ee '0,/COMMANDS/d' -e 's/^[[:space:]]*//' -e '/^SEE ALSO/q;p' | grep podman | cut -f1 -d' ' | sed 's/^.//' > /tmp/podman-image.man
-echo diff -B -u /tmp/podman-image.cmd /tmp/podman-image.man
-diff -B -u /tmp/podman-image.cmd /tmp/podman-image.man
-
-./bin/podman container --help | sed -n -e '0,/Available Commands/d' -e '/^Flags/q;p' | sed '/^$/d' | awk '{ print $1 }' > /tmp/podman-container.cmd
-man docs/podman-container.1 | sed -n -Ee '0,/COMMANDS/d' -e 's/^[[:space:]]*//' -e '/^SEE ALSO/q;p' | grep podman | cut -f1 -d' ' | sed 's/^.//' > /tmp/podman-container.man
-echo diff -B -u /tmp/podman-container.cmd /tmp/podman-container.man
-diff -B -u /tmp/podman-container.cmd /tmp/podman-container.man
-
-./bin/podman system --help | sed -n -e '0,/Available Commands/d' -e '/^Flags/q;p' | sed '/^$/d' | awk '{ print $1 }' > /tmp/podman-system.cmd
-man docs/podman-system.1 | sed -n -Ee '0,/COMMANDS/d' -e 's/^[[:space:]]*//' -e '/^SEE ALSO/q;p' | grep podman | cut -f1 -d' ' | sed 's/^.//' > /tmp/podman-system.man
-echo diff -B -u /tmp/podman-system.cmd /tmp/podman-system.man
-diff -B -u /tmp/podman-system.cmd /tmp/podman-system.man
-
-./bin/podman play --help | sed -n -e '0,/Available Commands/d' -e '/^Flags/q;p' | sed '/^$/d' | awk '{ print $1 }' > /tmp/podman-play.cmd
-man docs/podman-play.1 | sed -n -Ee '0,/COMMANDS/d' -e 's/^[[:space:]]*//' -e '/^SEE ALSO/q;p' | grep podman | cut -f1 -d' ' | sed 's/^.//' > /tmp/podman-play.man
-echo diff -B -u /tmp/podman-play.cmd /tmp/podman-play.man
-diff -B -u /tmp/podman-play.cmd /tmp/podman-play.man
-
-./bin/podman generate --help | sed -n -e '0,/Available Commands/d' -e '/^Flags/q;p' | sed '/^$/d' | awk '{ print $1 }' > /tmp/podman-generate.cmd
-man docs/podman-generate.1 | sed -n -Ee '0,/COMMANDS/d' -e 's/^[[:space:]]*//' -e '/^SEE ALSO/q;p' | grep podman | cut -f1 -d' ' | sed 's/^.//' > /tmp/podman-generate.man
-echo diff -B -u /tmp/podman-generate.cmd /tmp/podman-generate.man
-diff -B -u /tmp/podman-generate.cmd /tmp/podman-generate.man
-
-./bin/podman pod --help | sed -n -e '0,/Available Commands/d' -e '/^Flags/q;p' | sed '/^$/d' | awk '{ print $1 }' > /tmp/podman-pod.cmd
-man docs/podman-pod.1 | sed -n -Ee '0,/COMMANDS/d' -e 's/^[[:space:]]*//' -e '/^SEE ALSO/q;p' | grep podman | cut -f1 -d' ' | sed 's/^.//' > /tmp/podman-pod.man
-echo diff -B -u /tmp/podman-pod.cmd /tmp/podman-pod.man
-diff -B -u /tmp/podman-pod.cmd /tmp/podman-pod.man
-
-./bin/podman volume --help | sed -n -e '0,/Available Commands/d' -e '/^Flags/q;p' | sed '/^$/d' | awk '{ print $1 }' > /tmp/podman-volume.cmd
-man docs/podman-volume.1 | sed -n -Ee '0,/COMMANDS/d' -e 's/^[[:space:]]*//' -e '/^SEE ALSO/q;p' | grep podman | cut -f1 -d' ' | sed 's/^.//' > /tmp/podman-volume.man
-echo diff -B -u /tmp/podman-volume.cmd /tmp/podman-volume.man
-diff -B -u /tmp/podman-volume.cmd /tmp/podman-volume.man
+#!/bin/bash
+#
+# Compare commands listed by 'podman help' against those in 'man podman'.
+# Recurse into subcommands as well.
+#
+# Because we read metadoc files in the `docs` directory, this script
+# must run from the top level of a git checkout. FIXME: if necessary,
+# it could instead run 'man podman-XX'; my thinking is that this
+# script should run early in CI.
+#
+
+# override with, e.g., PODMAN=./bin/podman-remote
+PODMAN=${PODMAN:-./bin/podman}
+
+function die() {
+ echo "FATAL: $*" >&2
+ exit 1
+}
+
+
+# Run 'podman help' (possibly against a subcommand, e.g. 'podman help image')
+# and return a list of each first word under 'Available Commands', that is,
+# the command name but not its description.
+function podman_commands() {
+ $PODMAN help "$@" |\
+ awk '/^Available Commands:/{ok=1;next}/^Flags:/{ok=0}ok { print $1 }' |\
+ grep .
+}
+
+# Read a list of subcommands from a command's metadoc
+function podman_man() {
+ if [ "$@" = "podman" ]; then
+ # podman itself.
+ # This md file has a table of the form:
+ # | [podman-cmd(1)\[(podman-cmd.1.md) | Description ... |
+ # For all such, print the 'cmd' portion (the one in brackets).
+ sed -ne 's/^|\s\+\[podman-\([a-z]\+\)(1.*/\1/p' <docs/$1.1.md
+ elif [ "$@" = "podman-image-trust" ]; then
+ # Special case: set and show aren't actually in a table in the man page
+ echo set
+ echo show
+ else
+ # podman subcommand.
+ # Each md file has a table of the form:
+ # | cmd | [podman-cmd(1)](podman-cmd.1.md) | Description ... |
+ # For all such we find, with 'podman- in the second column, print the
+ # first column (with whitespace trimmed)
+ awk -F\| '$3 ~ /podman-/ { gsub(" ","",$2); print $2 }' < docs/$1.1.md
+ fi
+}
+
+# The main thing. Compares help and man page; if we find subcommands, recurse.
+rc=0
+function compare_help_and_man() {
+ echo
+ echo "checking: podman $@"
+
+ # e.g. podman, podman-image, podman-volume
+ local basename=$(echo podman "$@" | sed -e 's/ /-/g')
+
+ podman_commands "$@" | sort > /tmp/${basename}_help.txt
+ podman_man $basename | sort > /tmp/${basename}_man.txt
+
+ diff -u /tmp/${basename}_help.txt /tmp/${basename}_man.txt || rc=1
+
+ # Now look for subcommands, e.g. container, image
+ for cmd in $(< /tmp/${basename}_help.txt); do
+ usage=$($PODMAN "$@" $cmd --help | grep -A1 '^Usage:' | tail -1)
+
+ # if string ends in '[command]', recurse into its subcommands
+ if expr "$usage" : '.*\[command\]$' >/dev/null; then
+ compare_help_and_man "$@" $cmd
+ fi
+ done
+
+ rm -f /tmp/${basename}_{help,man}.txt
+}
+
+
+compare_help_and_man
+
+exit $rc
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/container_internal_linux.go b/libpod/container_internal_linux.go
index b074efa3a..0e9a5124e 100644
--- a/libpod/container_internal_linux.go
+++ b/libpod/container_internal_linux.go
@@ -472,10 +472,19 @@ func (c *Container) addNamespaceContainer(g *generate.Generator, ns LinuxNS, ctr
return nil
}
-func (c *Container) checkpoint(ctx context.Context, options ContainerCheckpointOptions) (err error) {
-
+func (c *Container) checkpointRestoreSupported() (err error) {
if !criu.CheckForCriu() {
- return errors.Errorf("checkpointing a container requires at least CRIU %d", criu.MinCriuVersion)
+ return errors.Errorf("Checkpoint/Restore requires at least CRIU %d", criu.MinCriuVersion)
+ }
+ if !c.runtime.ociRuntime.featureCheckCheckpointing() {
+ return errors.Errorf("Configured runtime does not support checkpoint/restore")
+ }
+ return nil
+}
+
+func (c *Container) checkpoint(ctx context.Context, options ContainerCheckpointOptions) (err error) {
+ if err := c.checkpointRestoreSupported(); err != nil {
+ return err
}
if c.state.State != ContainerStateRunning {
@@ -532,8 +541,8 @@ func (c *Container) checkpoint(ctx context.Context, options ContainerCheckpointO
func (c *Container) restore(ctx context.Context, options ContainerCheckpointOptions) (err error) {
- if !criu.CheckForCriu() {
- return errors.Errorf("restoring a container requires at least CRIU %d", criu.MinCriuVersion)
+ if err := c.checkpointRestoreSupported(); err != nil {
+ return err
}
if (c.state.State != ContainerStateConfigured) && (c.state.State != ContainerStateExited) {
diff --git a/libpod/oci.go b/libpod/oci.go
index 26d2c6ef1..2b3cc5db5 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 {
@@ -890,3 +898,16 @@ func (r *OCIRuntime) checkpointContainer(ctr *Container, options ContainerCheckp
args = append(args, ctr.ID())
return utils.ExecCmdWithStdStreams(os.Stdin, os.Stdout, os.Stderr, nil, r.path, args...)
}
+
+func (r *OCIRuntime) featureCheckCheckpointing() bool {
+ // Check if the runtime implements checkpointing. Currently only
+ // runc's checkpoint/restore implementation is supported.
+ cmd := exec.Command(r.path, "checkpoint", "-h")
+ if err := cmd.Start(); err != nil {
+ return false
+ }
+ if err := cmd.Wait(); err == nil {
+ return true
+ }
+ return false
+}
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..583432df1 100644
--- a/test/e2e/checkpoint_test.go
+++ b/test/e2e/checkpoint_test.go
@@ -6,6 +6,7 @@ import (
"fmt"
"net"
"os"
+ "os/exec"
"github.com/containers/libpod/pkg/criu"
. "github.com/containers/libpod/test/utils"
@@ -27,9 +28,26 @@ var _ = Describe("Podman checkpoint", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.RestoreAllArtifacts()
+ // Check if the runtime implements checkpointing. Currently only
+ // runc's checkpoint/restore implementation is supported.
+ cmd := exec.Command(podmanTest.OCIRuntime, "checkpoint", "-h")
+ if err := cmd.Start(); err != nil {
+ Skip("OCI runtime does not support checkpoint/restore")
+ }
+ if err := cmd.Wait(); err != nil {
+ Skip("OCI runtime does not support checkpoint/restore")
+ }
+
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}
}