summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/check_cirrus_cron.yml9
-rw-r--r--cmd/podman/auto-update.go99
-rw-r--r--cmd/podman/manifest/create.go5
-rw-r--r--cmd/podman/pods/ps.go5
-rwxr-xr-xcontrib/cirrus/runner.sh7
-rw-r--r--docs/source/Tutorials.rst2
-rw-r--r--docs/source/includes.rst2
-rw-r--r--docs/source/markdown/podman-auto-update.1.md42
-rw-r--r--docs/source/markdown/podman-create.1.md36
-rw-r--r--docs/source/markdown/podman-pod-ps.1.md59
-rw-r--r--docs/source/markdown/podman-pull.1.md2
-rw-r--r--docs/source/markdown/podman-run.1.md39
-rw-r--r--docs/tutorials/README.md6
-rw-r--r--docs/tutorials/basic_networking.md2
-rw-r--r--docs/tutorials/podman-go-bindings.md543
-rw-r--r--docs/tutorials/rootless_tutorial.md54
-rw-r--r--go.mod6
-rw-r--r--go.sum12
-rw-r--r--libpod/container_internal_linux.go5
-rw-r--r--libpod/container_log.go4
-rw-r--r--libpod/container_log_linux.go8
-rw-r--r--libpod/logs/log.go8
-rw-r--r--libpod/networking_linux.go471
-rw-r--r--libpod/oci_conmon_exec_linux.go3
-rw-r--r--libpod/runtime.go9
-rw-r--r--nix/default-arm64.nix5
-rw-r--r--nix/default.nix7
-rw-r--r--nix/nixpkgs.json8
-rw-r--r--pkg/api/handlers/compat/containers_logs.go14
-rw-r--r--pkg/api/handlers/compat/networks.go47
-rw-r--r--pkg/api/handlers/types.go43
-rw-r--r--pkg/autoupdate/autoupdate.go254
-rw-r--r--pkg/bindings/README.md77
-rw-r--r--pkg/bindings/containers/attach.go19
-rw-r--r--pkg/bindings/images/build.go16
-rw-r--r--pkg/domain/entities/auto-update.go19
-rw-r--r--pkg/domain/entities/engine_container.go2
-rw-r--r--pkg/domain/infra/abi/auto-update.go9
-rw-r--r--pkg/domain/infra/abi/system.go2
-rw-r--r--pkg/domain/infra/tunnel/auto-update.go2
-rw-r--r--pkg/systemd/generate/containers.go7
-rw-r--r--test/apiv2/20-containers.at8
-rw-r--r--test/apiv2/30-volumes.at7
-rw-r--r--test/apiv2/35-networks.at14
-rw-r--r--test/apiv2/python/rest_api/test_v2_0_0_container.py13
-rw-r--r--test/compose/uptwice/Dockerfile2
-rw-r--r--test/compose/uptwice/docker-compose.yml5
-rw-r--r--test/compose/uptwice/tests.sh4
-rw-r--r--test/e2e/attach_test.go25
-rw-r--r--test/e2e/build_test.go75
-rw-r--r--test/e2e/checkpoint_test.go221
-rw-r--r--test/e2e/commit_test.go69
-rw-r--r--test/e2e/common_test.go4
-rw-r--r--test/e2e/container_inspect_test.go3
-rw-r--r--test/e2e/containers_conf_test.go71
-rw-r--r--test/e2e/cp_test.go53
-rw-r--r--test/e2e/create_staticip_test.go19
-rw-r--r--test/e2e/create_staticmac_test.go9
-rw-r--r--test/e2e/create_test.go171
-rw-r--r--test/e2e/diff_test.go33
-rw-r--r--test/e2e/events_test.go26
-rw-r--r--test/e2e/exec_test.go175
-rw-r--r--test/e2e/exists_test.go4
-rw-r--r--test/e2e/export_test.go5
-rw-r--r--test/e2e/generate_kube_test.go227
-rw-r--r--test/e2e/generate_systemd_test.go117
-rw-r--r--test/e2e/healthcheck_run_test.go53
-rw-r--r--test/e2e/history_test.go17
-rw-r--r--test/e2e/image_sign_test.go5
-rw-r--r--test/e2e/import_test.go43
-rw-r--r--test/e2e/info_test.go8
-rw-r--r--test/e2e/init_test.go41
-rw-r--r--test/e2e/inspect_test.go114
-rw-r--r--test/e2e/kill_test.go51
-rw-r--r--test/e2e/load_test.go87
-rw-r--r--test/e2e/login_logout_test.go57
-rw-r--r--test/e2e/logs_test.go4
-rw-r--r--test/e2e/manifest_test.go90
-rw-r--r--test/e2e/mount_rootless_test.go15
-rw-r--r--test/e2e/mount_test.go153
-rw-r--r--test/e2e/namespace_test.go7
-rw-r--r--test/e2e/network_connect_disconnect_test.go123
-rw-r--r--test/e2e/network_create_test.go29
-rw-r--r--test/e2e/network_test.go169
-rw-r--r--test/e2e/pause_test.go73
-rw-r--r--test/e2e/play_kube_test.go251
-rw-r--r--test/e2e/pod_create_test.go147
-rw-r--r--test/e2e/pod_infra_container_test.go125
-rw-r--r--test/e2e/pod_inspect_test.go21
-rw-r--r--test/e2e/pod_kill_test.go35
-rw-r--r--test/e2e/pod_pause_test.go17
-rw-r--r--test/e2e/pod_pod_namespaces_test.go25
-rw-r--r--test/e2e/pod_prune_test.go9
-rw-r--r--test/e2e/pod_ps_test.go78
-rw-r--r--test/e2e/pod_restart_test.go35
-rw-r--r--test/e2e/pod_rm_test.go53
-rw-r--r--test/e2e/pod_start_test.go46
-rw-r--r--test/e2e/pod_stats_test.go50
-rw-r--r--test/e2e/pod_stop_test.go59
-rw-r--r--test/e2e/pod_top_test.go31
-rw-r--r--test/e2e/port_test.go27
-rw-r--r--test/e2e/prune_test.go139
-rw-r--r--test/e2e/ps_test.go210
-rw-r--r--test/e2e/pull_test.go165
-rw-r--r--test/e2e/push_test.go47
-rw-r--r--test/e2e/rename_test.go29
-rw-r--r--test/e2e/restart_test.go47
-rw-r--r--test/e2e/rm_test.go83
-rw-r--r--test/e2e/run_apparmor_test.go21
-rw-r--r--test/e2e/run_cgroup_parent_test.go15
-rw-r--r--test/e2e/run_cleanup_test.go15
-rw-r--r--test/e2e/run_cpu_test.go19
-rw-r--r--test/e2e/run_device_test.go19
-rw-r--r--test/e2e/run_dns_test.go19
-rw-r--r--test/e2e/run_entrypoint_test.go19
-rw-r--r--test/e2e/run_env_test.go33
-rw-r--r--test/e2e/run_exit_test.go11
-rw-r--r--test/e2e/run_memory_test.go11
-rw-r--r--test/e2e/run_networking_test.go161
-rw-r--r--test/e2e/run_ns_test.go29
-rw-r--r--test/e2e/run_passwd_test.go25
-rw-r--r--test/e2e/run_privileged_test.go29
-rw-r--r--test/e2e/run_restart_test.go11
-rw-r--r--test/e2e/run_seccomp_test.go11
-rw-r--r--test/e2e/run_security_labels_test.go33
-rw-r--r--test/e2e/run_selinux_test.go87
-rw-r--r--test/e2e/run_signal_test.go5
-rw-r--r--test/e2e/run_staticip_test.go5
-rw-r--r--test/e2e/run_test.go401
-rw-r--r--test/e2e/run_userns_test.go53
-rw-r--r--test/e2e/run_volume_test.go186
-rw-r--r--test/e2e/run_working_dir_test.go9
-rw-r--r--test/e2e/runlabel_test.go21
-rw-r--r--test/e2e/save_test.go43
-rw-r--r--test/e2e/search_test.go79
-rw-r--r--test/e2e/secret_test.go53
-rw-r--r--test/e2e/start_test.go59
-rw-r--r--test/e2e/stats_test.go49
-rw-r--r--test/e2e/stop_test.go111
-rw-r--r--test/e2e/system_df_test.go17
-rw-r--r--test/e2e/system_reset_test.go17
-rw-r--r--test/e2e/systemd_test.go37
-rw-r--r--test/e2e/tag_test.go19
-rw-r--r--test/e2e/toolbox_test.go63
-rw-r--r--test/e2e/top_test.go31
-rw-r--r--test/e2e/tree_test.go9
-rw-r--r--test/e2e/trust_test.go9
-rw-r--r--test/e2e/unshare_test.go5
-rw-r--r--test/e2e/untag_test.go17
-rw-r--r--test/e2e/volume_create_test.go13
-rw-r--r--test/e2e/volume_exists_test.go7
-rw-r--r--test/e2e/volume_inspect_test.go19
-rw-r--r--test/e2e/volume_ls_test.go42
-rw-r--r--test/e2e/volume_plugin_test.go43
-rw-r--r--test/e2e/volume_prune_test.go51
-rw-r--r--test/e2e/volume_rm_test.go37
-rw-r--r--test/e2e/wait_test.go39
-rw-r--r--test/python/docker/compat/test_containers.py14
-rw-r--r--test/system/070-build.bats74
-rw-r--r--test/system/075-exec.bats2
-rw-r--r--test/system/250-systemd.bats2
-rw-r--r--test/system/255-auto-update.bats19
-rw-r--r--test/system/500-networking.bats1
-rw-r--r--vendor/github.com/Microsoft/hcsshim/errors.go6
-rw-r--r--vendor/github.com/Microsoft/hcsshim/internal/hcs/errors.go12
-rw-r--r--vendor/github.com/containers/storage/VERSION2
-rw-r--r--vendor/github.com/containers/storage/go.mod2
-rw-r--r--vendor/github.com/containers/storage/go.sum4
-rw-r--r--vendor/github.com/containers/storage/pkg/fileutils/fileutils.go2
-rw-r--r--vendor/github.com/containers/storage/pkg/lockfile/lockfile_unix.go26
-rw-r--r--vendor/github.com/containers/storage/types/options.go19
-rw-r--r--vendor/github.com/containers/storage/types/storage_broken.conf18
-rw-r--r--vendor/github.com/containers/storage/types/utils.go10
-rw-r--r--vendor/github.com/google/uuid/null.go118
-rw-r--r--vendor/github.com/google/uuid/uuid.go45
-rw-r--r--vendor/github.com/google/uuid/version4.go27
-rw-r--r--vendor/github.com/onsi/gomega/CHANGELOG.md17
-rw-r--r--vendor/github.com/onsi/gomega/README.md2
-rw-r--r--vendor/github.com/onsi/gomega/gexec/build.go6
-rw-r--r--vendor/github.com/onsi/gomega/go.mod2
-rw-r--r--vendor/github.com/onsi/gomega/go.sum6
-rw-r--r--vendor/github.com/onsi/gomega/gomega_dsl.go88
-rw-r--r--vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion.go49
-rw-r--r--vendor/modules.txt8
184 files changed, 4679 insertions, 4216 deletions
diff --git a/.github/workflows/check_cirrus_cron.yml b/.github/workflows/check_cirrus_cron.yml
index d869576fd..65c483c96 100644
--- a/.github/workflows/check_cirrus_cron.yml
+++ b/.github/workflows/check_cirrus_cron.yml
@@ -6,10 +6,12 @@
name: check_cirrus_cron
on:
- # Note: This only applies to the master branch.
+ # Note: This only applies to the main branch.
schedule:
- # Assume cirrus cron jobs runs at least once per day
- - cron: '59 23 * * *'
+ # N/B: This should correspond to a period slightly after
+ # the last job finishes running. See job defs. at:
+ # https://cirrus-ci.com/settings/repository/6707778565701632
+ - cron: '59 23 * * 1-5'
# Debug: Allow triggering job manually in github-actions WebUI
workflow_dispatch: {}
@@ -30,7 +32,6 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
- ref: master
persist-credentials: false
- name: Get failed cron names and Build IDs
diff --git a/cmd/podman/auto-update.go b/cmd/podman/auto-update.go
index 99226790f..9622088d5 100644
--- a/cmd/podman/auto-update.go
+++ b/cmd/podman/auto-update.go
@@ -1,10 +1,15 @@
package main
import (
+ "encoding/json"
"fmt"
+ "os"
+ "strings"
"github.com/containers/common/pkg/auth"
"github.com/containers/common/pkg/completion"
+ "github.com/containers/common/pkg/report"
+ "github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/errorhandling"
@@ -12,8 +17,13 @@ import (
"github.com/spf13/cobra"
)
+type cliAutoUpdateOptions struct {
+ entities.AutoUpdateOptions
+ format string
+}
+
var (
- autoUpdateOptions = entities.AutoUpdateOptions{}
+ autoUpdateOptions = cliAutoUpdateOptions{}
autoUpdateDescription = `Auto update containers according to their auto-update policy.
Auto-update policies are specified with the "io.containers.autoupdate" label.
@@ -42,6 +52,11 @@ func init() {
authfileFlagName := "authfile"
flags.StringVar(&autoUpdateOptions.Authfile, authfileFlagName, auth.GetDefaultAuthFile(), "Path to the authentication file. Use REGISTRY_AUTH_FILE environment variable to override")
_ = autoUpdateCommand.RegisterFlagCompletionFunc(authfileFlagName, completion.AutocompleteDefault)
+
+ flags.BoolVar(&autoUpdateOptions.DryRun, "dry-run", false, "Check for pending updates")
+
+ flags.StringVar(&autoUpdateOptions.format, "format", "", "Change the output format to JSON or a Go template")
+ _ = autoUpdateCommand.RegisterFlagCompletionFunc("format", common.AutocompleteFormat(autoUpdateOutput{}))
}
func autoUpdate(cmd *cobra.Command, args []string) error {
@@ -49,11 +64,83 @@ func autoUpdate(cmd *cobra.Command, args []string) error {
// Backwards compat. System tests expect this error string.
return errors.Errorf("`%s` takes no arguments", cmd.CommandPath())
}
- report, failures := registry.ContainerEngine().AutoUpdate(registry.GetContext(), autoUpdateOptions)
- if report != nil {
- for _, unit := range report.Units {
- fmt.Println(unit)
- }
+
+ allReports, failures := registry.ContainerEngine().AutoUpdate(registry.GetContext(), autoUpdateOptions.AutoUpdateOptions)
+ if allReports == nil {
+ return errorhandling.JoinErrors(failures)
+ }
+
+ if err := writeTemplate(allReports, autoUpdateOptions.format); err != nil {
+ failures = append(failures, err)
}
+
return errorhandling.JoinErrors(failures)
}
+
+type autoUpdateOutput struct {
+ Unit string
+ Container string
+ ContainerName string
+ ContainerID string
+ Image string
+ Policy string
+ Updated string
+}
+
+func reportsToOutput(allReports []*entities.AutoUpdateReport) []autoUpdateOutput {
+ output := make([]autoUpdateOutput, len(allReports))
+ for i, r := range allReports {
+ output[i] = autoUpdateOutput{
+ Unit: r.SystemdUnit,
+ Container: fmt.Sprintf("%s (%s)", r.ContainerID[:12], r.ContainerName),
+ ContainerName: r.ContainerName,
+ ContainerID: r.ContainerID,
+ Image: r.ImageName,
+ Policy: r.Policy,
+ Updated: r.Updated,
+ }
+ }
+ return output
+}
+
+func writeTemplate(allReports []*entities.AutoUpdateReport, inputFormat string) error {
+ var format string
+ var printHeader bool
+
+ output := reportsToOutput(allReports)
+ switch inputFormat {
+ case "":
+ rows := []string{"{{.Unit}}", "{{.Container}}", "{{.Image}}", "{{.Policy}}", "{{.Updated}}"}
+ format = "{{range . }}" + strings.Join(rows, "\t") + "\n{{end -}}"
+ printHeader = true
+ case "json":
+ prettyJSON, err := json.MarshalIndent(output, "", " ")
+ if err != nil {
+ return err
+ }
+ fmt.Println(string(prettyJSON))
+ return nil
+ default:
+ format = "{{range . }}" + inputFormat + "\n{{end -}}"
+ }
+
+ tmpl, err := report.NewTemplate("auto-update").Parse(format)
+ if err != nil {
+ return err
+ }
+
+ w, err := report.NewWriterDefault(os.Stdout)
+ if err != nil {
+ return err
+ }
+ defer w.Flush()
+
+ if printHeader {
+ headers := report.Headers(autoUpdateOutput{}, nil)
+ if err := tmpl.Execute(w, headers); err != nil {
+ return err
+ }
+ }
+
+ return tmpl.Execute(w, output)
+}
diff --git a/cmd/podman/manifest/create.go b/cmd/podman/manifest/create.go
index 9f7d74d14..95c9f89b0 100644
--- a/cmd/podman/manifest/create.go
+++ b/cmd/podman/manifest/create.go
@@ -13,15 +13,16 @@ import (
var (
manifestCreateOpts = entities.ManifestCreateOptions{}
createCmd = &cobra.Command{
- Use: "create [options] LIST [IMAGE]",
+ Use: "create [options] LIST [IMAGE...]",
Short: "Create manifest list or image index",
Long: "Creates manifest lists or image indexes.",
RunE: create,
ValidArgsFunction: common.AutocompleteImages,
Example: `podman manifest create mylist:v1.11
podman manifest create mylist:v1.11 arch-specific-image-to-add
+ podman manifest create mylist:v1.11 arch-specific-image-to-add another-arch-specific-image-to-add
podman manifest create --all mylist:v1.11 transport:tagged-image-to-add`,
- Args: cobra.RangeArgs(1, 2),
+ Args: cobra.MinimumNArgs(1),
}
)
diff --git a/cmd/podman/pods/ps.go b/cmd/podman/pods/ps.go
index 3e5ab86f4..14e3e2ea9 100644
--- a/cmd/podman/pods/ps.go
+++ b/cmd/podman/pods/ps.go
@@ -124,6 +124,11 @@ func pods(cmd *cobra.Command, _ []string) error {
"NumberOfContainers": "# OF CONTAINERS",
"Created": "CREATED",
"InfraID": "INFRA ID",
+ "ContainerIds": "IDS",
+ "ContainerNames": "NAMES",
+ "ContainerStatuses": "STATUS",
+ "Cgroup": "CGROUP",
+ "Namespace": "NAMESPACES",
})
renderHeaders := true
row := podPsFormat()
diff --git a/contrib/cirrus/runner.sh b/contrib/cirrus/runner.sh
index cac679466..da43ffb0a 100755
--- a/contrib/cirrus/runner.sh
+++ b/contrib/cirrus/runner.sh
@@ -173,7 +173,7 @@ function _run_swagger() {
trap "rm -f $envvarsfile" EXIT # contains secrets
# Warning: These values must _not_ be quoted, podman will not remove them.
#shellcheck disable=SC2154
- cat <<eof>>$envvarsfile
+ cat <<eof >>$envvarsfile
GCPJSON=$GCPJSON
GCPNAME=$GCPNAME
GCPPROJECT=$GCPPROJECT
@@ -336,6 +336,11 @@ msg "************************************************************"
# shellcheck disable=SC2154
if [[ "$PRIV_NAME" == "rootless" ]] && [[ "$UID" -eq 0 ]]; then
+ # Remove /var/lib/cni, it is not required for rootless cni.
+ # We have to test that it works without this directory.
+ # https://github.com/containers/podman/issues/10857
+ rm -rf /var/lib/cni
+
req_env_vars ROOTLESS_USER
msg "Re-executing runner through ssh as user '$ROOTLESS_USER'"
msg "************************************************************"
diff --git a/docs/source/Tutorials.rst b/docs/source/Tutorials.rst
index e48d1e853..cb9ab644d 100644
--- a/docs/source/Tutorials.rst
+++ b/docs/source/Tutorials.rst
@@ -10,5 +10,5 @@ Here are a number of useful tutorials to get you up and running with Podman. If
* `How to sign and distribute container images using Podman <https://github.com/containers/podman/blob/master/docs/tutorials/image_signing.md>`_: Learn how to setup and use image signing with Podman.
* `Podman remote-client tutorial <https://github.com/containers/podman/blob/master/docs/tutorials/remote_client.md>`_: A brief how-to on using the Podman remote-client.
* `How to use libpod for custom/derivative projects <https://github.com/containers/podman/blob/master/docs/tutorials/podman-derivative-api.md>`_: How the libpod API can be used within your own project.
-* `How to use Podman's Go bindings <https://github.com/containers/podman/blob/master/docs/tutorials/podman-go-bindings.md>`_: A brief how-to on using Podman's Go bindings in external applications.
+* `How to use Podman's Go RESTful bindings <https://github.com/containers/podman/tree/main/pkg/bindings>`_: An introduction to using our RESTful Golang bindings in an external application.
* `Common network setups <https://github.com/containers/podman/blob/master/docs/tutorials/basic_networking.md>`_: A basic guide to common network setups for Podman.
diff --git a/docs/source/includes.rst b/docs/source/includes.rst
index 8d3b6e2db..6e04d77f4 100644
--- a/docs/source/includes.rst
+++ b/docs/source/includes.rst
@@ -16,4 +16,4 @@
.. _podman run: http://docs.podman.io/en/latest/markdown/podman-run.1.html
.. _podman build: http://docs.podman.io/en/latest/markdown/podman-build.1.html
.. _podman push: http://docs.podman.io/en/latest/markdown/podman-push.1.html
-.. image:: https://github.com/containers/podman/blob/master/logo/podman-logo.png?raw=true
+.. image:: https://github.com/containers/podman/blob/main/logo/podman-logo.png?raw=true
diff --git a/docs/source/markdown/podman-auto-update.1.md b/docs/source/markdown/podman-auto-update.1.md
index 24b910470..106b9b00a 100644
--- a/docs/source/markdown/podman-auto-update.1.md
+++ b/docs/source/markdown/podman-auto-update.1.md
@@ -41,6 +41,27 @@ If the authorization state is not found there, `$HOME/.docker/config.json` is ch
Note: There is also the option to override the default path of the authentication file by setting the `REGISTRY_AUTH_FILE` environment variable. This can be done with **export REGISTRY_AUTH_FILE=_path_**.
+#### **--dry-run**=*true|false*
+
+Check for the availability of new images but do not perform any pull operation or restart any service or container.
+The `UPDATED` field indicates the availability of a new image with "pending".
+
+#### **--format**=*format*
+
+Change the default output format. This can be of a supported type like 'json' or a Go template.
+Valid placeholders for the Go template are listed below:
+
+| **Placeholder** | **Description** |
+| --------------- | -------------------------------------- |
+| .Unit | Name of the systemd unit |
+| .ContainerName | Name of the container |
+| .ContainerID | ID of the container |
+| .Container | ID and name of the container |
+| .Image | Name of the image |
+| .Policy | Auto-update policy of the container |
+| .Updated | Update status: true,false,failed |
+
+
## EXAMPLES
Autoupdate with registry policy
@@ -48,26 +69,31 @@ Autoupdate with registry policy
### Start a container
$ podman run --label "io.containers.autoupdate=registry" \
--label "io.containers.autoupdate.authfile=/some/authfile.json" \
- -d busybox:latest top
+ -d --name=test registry.fedoraproject.org/fedora:latest sleep infinity
bc219740a210455fa27deacc96d50a9e20516492f1417507c13ce1533dbdcd9d
### Generate a systemd unit for this container
$ podman generate systemd --new --files bc219740a210455fa27deacc96d50a9e20516492f1417507c13ce1533dbdcd9d
-/home/user/containers/libpod/container-bc219740a210455fa27deacc96d50a9e20516492f1417507c13ce1533dbdcd9d.service
+/home/user/container-bc219740a210455fa27deacc96d50a9e20516492f1417507c13ce1533dbdcd9d.service
### Load the new systemd unit and start it
-$ mv ./container-bc219740a210455fa27deacc96d50a9e20516492f1417507c13ce1533dbdcd9d.service ~/.config/systemd/user
+$ mv ./container-bc219740a210455fa27deacc96d50a9e20516492f1417507c13ce1533dbdcd9d.service ~/.config/systemd/user/container-test.service
$ systemctl --user daemon-reload
### If the previously created containers or pods are using shared resources, such as ports, make sure to remove them before starting the generated systemd units.
$ podman stop bc219740a210455fa27deacc96d50a9e20516492f1417507c13ce1533dbdcd9d
$ podman rm bc219740a210455fa27deacc96d50a9e20516492f1417507c13ce1533dbdcd9d
-$ systemctl --user start container-bc219740a210455fa27deacc96d50a9e20516492f1417507c13ce1533dbdcd9d.service
+$ systemctl --user start container-test.service
-### Auto-update the container
+### Check if a newer image is available
+$ podman auto-update --dry-run --format "{{.Image}} {{.Updated}}"
+registry.fedoraproject.org/fedora:latest pending
+
+### Autoupdate the services
$ podman auto-update
-container-bc219740a210455fa27deacc96d50a9e20516492f1417507c13ce1533dbdcd9d.service
+UNIT CONTAINER IMAGE POLICY UPDATED
+container-test.service 08fd34e533fd (test) registry.fedoraproject.org/fedora:latest registry false
```
Autoupdate with local policy
@@ -80,7 +106,7 @@ be0889fd06f252a2e5141b37072c6bada68563026cb2b2649f53394d87ccc338
### Generate a systemd unit for this container
$ podman generate systemd --new --files be0889fd06f252a2e5141b37072c6bada68563026cb2b2649f53394d87ccc338
-/home/user/containers/libpod/container-be0889fd06f252a2e5141b37072c6bada68563026cb2b2649f53394d87ccc338.service
+/home/user/container-be0889fd06f252a2e5141b37072c6bada68563026cb2b2649f53394d87ccc338.service
### Load the new systemd unit and start it
$ mv ./container-be0889fd06f252a2e5141b37072c6bada68563026cb2b2649f53394d87ccc338.service ~/.config/systemd/user
@@ -102,7 +128,7 @@ $ podman commit --change CMD=/bin/bash inspiring_galileo busybox:latest
### Auto-update the container
$ podman auto-update
-container-be0889fd06f252a2e5141b37072c6bada68563026cb2b2649f53394d87ccc338.service
+[...]
```
## SEE ALSO
diff --git a/docs/source/markdown/podman-create.1.md b/docs/source/markdown/podman-create.1.md
index 2c51b312d..1720e6eb6 100644
--- a/docs/source/markdown/podman-create.1.md
+++ b/docs/source/markdown/podman-create.1.md
@@ -646,7 +646,7 @@ Valid _mode_ values are:
- **ns:**_path_: path to a network namespace to join;
- **private**: create a new namespace for the container (default)
- **slirp4netns[:OPTIONS,...]**: use **slirp4netns**(1) to create a user network stack. This is the default for rootless containers. It is possible to specify these additional options:
- - **allow_host_loopback=true|false**: Allow the slirp4netns to reach the host loopback IP (`10.0.2.2`). Default is false.
+ - **allow_host_loopback=true|false**: Allow the slirp4netns to reach the host loopback IP (`10.0.2.2`, which is added to `/etc/hosts` as `host.containers.internal` for your convenience). Default is false.
- **mtu=MTU**: Specify the MTU to use for this network. (Default is `65520`).
- **cidr=CIDR**: Specify ip range to use for this network. (Default is `10.0.2.0/24`).
- **enable_ipv6=true|false**: Enable IPv6. Default is false. (Required for `outbound_addr6`).
@@ -858,7 +858,7 @@ Secrets and its storage are managed using the `podman secret` command.
Secret Options
- `type=mount|env` : How the secret will be exposed to the container. Default mount.
-- `target=target` : Target of secret. Defauts to secret name.
+- `target=target` : Target of secret. Defaults to secret name.
- `uid=0` : UID of secret. Defaults to 0. Mount secret type only.
- `gid=0` : GID of secret. Defaults to 0. Mount secret type only.
- `mode=0` : Mode of secret. Defaults to 0444. Mount secret type only.
@@ -1086,14 +1086,28 @@ Set the user namespace mode for the container. It defaults to the **PODMAN_USERN
Valid _mode_ values are:
-- **auto[:**_OPTIONS,..._**]**: automatically create a namespace. It is possible to specify these options to `auto`:
- - **gidmapping=**_HOST_GID:CONTAINER_GID:SIZE_: to force a GID mapping to be present in the user namespace.
- - **size=**_SIZE_: to specify an explicit size for the automatic user namespace. e.g. `--userns=auto:size=8192`. If `size` is not specified, `auto` will estimate a size for the user namespace.
- - **uidmapping=**_HOST_UID:CONTAINER_UID:SIZE_: to force a UID mapping to be present in the user namespace.
-- **container:**_id_: join the user namespace of the specified container.
-- **host**: run in the user namespace of the caller. The processes running in the container will have the same privileges on the host as any other process launched by the calling user (default).
+**auto**[:_OPTIONS,..._]: automatically create a unique user namespace.
+
+The `--userns=auto` flag, requires that the user name `containers` and a range of subordinate user ids that the Podman container is allowed to use be specified in the /etc/subuid and /etc/subgid files.
+
+Example: `containers:2147483647:2147483648`.
+
+Podman allocates unique ranges of UIDs and GIDs from the `containers` subpordinate user ids. The size of the ranges is based on the number of UIDs required in the image. The number of UIDs and GIDs can be overridden with the `size` option. The `auto` options currently does not work in rootless mode
+
+ Valid `auto`options:
+
+ - *gidmapping*=_HOST_GID:CONTAINER_GID:SIZE_: to force a GID mapping to be present in the user namespace.
+ - *size*=_SIZE_: to specify an explicit size for the automatic user namespace. e.g. `--userns=auto:size=8192`. If `size` is not specified, `auto` will estimate a size for the user namespace.
+ - *uidmapping*=_HOST_UID:CONTAINER_UID:SIZE_: to force a UID mapping to be present in the user namespace.
+
+**container:**_id_: join the user namespace of the specified container.
+
+**host**: run in the user namespace of the caller. The processes running in the container will have the same privileges on the host as any other process launched by the calling user (default).
+
- **keep-id**: creates a user namespace where the current rootless user's UID:GID are mapped to the same values in the container. This option is ignored for containers created by the root user.
+
- **ns:**_namespace_: run the container in the given existing user namespace.
+
- **private**: create a new namespace for the container.
This option is incompatible with **--gidmap**, **--uidmap**, **--subuidname** and **--subgidname**.
@@ -1353,6 +1367,12 @@ the uids and gids from the host.
$ podman create --uidmap 0:30000:7000 --gidmap 0:30000:7000 fedora echo hello
```
+### Setting automatic user namespace separated containers
+
+```
+# podman create --userns=auto:size=65536 ubi8-init
+```
+
### Configure timezone in a container
```
diff --git a/docs/source/markdown/podman-pod-ps.1.md b/docs/source/markdown/podman-pod-ps.1.md
index c1f5fd5e3..156adccaa 100644
--- a/docs/source/markdown/podman-pod-ps.1.md
+++ b/docs/source/markdown/podman-pod-ps.1.md
@@ -12,7 +12,9 @@ By default it lists:
* pod id
* pod name
+ * the time the pod was created
* number of containers attached to pod
+ * container id of the pod infra container
* status of pod as defined by the following table
| **Status** | **Description** |
@@ -28,15 +30,15 @@ By default it lists:
#### **--ctr-names**
-Includes the container names in the container info field
+Display the container names
#### **--ctr-ids**
-Includes the container IDs in the container info field
+Display the container IDs
#### **--ctr-status**
-Includes the container statuses in the container info field
+Display the container statuses
#### **--latest**, **-l**
@@ -111,62 +113,55 @@ Print usage statement
```
$ podman pod ps
-POD ID NAME STATUS NUMBER OF CONTAINERS
-00dfd6fa02c0 jolly_goldstine Running 1
-f4df8692e116 nifty_torvalds Created 2
+POD ID NAME STATUS CREATED INFRA ID # OF CONTAINERS
+00dfd6fa02c0 jolly_goldstine Running 31 hours ago ba465ab0a3a4 1
+f4df8692e116 nifty_torvalds Created 10 minutes ago 331693bff40a 2
```
```
$ podman pod ps --ctr-names
-POD ID NAME STATUS CONTAINER INFO
-00dfd6fa02c0 jolly_goldstine Running [ loving_archimedes ]
-f4df8692e116 nifty_torvalds Created [ thirsty_hawking ] [ wizardly_golick ]
+POD ID NAME STATUS CREATED INFRA ID NAMES
+00dfd6fa02c0 jolly_goldstine Running 31 hours ago ba465ab0a3a4 loving_archimedes
+f4df8692e116 nifty_torvalds Created 10 minutes ago 331693bff40a thirsty_hawking,wizardly_golick
```
```
$ podman pod ps --ctr-status --ctr-names --ctr-ids
-POD ID NAME STATUS CONTAINER INFO
-00dfd6fa02c0 jolly_goldstine Running [ ba465ab0a3a4 loving_archimedes Running ]
-f4df8692e116 nifty_torvalds Created [ 331693bff40a thirsty_hawking Created ] [ 8e428daeb89e wizardly_golick Created ]
+POD ID NAME STATUS CREATED INFRA ID IDS NAMES STATUS
+00dfd6fa02c0 jolly_goldstine Running 31 hours ago ba465ab0a3a4 ba465ab0a3a4 loving_archimedes running
+f4df8692e116 nifty_torvalds Created 10 minutes ago 331693bff40a 331693bff40a,8e428daeb89e thirsty_hawking,wizardly_golick configured,configured
```
```
-$ podman pod ps --format "{{.ID}} {{.ContainerInfo}} {{.Cgroup}}" --ctr-names
-00dfd6fa02c0 [ loving_archimedes ] /libpod_parent
-f4df8692e116 [ thirsty_hawking ] [ wizardly_golick ] /libpod_parent
-```
-
-```
-$ podman pod ps --cgroup
-POD ID NAME STATUS NUMBER OF CONTAINERS CGROUP USE POD CGROUP
-00dfd6fa02c0 jolly_goldstine Running 1 /libpod_parent true
-f4df8692e116 nifty_torvalds Created 2 /libpod_parent true
+$ podman pod ps --format "{{.ID}} {{.ContainerNames}} {{.Cgroup}}"
+00dfd6fa02c0 loving_archimedes /libpod_parent
+f4df8692e116 thirsty_hawking,wizardly_golick /libpod_parent
```
```
$ podman pod ps --sort id --filter ctr-number=2
-POD ID NAME STATUS NUMBER OF CONTAINERS
-f4df8692e116 nifty_torvalds Created 2
+POD ID NAME STATUS CREATED INFRA ID # OF CONTAINERS
+f4df8692e116 nifty_torvalds Created 10 minutes ago 331693bff40a 2
```
```
$ podman pod ps --ctr-ids
-POD ID NAME STATUS CONTAINER INFO
-00dfd6fa02c0 jolly_goldstine Running [ ba465ab0a3a4 ]
-f4df8692e116 nifty_torvalds Created [ 331693bff40a ] [ 8e428daeb89e ]
+POD ID NAME STATUS CREATED INFRA ID IDS
+00dfd6fa02c0 jolly_goldstine Running 31 hours ago ba465ab0a3a4 ba465ab0a3a4
+f4df8692e116 nifty_torvalds Created 10 minutes ago 331693bff40a 331693bff40a,8e428daeb89e
```
```
$ podman pod ps --no-trunc --ctr-ids
-POD ID NAME STATUS CONTAINER INFO
-00dfd6fa02c0a2daaedfdf8fcecd06f22ad114d46d167d71777224735f701866 jolly_goldstine Running [ ba465ab0a3a4e15e3539a1e79c32d1213a02b0989371e274f98e0f1ae9de7050 ]
-f4df8692e116a3e6d1d62572644ed36ca475d933808cc3c93435c45aa139314b nifty_torvalds Created [ 331693bff40a0ef2f05a3aba73ce49e3243108911927fff04d1f7fc44dda8022 ] [ 8e428daeb89e69b71e7916a13accfb87d122889442b5c05c2d99cf94a3230e9d ]
+POD ID NAME STATUS CREATED INFRA ID IDS
+00dfd6fa02c0a2daaedfdf8fcecd06f22ad114d46d167d71777224735f701866 jolly_goldstine Running 31 hours ago ba465ab0a3a4e15e3539a1e79c32d1213a02b0989371e274f98e0f1ae9de7050 ba465ab0a3a4e15e3539a1e79c32d1213a02b0989371e274f98e0f1ae9de7050
+f4df8692e116a3e6d1d62572644ed36ca475d933808cc3c93435c45aa139314b nifty_torvalds Created 10 minutes ago 331693bff40a926b6d52b184e116afd15497610c378d5d4c42945dd6e33b75b0 331693bff40a926b6d52b184e116afd15497610c378d5d4c42945dd6e33b75b0,8e428daeb89e69b71e7916a13accfb87d122889442b5c05c2d99cf94a3230e9d
```
```
$ podman pod ps --ctr-names
-POD ID NAME STATUS CONTAINER INFO
-314f4da82d74 hi Created [ jovial_jackson ] [ hopeful_archimedes ] [ vibrant_ptolemy ] [ heuristic_jennings ] [ keen_raman ] [ hopeful_newton ] [ mystifying_bose ] [ silly_lalande ] [ serene_lichterman ] ...
+POD ID NAME STATUS CREATED INFRA ID NAMES
+314f4da82d74 hi Created 17 hours ago a9f2d2165675 jovial_jackson,hopeful_archimedes,vibrant_ptolemy,heuristic_jennings,keen_raman,hopeful_newton,mystifying_bose,silly_lalande,serene_lichterman ...
```
## pod ps
diff --git a/docs/source/markdown/podman-pull.1.md b/docs/source/markdown/podman-pull.1.md
index 10661e16e..189464d17 100644
--- a/docs/source/markdown/podman-pull.1.md
+++ b/docs/source/markdown/podman-pull.1.md
@@ -182,7 +182,7 @@ Storing signatures
d6e46aa2470df1d32034c6707c8041158b652f38d2a9ae3d7ad7e7532d22ebe0
```
-Pull an image by specifiying an authentication file.
+Pull an image by specifying an authentication file.
```
$ podman pull --authfile temp-auths/myauths.json docker://docker.io/umohnani/finaltest
Trying to pull docker.io/umohnani/finaltest:latest...Getting image source signatures
diff --git a/docs/source/markdown/podman-run.1.md b/docs/source/markdown/podman-run.1.md
index 6027a14a5..ce0cf1a2f 100644
--- a/docs/source/markdown/podman-run.1.md
+++ b/docs/source/markdown/podman-run.1.md
@@ -680,7 +680,7 @@ Valid _mode_ values are:
- **ns:**_path_: path to a network namespace to join;
- **private**: create a new namespace for the container (default)
- **slirp4netns[:OPTIONS,...]**: use **slirp4netns**(1) to create a user network stack. This is the default for rootless containers. It is possible to specify these additional options:
- - **allow_host_loopback=true|false**: Allow the slirp4netns to reach the host loopback IP (`10.0.2.2`). Default is false.
+ - **allow_host_loopback=true|false**: Allow the slirp4netns to reach the host loopback IP (`10.0.2.2`, which is added to `/etc/hosts` as `host.containers.internal` for your convenience). Default is false.
- **mtu=MTU**: Specify the MTU to use for this network. (Default is `65520`).
- **cidr=CIDR**: Specify ip range to use for this network. (Default is `10.0.2.0/24`).
- **enable_ipv6=true|false**: Enable IPv6. Default is false. (Required for `outbound_addr6`).
@@ -908,7 +908,7 @@ Secrets and its storage are managed using the `podman secret` command.
Secret Options
- `type=mount|env` : How the secret will be exposed to the container. Default mount.
-- `target=target` : Target of secret. Defauts to secret name.
+- `target=target` : Target of secret. Defaults to secret name.
- `uid=0` : UID of secret. Defaults to 0. Mount secret type only.
- `gid=0` : GID of secret. Defaults to 0. Mount secret type only.
- `mode=0` : Mode of secret. Defaults to 0444. Mount secret type only.
@@ -1159,14 +1159,28 @@ Set the user namespace mode for the container. It defaults to the **PODMAN_USERN
Valid _mode_ values are:
-- **auto[:**_OPTIONS,..._**]**: automatically create a namespace. It is possible to specify these options to `auto`:
- - **gidmapping=**_HOST_GID:CONTAINER_GID:SIZE_: to force a GID mapping to be present in the user namespace.
- - **size=**_SIZE_: to specify an explicit size for the automatic user namespace. e.g. `--userns=auto:size=8192`. If `size` is not specified, `auto` will estimate a size for the user namespace.
- - **uidmapping=**_HOST_UID:CONTAINER_UID:SIZE_: to force a UID mapping to be present in the user namespace.
-- **container:**_id_: join the user namespace of the specified container.
-- **host**: run in the user namespace of the caller. The processes running in the container will have the same privileges on the host as any other process launched by the calling user (default).
+**auto**[:_OPTIONS,..._]: automatically create a unique user namespace.
+
+The `--userns=auto` flag, requires that the user name `containers` and a range of subordinate user ids that the Podman container is allowed to use be specified in the /etc/subuid and /etc/subgid files.
+
+Example: `containers:2147483647:2147483648`.
+
+Podman allocates unique ranges of UIDs and GIDs from the `containers` subpordinate user ids. The size of the ranges is based on the number of UIDs required in the image. The number of UIDs and GIDs can be overridden with the `size` option. The `auto` options currently does not work in rootless mode
+
+ Valid `auto`options:
+
+ - *gidmapping*=_HOST_GID:CONTAINER_GID:SIZE_: to force a GID mapping to be present in the user namespace.
+ - *size*=_SIZE_: to specify an explicit size for the automatic user namespace. e.g. `--userns=auto:size=8192`. If `size` is not specified, `auto` will estimate a size for the user namespace.
+ - *uidmapping*=_HOST_UID:CONTAINER_UID:SIZE_: to force a UID mapping to be present in the user namespace.
+
+**container:**_id_: join the user namespace of the specified container.
+
+**host**: run in the user namespace of the caller. The processes running in the container will have the same privileges on the host as any other process launched by the calling user (default).
+
- **keep-id**: creates a user namespace where the current rootless user's UID:GID are mapped to the same values in the container. This option is ignored for containers created by the root user.
+
- **ns:**_namespace_: run the container in the given existing user namespace.
+
- **private**: create a new namespace for the container.
This option is incompatible with **--gidmap**, **--uidmap**, **--subuidname** and **--subgidname**.
@@ -1676,6 +1690,15 @@ $ echo "asdf" | podman run --rm -i --entrypoint /bin/cat someimage
asdf
```
+### Setting automatic user namespace separated containers
+
+```
+# podman run --userns=auto:size=65536 ubi8-micro cat /proc/self/uid_map
+0 2147483647 65536
+# podman run --userns=auto:size=65536 ubi8-micro cat /proc/self/uid_map
+0 2147549183 65536
+```
+
### Setting Namespaced Kernel Parameters (Sysctls)
The **--sysctl** sets namespaced kernel parameters (sysctls) in the
diff --git a/docs/tutorials/README.md b/docs/tutorials/README.md
index 455459062..2a3c85c55 100644
--- a/docs/tutorials/README.md
+++ b/docs/tutorials/README.md
@@ -28,10 +28,6 @@ How the libpod API can be used within your own project.
Learn how to setup and use image signing with Podman.
-**[Go Bindings](podman-go-bindings.md)**
-
-A brief how-to on using Podman's Go bindings in external applications.
-
-**[Go Bindings](basic_networking.md)**
+**[Basic Networking](basic_networking.md)**
A basic guide to common network setups with Podman
diff --git a/docs/tutorials/basic_networking.md b/docs/tutorials/basic_networking.md
index 850bf6681..e47661ddf 100644
--- a/docs/tutorials/basic_networking.md
+++ b/docs/tutorials/basic_networking.md
@@ -237,7 +237,7 @@ port like 8080.
$ podman run -dt --name webserver -p 8080:80 quay.io/libpod/banner
17ea33ccd7f55ff45766b3ec596b990a5f2ba66eb9159cb89748a85dc3cebfe0
```
-Because rootfull containers cannot communicate with each other directly with TCP/IP
+Because rootless containers cannot communicate with each other directly with TCP/IP
via IP addresses, the host and the port mapping are used. To do so, the IP address
of the host (interface) must be known.
```
diff --git a/docs/tutorials/podman-go-bindings.md b/docs/tutorials/podman-go-bindings.md
deleted file mode 100644
index 2bbf4e5de..000000000
--- a/docs/tutorials/podman-go-bindings.md
+++ /dev/null
@@ -1,543 +0,0 @@
-![PODMAN logo](../../logo/podman-logo-source.svg)
-
-# Podman Go bindings
-
-## Introduction
-
-In the release of Podman 2.0, we removed the experimental tag
-from its recently introduced RESTful service. While it might
-be interesting to interact with a RESTFul server using curl,
-using a set of Go based bindings is probably a more direct
-route to a production ready application. Let’s take a look
-at how easily that can be accomplished.
-
-If you haven't yet, [install Go](https://golang.org/doc/install).
-
-Be careful to double-check that the version of golang is new
-enough (i.e. `go version`), version 1.13.x or higher is
-supported. If needed, Go sources and binaries can be fetched
-from the [official Go website](https://golang.org/dl/).
-
-The Podman Go bindings are a set of functions to allow
-developers to execute Podman operations from within their Go
-based application. The Go bindings connect to a Podman service
-which can run locally or on a remote machine. You can perform
-many operations including pulling and listing images, starting,
-stopping or inspecting containers. Currently, the Podman
-repository has bindings available for operations on images,
-containers, pods, networks and manifests among others. The
-bindings are available on the [v2.0 branch in the
-upstream Podman repository](https://github.com/containers/podman/tree/v2.0).
-You can fetch the bindings for your application using Go modules:
-
-```bash
-$ cd $HOME
-$ mkdir example && cd example
-$ go mod init example.com
-go: creating new go.mod: module example.com
-$ go get github.com/containers/podman/v3
-[...]
-```
-
-This creates a new `go.mod` file in the current directory that looks as follows:
-
-```bash
-module example.com
-
-go 1.16
-
-require github.com/containers/libpod/v3 v3.0.1 // indirect
-```
-
-You can also try a demo application with the Go modules created already:
-
-```bash
-$ git clone https://github.com/containers/Demos
-$ cd Demos/podman_go_bindings
-$ ls
-README.md go.mod go.sum main.go
-```
-
-
-## How do I use them
-
-In this tutorial, you will learn through basic examples how to:
-
-0. [Start the Podman system service](#start-service)
-1. [Connect to the Podman system service](#connect-service)
-2. [Pull images](#pull-images)
-3. [List images](#list-images)
-4. [Create and start a container from an image](#create-start-container)
-5. [List containers](#list-containers)
-6. [Inspect the container](#inspect-container)
-7. [Stop the container](#stop-container)
-8. [Debugging tips](#debugging-tips)
-
-
-### Start the Podman system service <a name="start-service"></a>
-The recommended way to start Podman system service in production mode
-is via systemd socket-activation:
-
-```bash
-$ systemctl --user start podman.socket
-```
-
-There’s no timeout specified when starting the system service via socket-activation.
-
-For purposes of this demo, we will start the service using the Podman
-command itself. If you prefer the system service to timeout after, say,
-5000 seconds, you can run it like so:
-
-```bash
-$ podman system service -t 5000
-```
-
-Note that the 5000 seconds uptime is refreshed after every command is received.
-If you want the service to stay up until the machine is shutdown or the process
-is terminated, use `0` (zero) instead of 5000. For this demo, we will use no timeout:
-
-```bash
-$ podman system service -t 0
-```
-
-
-Open another terminal window and check if the Podman socket exists:
-
-```bash
-$ ls /run/user/${UID}/podman
-podman.sock
-```
-
-If you’re running the system service as root, podman.sock will be found in /run/podman:
-```bash
-# ls /run/podman
-podman.sock
-```
-
-
-### Connect to the Podman system service <a name="connect-service"></a>
-First, you need to create a connection that connects to the system service.
-The critical piece of information for setting up a new connection is the endpoint.
-The endpoint comes in the form of an URI (method:/path/to/socket). For example,
-to connect to the local rootful socket the URI would be `unix:/run/podman/podman.sock`
-and for a rootless user it would be `unix:$(XDG_RUNTIME_DIR)/podman/podman.sock`,
-typically: `unix:/run/user/${UID}/podman/podman.sock`.
-
-
-The following Go example snippet shows how to set up a connection for a rootless user.
-```Go
-package main
-
-import (
- "context"
- "fmt"
- "os"
-
- "github.com/containers/libpod/v3/libpod/define"
- "github.com/containers/libpod/v3/pkg/bindings"
- "github.com/containers/libpod/v3/pkg/bindings/containers"
- "github.com/containers/libpod/v3/pkg/bindings/images"
- "github.com/containers/libpod/v3/pkg/domain/entities"
- "github.com/containers/libpod/v3/pkg/specgen"
-)
-
-func main() {
- fmt.Println("Welcome to the Podman Go bindings tutorial")
-
- // Get Podman socket location
- sock_dir := os.Getenv("XDG_RUNTIME_DIR")
- socket := "unix:" + sock_dir + "/podman/podman.sock"
-
- // Connect to Podman socket
- connText, err := bindings.NewConnection(context.Background(), socket)
- if err != nil {
- fmt.Println(err)
- os.Exit(1)
- }
-}
-```
-
-The `connText` variable received from the NewConnection function is of type
-context.Context(). In subsequent uses of the bindings, you will use this context
-to direct the bindings to your connection. This can be seen in the examples below.
-
-### Pull an image <a name="pull-images"></a>
-
-Next, we will pull a couple of images using the images.Pull() binding.
-This binding takes three arguments:
- - The context variable created by the bindings.NewConnection() call in the first example
- - The image name
- - Options for image pull
-
-**Append the following lines to your function:**
-
-```Go
- // Pull Busybox image (Sample 1)
- fmt.Println("Pulling Busybox image...")
- _, err = images.Pull(connText, "docker.io/busybox", &images.PullOptions{})
- if err != nil {
- fmt.Println(err)
- os.Exit(1)
- }
-
- // Pull Fedora image (Sample 2)
- rawImage := "registry.fedoraproject.org/fedora:latest"
- fmt.Println("Pulling Fedora image...")
- _, err = images.Pull(connText, rawImage, &images.PullOptions{})
- if err != nil {
- fmt.Println(err)
- os.Exit(1)
- }
-```
-
-**Run it:**
-
-```bash
-$ go run main.go
-Welcome to the Podman Go bindings tutorial
-Pulling Busybox image...
-Pulling Fedora image...
-$
-```
-
-The system service side should echo messages like so:
-
-```bash
-Trying to pull docker.io/busybox...
-Getting image source signatures
-Copying blob 61c5ed1cbdf8 [--------------------------------------] 0.0b / 0.0b
-Copying config 018c9d7b79 done
-Writing manifest to image destination
-Storing signatures
-Trying to pull registry.fedoraproject.org/fedora:latest...
-Getting image source signatures
-Copying blob dd9f43919ba0 [--------------------------------------] 0.0b / 0.0b
-Copying config 00ff39a8bf done
-Writing manifest to image destination
-Storing signatures
-```
-
-
-### List images <a name="list-images"></a>
-Next, we will pull an image using the images.List() binding.
-This binding takes three arguments:
- - The context variable created earlier
- - An optional bool 'all'
- - An optional map of filters
-
-**Append the following lines to your function:**
-
-```Go
- // List images
- imageSummary, err := images.List(connText, &images.ListOptions{})
- if err != nil {
- fmt.Println(err)
- os.Exit(1)
- }
- var names []string
- for _, i := range imageSummary {
- names = append(names, i.RepoTags...)
- }
- fmt.Println("Listing images...")
- fmt.Println(names)
-```
-
-**Run it:**
-
-```bash
-$ go run main.go
-Welcome to the Podman Go bindings tutorial
-Pulling Busybox image...
-Pulling Fedora image...
-Listing images...
-[docker.io/library/busybox:latest registry.fedoraproject.org/fedora:latest]
-$
-```
-
-
-### Create and Start a Container from an Image <a name="create-start-container"></a>
-
-To create the container spec, we use specgen.NewSpecGenerator() followed by
-calling containers.CreateWithSpec() to actually create a new container.
-specgen.NewSpecGenerator() takes 2 arguments:
- - name of the image
- - whether it's a rootfs
-
-containers.CreateWithSpec() takes 2 arguments:
- - the context created earlier
- - the spec created by NewSpecGenerator
-
-Next, the container is actually started using the containers.Start() binding.
-containers.Start() takes three arguments:
- - the context
- - the name or ID of the container created
- - an optional parameter for detach keys
-
-After the container is started, it's a good idea to ensure the container is
-in a running state before you proceed with further operations.
-The containers.Wait() takes care of that.
-containers.Wait() takes three arguments:
- - the context
- - the name or ID of the container created
- - container state (running/paused/stopped)
-
-**Append the following lines to your function:**
-
-```Go
- // Container create
- s := specgen.NewSpecGenerator(rawImage, false)
- s.Terminal = true
- r, err := containers.CreateWithSpec(connText, s, nil)
- if err != nil {
- fmt.Println(err)
- os.Exit(1)
- }
-
- // Container start
- fmt.Println("Starting Fedora container...")
- err = containers.Start(connText, r.ID, nil)
- if err != nil {
- fmt.Println(err)
- os.Exit(1)
- }
-
- running := define.ContainerStateRunning
- _, err = containers.Wait(connText, r.ID, &containers.WaitOptions{Condition: []define.ContainerStatus{running}})
- if err != nil {
- fmt.Println(err)
- os.Exit(1)
- }
-```
-
-**Run it:**
-
-```bash
-$ go run main.go
-Welcome to the Podman Go bindings tutorial
-Pulling image...
-Starting Fedora container...
-$
-```
-
-Check if the container is running:
-
-```bash
-$ podman ps
-CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
-665831d31e90 registry.fedoraproject.org/fedora:latest /bin/bash Less than a second ago Up Less than a second ago dazzling_mclean
-$
-```
-
-
-### List Containers <a name="list-containers"></a>
-
-Containers can be listed using the containers.List() binding.
-containers.List() takes seven arguments:
- - the context
- - output filters
- - boolean to show all containers, by default only running containers are listed
- - number of latest created containers, all states (running/paused/stopped)
- - boolean to print pod information
- - boolean to print rootfs size
- - boolean to print oci runtime and container state
-
-**Append the following lines to your function:**
-
-```Go
- // Container list
- var latestContainers = 1
- containerLatestList, err := containers.List(connText, &containers.ListOptions{Last: &latestContainers})
- if err != nil {
- fmt.Println(err)
- os.Exit(1)
- }
- fmt.Printf("Latest container is %s\n", containerLatestList[0].Names[0])
-```
-
-**Run it:**
-
-```bash
-$ go run main.go
-Welcome to the Podman Go bindings tutorial
-Pulling Busybox image...
-Pulling Fedora image...
-Listing images...
-[docker.io/library/busybox:latest registry.fedoraproject.org/fedora:latest]
-Starting Fedora container...
-Latest container is dazzling_mclean
-$
-```
-
-
-### Inspect Container <a name="inspect-container"></a>
-Containers can be inspected using the containers.Inspect() binding.
-containers.Inspect() takes 3 arguments:
- - context
- - image name or ID
- - optional boolean to check for container size
-
-
-**Append the following lines to your function:**
-
-```Go
- // Container inspect
- ctrData, err := containers.Inspect(connText, r.ID, nil)
- if err != nil {
- fmt.Println(err)
- os.Exit(1)
- }
- fmt.Printf("Container uses image %s\n", ctrData.ImageName)
- fmt.Printf("Container running status is %s\n", ctrData.State.Status)
-```
-
-**Run it:**
-
-```bash
-$ go run main.go
-Welcome to the Podman Go bindings tutorial
-Pulling Busybox image...
-Pulling Fedora image...
-Listing images...
-[docker.io/library/busybox:latest registry.fedoraproject.org/fedora:latest]
-Starting Fedora container...
-Latest container is peaceful_noether
-Fedora Container uses image registry.fedoraproject.org/fedora:latest
-Fedora Container running status is running
-$
-```
-
-
-### Stop Container <a name="stop-container"></a>
-
-A container can be stopped by the containers.Stop() binding.
-containers.Stop() takes 3 arguments:
- - context
- - image name or ID
- - optional timeout
-
-**Append the following lines to your function:**
-
-```Go
- // Container stop
- fmt.Println("Stopping the container...")
- err = containers.Stop(connText, r.ID, nil)
- if err != nil {
- fmt.Println(err)
- os.Exit(1)
- }
- ctrData, err = containers.Inspect(connText, r.ID, nil)
- if err != nil {
- fmt.Println(err)
- os.Exit(1)
- }
- fmt.Printf("Container running status is now %s\n", ctrData.State.Status)
-```
-
-**Run it:**
-
-```bash
-$ go run main.go
-Welcome to the Podman Go bindings tutorial
-Pulling Busybox image...
-Pulling Fedora image...
-Listing images...
-[docker.io/library/busybox:latest registry.fedoraproject.org/fedora:latest]
-Starting Fedora container...
-Latest container is peaceful_noether
-Fedora Container uses image registry.fedoraproject.org/fedora:latest
-Fedora Container running status is running
-Stopping Fedora container...
-Container running status is now exited
-```
-
-
-### Debugging tips <a name="debugging-tips"></a>
-
-To debug in a development setup, you can start the Podman system service
-in debug mode like so:
-
-```bash
-$ podman --log-level=debug system service -t 0
-```
-
-The `--log-level=debug` echoes all the logged requests and is useful to
-trace the execution path at a finer granularity. A snippet of a sample run looks like:
-
-```bash
-INFO[0000] podman filtering at log level debug
-DEBU[0000] Called service.PersistentPreRunE(podman --log-level=debug system service -t0)
-DEBU[0000] Ignoring libpod.conf EventsLogger setting "/home/lsm5/.config/containers/containers.conf". Use "journald" if you want to change this setting and remove libpod.conf files.
-DEBU[0000] Reading configuration file "/usr/share/containers/containers.conf"
-DEBU[0000] Merged system config "/usr/share/containers/containers.conf": {Editors note: the remainder of this line was removed due to Jekyll formatting errors.}
-DEBU[0000] Using conmon: "/usr/bin/conmon"
-DEBU[0000] Initializing boltdb state at /home/lsm5/.local/share/containers/storage/libpod/bolt_state.db
-DEBU[0000] Overriding run root "/run/user/1000/containers" with "/run/user/1000" from database
-DEBU[0000] Using graph driver overlay
-DEBU[0000] Using graph root /home/lsm5/.local/share/containers/storage
-DEBU[0000] Using run root /run/user/1000
-DEBU[0000] Using static dir /home/lsm5/.local/share/containers/storage/libpod
-DEBU[0000] Using tmp dir /run/user/1000/libpod/tmp
-DEBU[0000] Using volume path /home/lsm5/.local/share/containers/storage/volumes
-DEBU[0000] Set libpod namespace to ""
-DEBU[0000] Not configuring container store
-DEBU[0000] Initializing event backend file
-DEBU[0000] using runtime "/usr/bin/runc"
-DEBU[0000] using runtime "/usr/bin/crun"
-WARN[0000] Error initializing configured OCI runtime kata: no valid executable found for OCI runtime kata: invalid argument
-DEBU[0000] using runtime "/usr/bin/crun"
-INFO[0000] Setting parallel job count to 25
-INFO[0000] podman filtering at log level debug
-DEBU[0000] Called service.PersistentPreRunE(podman --log-level=debug system service -t0)
-DEBU[0000] Ignoring libpod.conf EventsLogger setting "/home/lsm5/.config/containers/containers.conf". Use "journald" if you want to change this setting and remove libpod.conf files.
-DEBU[0000] Reading configuration file "/usr/share/containers/containers.conf"
-```
-
-If the Podman system service has been started via systemd socket activation,
-you can view the logs using journalctl. The logs after a sample run look like so:
-
-```bash
-$ journalctl --user --no-pager -u podman.socket
--- Reboot --
-Jul 22 13:50:40 nagato.nanadai.me systemd[1048]: Listening on Podman API Socket.
-$
-```
-
-```bash
-$ journalctl --user --no-pager -u podman.service
-Jul 22 13:50:53 nagato.nanadai.me systemd[1048]: Starting Podman API Service...
-Jul 22 13:50:54 nagato.nanadai.me podman[1527]: time="2020-07-22T13:50:54-04:00" level=error msg="Error refreshing volume 38480630a8bdaa3e1a0ebd34c94038591b0d7ad994b37be5b4f2072bb6ef0879: error acquiring lock 0 for volume 38480630a8bdaa3e1a0ebd34c94038591b0d7ad994b37be5b4f2072bb6ef0879: file exists"
-Jul 22 13:50:54 nagato.nanadai.me podman[1527]: time="2020-07-22T13:50:54-04:00" level=error msg="Error refreshing volume 47d410af4d762a0cc456a89e58f759937146fa3be32b5e95a698a1d4069f4024: error acquiring lock 0 for volume 47d410af4d762a0cc456a89e58f759937146fa3be32b5e95a698a1d4069f4024: file exists"
-Jul 22 13:50:54 nagato.nanadai.me podman[1527]: time="2020-07-22T13:50:54-04:00" level=error msg="Error refreshing volume 86e73f082e344dad38c8792fb86b2017c4f133f2a8db87f239d1d28a78cf0868: error acquiring lock 0 for volume 86e73f082e344dad38c8792fb86b2017c4f133f2a8db87f239d1d28a78cf0868: file exists"
-Jul 22 13:50:54 nagato.nanadai.me podman[1527]: time="2020-07-22T13:50:54-04:00" level=error msg="Error refreshing volume 9a16ea764be490a5563e384d9074ab0495e4d9119be380c664037d6cf1215631: error acquiring lock 0 for volume 9a16ea764be490a5563e384d9074ab0495e4d9119be380c664037d6cf1215631: file exists"
-Jul 22 13:50:54 nagato.nanadai.me podman[1527]: time="2020-07-22T13:50:54-04:00" level=error msg="Error refreshing volume bfd6b2a97217f8655add13e0ad3f6b8e1c79bc1519b7a1e15361a107ccf57fc0: error acquiring lock 0 for volume bfd6b2a97217f8655add13e0ad3f6b8e1c79bc1519b7a1e15361a107ccf57fc0: file exists"
-Jul 22 13:50:54 nagato.nanadai.me podman[1527]: time="2020-07-22T13:50:54-04:00" level=error msg="Error refreshing volume f9b9f630982452ebcbed24bd229b142fbeecd5d4c85791fca440b21d56fef563: error acquiring lock 0 for volume f9b9f630982452ebcbed24bd229b142fbeecd5d4c85791fca440b21d56fef563: file exists"
-Jul 22 13:50:54 nagato.nanadai.me podman[1527]: Trying to pull registry.fedoraproject.org/fedora:latest...
-Jul 22 13:50:55 nagato.nanadai.me podman[1527]: Getting image source signatures
-Jul 22 13:50:55 nagato.nanadai.me podman[1527]: Copying blob sha256:dd9f43919ba05f05d4f783c31e83e5e776c4f5d29dd72b9ec5056b9576c10053
-Jul 22 13:50:55 nagato.nanadai.me podman[1527]: Copying config sha256:00ff39a8bf19f810a7e641f7eb3ddc47635913a19c4996debd91fafb6b379069
-Jul 22 13:50:55 nagato.nanadai.me podman[1527]: Writing manifest to image destination
-Jul 22 13:50:55 nagato.nanadai.me podman[1527]: Storing signatures
-Jul 22 13:50:55 nagato.nanadai.me systemd[1048]: podman.service: unit configures an IP firewall, but not running as root.
-Jul 22 13:50:55 nagato.nanadai.me systemd[1048]: (This warning is only shown for the first unit using IP firewalling.)
-Jul 22 13:51:15 nagato.nanadai.me systemd[1048]: podman.service: Succeeded.
-Jul 22 13:51:15 nagato.nanadai.me systemd[1048]: Finished Podman API Service.
-Jul 22 13:51:15 nagato.nanadai.me systemd[1048]: podman.service: Consumed 1.339s CPU time.
-$
-```
-
-
-## Wrap Up
-Podman provides a set of Go bindings to allow developers to integrate Podman
-functionality conveniently in their Go application. These Go bindings require
-the Podman system service to be running in the background and this can easily
-be achieved using systemd socket activation. Once set up, you are able to use a
-set of Go based bindings to create, maintain and monitor your container images,
-containers and pods in a way which fits very nicely in many production environments.
-
-
-## References
-- Podman is available for most major distributions along with macOS and Windows.
-Installation details are available on the [Podman official website](https://podman.io/getting-started/).
-
-- Documentation can be found at the [Podman Docs page](https://docs.podman.io).
-It also includes a section on the [RESTful API](https://docs.podman.io/en/latest/Reference.html).
diff --git a/docs/tutorials/rootless_tutorial.md b/docs/tutorials/rootless_tutorial.md
index 18f60ea00..5d20f2cc0 100644
--- a/docs/tutorials/rootless_tutorial.md
+++ b/docs/tutorials/rootless_tutorial.md
@@ -13,31 +13,31 @@ The alternative OCI runtime support for cgroup V2 can also be turned on at the c
```
podman --runtime crun
```
-or for all commands by changing the value for the "Default OCI runtime" in the containers.conf file either at the system level or at the [user level](#user-configuration-files) from `runtime = "runc"` to `runtime = "crun"`.
+or for all commands by changing the value for the "Default OCI runtime" in the `containers.conf` file either at the system level or at the [user level](#user-configuration-files) from `runtime = "runc"` to `runtime = "crun"`.
## Administrator Actions
### Installing Podman
-For installing Podman, please see the [installation instructions](https://github.com/containers/podman/blob/master/install.md).
+For installing Podman, please see the [installation instructions](https://github.com/containers/podman/blob/main/install.md).
### Building Podman
-For building Podman, please see the [installation instructions](https://github.com/containers/podman/blob/master/install.md#building-from-scratch).
+For building Podman, please see the [installation instructions](https://github.com/containers/podman/blob/main/install.md#building-from-scratch).
-### Install slirp4netns
+### Install `slirp4netns`
-The [slirp4netns](https://github.com/rootless-containers/slirp4netns) package provides user-mode networking for unprivileged network namespaces and must be installed on the machine in order for Podman to run in a rootless environment. The package is available on most Linux distributions via their package distribution software such as yum, dnf, apt, zypper, etc. If the package is not available, you can build and install slirp4netns from [GitHub](https://github.com/rootless-containers/slirp4netns).
+The [slirp4netns](https://github.com/rootless-containers/slirp4netns) package provides user-mode networking for unprivileged network namespaces and must be installed on the machine in order for Podman to run in a rootless environment. The package is available on most Linux distributions via their package distribution software such as `yum`, `dnf`, `apt`, `zypper`, etc. If the package is not available, you can build and install `slirp4netns` from [GitHub](https://github.com/rootless-containers/slirp4netns).
-### Ensure fuse-overlayfs is installed
+### Ensure `fuse-overlayfs` is installed
-When using Podman in a rootless environment, it is recommended to use fuse-overlayfs rather than the VFS file system. For that you need the `fuse-overlayfs` executable available in `$PATH`.
+When using Podman in a rootless environment, it is recommended to use `fuse-overlayfs` rather than the VFS file system. For that you need the `fuse-overlayfs` executable available in `$PATH`.
Your distribution might already provide it in the `fuse-overlayfs` package, but be aware that you need at least version **0.7.6**. This especially needs to be checked on Ubuntu distributions as `fuse-overlayfs` is not generally installed by default and the 0.7.6 version is not available natively on Ubuntu releases prior to **20.04**.
-The fuse-overlayfs project is available from [GitHub](https://github.com/containers/fuse-overlayfs), and provides instructions for easily building a static `fuse-overlayfs` executable.
+The `fuse-overlayfs` project is available from [GitHub](https://github.com/containers/fuse-overlayfs), and provides instructions for easily building a static `fuse-overlayfs` executable.
-If Podman is used before fuse-overlayfs is installed, it may be necessary to adjust the `storage.conf` file (see "User Configuration Files" below) to change the `driver` option under `[storage]` to `"overlay"` and point the `mount_program` option in `[storage.options]` to the path of the `fuse-overlayfs` executable:
+If Podman is used before `fuse-overlayfs` is installed, it may be necessary to adjust the `storage.conf` file (see "User Configuration Files" below) to change the `driver` option under `[storage]` to `"overlay"` and point the `mount_program` option in `[storage.options]` to the path of the `fuse-overlayfs` executable:
```
[storage]
@@ -54,13 +54,13 @@ If Podman is used before fuse-overlayfs is installed, it may be necessary to adj
### Enable user namespaces (on RHEL7 machines)
-The number of user namespaces that are allowed on the system is specified in the file `/proc/sys/user/max_user_namespaces`. On most Linux platforms this is preset by default and no adjustment is necessary. However on RHEL7 machines a user with root privileges may need to set that to a reasonable value by using this command: `sysctl user.max_user_namespaces=15000`.
+The number of user namespaces that are allowed on the system is specified in the file `/proc/sys/user/max_user_namespaces`. On most Linux platforms this is preset by default and no adjustment is necessary. However, on RHEL7 machines, a user with root privileges may need to set that to a reasonable value by using this command: `sysctl user.max_user_namespaces=15000`.
-### /etc/subuid and /etc/subgid configuration
+### `/etc/subuid` and `/etc/subgid` configuration
-Rootless Podman requires the user running it to have a range of UIDs listed in /etc/subuid and /etc/subgid files. The `shadow-utils` or `newuid` package provides these files on different distributions and they must be installed on the system. These files will need someone with root privileges on the system to add or update the entries within them. The following is a summarization from the [How does rootless Podman work?](https://opensource.com/article/19/2/how-does-rootless-podman-work) article by Dan Walsh on [opensource.com](https://opensource.com)
+Rootless Podman requires the user running it to have a range of UIDs listed in the files `/etc/subuid` and `/etc/subgid`. The `shadow-utils` or `newuid` package provides these files on different distributions and they must be installed on the system. Root privileges are required to add or update entries within these files. The following is a summary from the [How does rootless Podman work?](https://opensource.com/article/19/2/how-does-rootless-podman-work) article by Dan Walsh on [opensource.com](https://opensource.com)
-Update the /etc/subuid and /etc/subgid with fields for each user that will be allowed to create containers that look like the following. Note that the values for each user must be unique and without any overlap. If there is an overlap, there is a potential for a user to use another’s namespace and they could corrupt it.
+For each user that will be allowed to create containers, update `/etc/subuid` and `/etc/subgid` for the user with fields that look like the following. Note that the values for each user must be unique. If there is overlap, there is a potential for a user to use another user's namespace and they could corrupt it.
```
cat /etc/subuid
@@ -68,17 +68,17 @@ johndoe:100000:65536
test:165536:65536
```
-The format of this file is USERNAME:UID:RANGE
+The format of this file is `USERNAME:UID:RANGE`
-* username as listed in /etc/passwd or getpwent.
-* The initial uid allocated for the user.
+* username as listed in `/etc/passwd` or in the output of [`getpwent`](https://man7.org/linux/man-pages/man3/getpwent.3.html).
+* The initial UID allocated for the user.
* The size of the range of UIDs allocated for the user.
-This means the user johndoe is allocated UIDS 100000-165535 as well as their standard UID in the /etc/passwd file. NOTE: this is not currently supported with network installs. These files must be available locally to the host machine. It is not possible to configure this with LDAP or Active Directory.
+This means the user `johndoe` is allocated UIDs 100000-165535 as well as their standard UID in the `/etc/passwd` file. NOTE: this is not currently supported with network installs; these files must be available locally to the host machine. It is not possible to configure this with LDAP or Active Directory.
-If you update either the /etc/subuid or the /etc/subgid file, you need to stop all the running containers owned by the user and kill the pause process that is running on the system for that user. This can be done automatically by using the [`podman system migrate`](https://github.com/containers/podman/blob/master/docs/podman-system-migrate.1.md) command which will stop all the containers for the user and will kill the pause process.
+If you update either `/etc/subuid` or `/etc/subgid`, you need to stop all the running containers owned by the user and kill the pause process that is running on the system for that user. This can be done automatically by using the [`podman system migrate`](https://github.com/containers/podman/blob/main/docs/source/markdown/podman-system-migrate.1.md) command which will stop all the containers for the user and will kill the pause process.
-Rather than updating the files directly, the usermod program can be used to assign UIDs and GIDs to a user.
+Rather than updating the files directly, the `usermod` program can be used to assign UIDs and GIDs to a user.
```
usermod --add-subuids 200000-201000 --add-subgids 200000-201000 johndoe
@@ -102,13 +102,13 @@ To make the change persist, the administrator will need to add a file with the `
The majority of the work necessary to run Podman in a rootless environment is on the shoulders of the machine’s administrator.
-Once the Administrator has completed the setup on the machine and then the configurations for the user in /etc/subuid and /etc/subgid, the user can just start using any Podman command that they wish.
+Once the Administrator has completed the setup on the machine and then the configurations for the user in `/etc/subuid` and `/etc/subgid`, the user can just start using any Podman command that they wish.
### User Configuration Files
The Podman configuration files for root reside in `/usr/share/containers` with overrides in `/etc/containers`. In the rootless environment they reside in `${XDG_CONFIG_HOME}/containers` (usually `~/.config/containers`) and are owned by each individual user.
-The three main configuration files are [containers.conf](https://github.com/containers/common/blob/master/docs/containers.conf.5.md), [storage.conf](https://github.com/containers/storage/blob/master/docs/containers-storage.conf.5.md) and [registries.conf](https://github.com/containers/image/blob/master/docs/containers-registries.conf.5.md). The user can modify these files as they wish.
+The three main configuration files are [containers.conf](https://github.com/containers/common/blob/main/docs/containers.conf.5.md), [storage.conf](https://github.com/containers/storage/blob/main/docs/containers-storage.conf.5.md) and [registries.conf](https://github.com/containers/image/blob/main/docs/containers-registries.conf.5.md). The user can modify these files as they wish.
#### containers.conf
Podman reads
@@ -123,7 +123,7 @@ For `storage.conf` the order is
1. `/etc/containers/storage.conf`
2. `$HOME/.config/containers/storage.conf`
-In rootless podman certain fields in `/etc/containers/storage.conf` are ignored. These fields are:
+In rootless Podman certain fields in `/etc/containers/storage.conf` are ignored. These fields are:
```
graphroot=""
container storage graph dir (default: "/var/lib/containers/storage")
@@ -133,7 +133,7 @@ runroot=""
container storage run dir (default: "/run/containers/storage")
Default directory to store all temporary writable content created by container storage programs.
```
-In rootless podman these fields default to
+In rootless Podman these fields default to
```
graphroot="$HOME/.local/share/containers/storage"
runroot="$XDG_RUNTIME_DIR/containers"
@@ -146,14 +146,14 @@ Registry configuration is read in by this order
2. `/etc/containers/registries.d/*`
3. `HOME/.config/containers/registries.conf`
-The files in the home directory should be used to configure rootless podman for personal needs. These files are not created by default. Users can copy the files from `/usr/share/containers` or `/etc/containers` and modify them.
+The files in the home directory should be used to configure rootless Podman for personal needs. These files are not created by default. Users can copy the files from `/usr/share/containers` or `/etc/containers` and modify them.
#### Authorization files
The default authorization file used by the `podman login` and `podman logout` commands reside in `${XDG_RUNTIME_DIR}/containers/auth.json`.
### Using volumes
-Rootless Podman is not, and will never be, root; it's not a setuid binary, and gains no privileges when it runs. Instead, Podman makes use of a user namespace to shift the UIDs and GIDs of a block of users it is given access to on the host (via the newuidmap and newgidmap executables) and your own user within the containers that Podman creates.
+Rootless Podman is not, and will never be, root; it's not a `setuid` binary, and gains no privileges when it runs. Instead, Podman makes use of a user namespace to shift the UIDs and GIDs of a block of users it is given access to on the host (via the `newuidmap` and `newgidmap` executables) and your own user within the containers that Podman creates.
If your container runs with the root user, then `root` in the container is actually your user on the host. UID/GID 1 is the first UID/GID specified in your user's mapping in `/etc/subuid` and `/etc/subgid`, etc. If you mount a directory from the host into a container as a rootless user, and create a file in that directory as root in the container, you'll see it's actually owned by your user on the host.
@@ -193,6 +193,6 @@ Other considerations in regards to volumes:
## More information
-If you are still experiencing problems running Podman in a rootless environment, please refer to the [Shortcomings of Rootless Podman](https://github.com/containers/podman/blob/master/rootless.md) page which lists known issues and solutions to known issues in this environment.
+If you are still experiencing problems running Podman in a rootless environment, please refer to the [Shortcomings of Rootless Podman](https://github.com/containers/podman/blob/main/rootless.md) page which lists known issues and solutions to known issues in this environment.
-For more information on Podman and its subcommands, checkout the asciiart demos on the [README.md](../../README.md#commands) page or the [podman.io](https://podman.io) web site.
+For more information on Podman and its subcommands, follow the links on the main [README.md](../../README.md#podman-information-for-developers) page or the [podman.io](https://podman.io) web site.
diff --git a/go.mod b/go.mod
index 7d007afa6..2dd760cee 100644
--- a/go.mod
+++ b/go.mod
@@ -17,7 +17,7 @@ require (
github.com/containers/image/v5 v5.13.2
github.com/containers/ocicrypt v1.1.2
github.com/containers/psgo v1.5.2
- github.com/containers/storage v1.32.5
+ github.com/containers/storage v1.32.6
github.com/coreos/go-systemd/v22 v22.3.2
github.com/coreos/stream-metadata-go v0.0.0-20210225230131-70edb9eb47b3
github.com/cri-o/ocicni v0.2.1-0.20210621164014-d0acc7862283
@@ -33,7 +33,7 @@ require (
github.com/ghodss/yaml v1.0.0
github.com/godbus/dbus/v5 v5.0.4
github.com/google/shlex v0.0.0-20181106134648-c34317bd91bf
- github.com/google/uuid v1.2.0
+ github.com/google/uuid v1.3.0
github.com/gorilla/mux v1.8.0
github.com/gorilla/schema v1.2.0
github.com/hashicorp/go-multierror v1.1.1
@@ -43,7 +43,7 @@ require (
github.com/moby/term v0.0.0-20201216013528-df9cb8a40635
github.com/mrunalp/fileutils v0.5.0
github.com/onsi/ginkgo v1.16.4
- github.com/onsi/gomega v1.13.0
+ github.com/onsi/gomega v1.14.0
github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/image-spec v1.0.2-0.20190823105129-775207bd45b6
github.com/opencontainers/runc v1.0.0
diff --git a/go.sum b/go.sum
index daec65293..fb0690b39 100644
--- a/go.sum
+++ b/go.sum
@@ -73,8 +73,9 @@ github.com/Microsoft/hcsshim v0.8.9/go.mod h1:5692vkUqntj1idxauYlpoINNKeqCiG6Sg3
github.com/Microsoft/hcsshim v0.8.14/go.mod h1:NtVKoYxQuTLx6gEq0L96c9Ju4JbRJ4nY2ow3VK6a9Lg=
github.com/Microsoft/hcsshim v0.8.15/go.mod h1:x38A4YbHbdxJtc0sF6oIz+RG0npwSCAvn69iY6URG00=
github.com/Microsoft/hcsshim v0.8.16/go.mod h1:o5/SZqmR7x9JNKsW3pu+nqHm0MF8vbA+VxGOoXdC600=
-github.com/Microsoft/hcsshim v0.8.17 h1:yFHH5bghP9ij5Y34PPaMOE8g//oXZ0uJQeMENVo2zcI=
github.com/Microsoft/hcsshim v0.8.17/go.mod h1:+w2gRZ5ReXQhFOrvSQeNfhrYB/dg3oDwTOcER2fw4I4=
+github.com/Microsoft/hcsshim v0.8.20 h1:ZTwcx3NS8n07kPf/JZ1qwU6vnjhVPMUWlXBF8r9UxrE=
+github.com/Microsoft/hcsshim v0.8.20/go.mod h1:+w2gRZ5ReXQhFOrvSQeNfhrYB/dg3oDwTOcER2fw4I4=
github.com/Microsoft/hcsshim/test v0.0.0-20201218223536-d3e5debf77da/go.mod h1:5hlzMzRKMLyo42nCZ9oml8AdTlq/0cvIaBv6tK1RehU=
github.com/Microsoft/hcsshim/test v0.0.0-20210227013316-43a75bb4edd3/go.mod h1:mw7qgWloBUl75W/gVH3cQszUg1+gUITj7D6NY7ywVnY=
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
@@ -257,8 +258,9 @@ github.com/containers/psgo v1.5.2 h1:3aoozst/GIwsrr/5jnFy3FrJay98uujPCu9lTuSZ/Cw
github.com/containers/psgo v1.5.2/go.mod h1:2ubh0SsreMZjSXW1Hif58JrEcFudQyIy9EzPUWfawVU=
github.com/containers/storage v1.23.5/go.mod h1:ha26Q6ngehFNhf3AWoXldvAvwI4jFe3ETQAf/CeZPyM=
github.com/containers/storage v1.32.2/go.mod h1:YIBxxjfXZTi04Ah49sh1uSGfmT1V89+I5i3deRobzQo=
-github.com/containers/storage v1.32.5 h1:DXgmyA+oOs7YAzKkEqgC5O8l2UuDGJcwEFbdt49qiak=
github.com/containers/storage v1.32.5/go.mod h1:8/DVVDqniaUlUV0D0q7cEnXK6Bs2uU3FPqNZVPumwEs=
+github.com/containers/storage v1.32.6 h1:NqdFRewXO/PYPjgCAScoigZc5QUA21yapSEj6kqD8cw=
+github.com/containers/storage v1.32.6/go.mod h1:mdB+b89p+jU8zpzLTVXA0gWMmIo0WrkfGMh1R8O2IQw=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
@@ -480,8 +482,9 @@ github.com/google/shlex v0.0.0-20181106134648-c34317bd91bf/go.mod h1:RpwtwJQFrIE
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
-github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs=
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
+github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
+github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg=
@@ -705,8 +708,9 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.10.3/go.mod h1:V9xEwhxec5O8UDM77eCW8vLymOMltsqPVYWrpDsH8xc=
github.com/onsi/gomega v1.10.5/go.mod h1:gza4q3jKQJijlu05nKWRCW/GavJumGt8aNRxWg7mt48=
-github.com/onsi/gomega v1.13.0 h1:7lLHu94wT9Ij0o6EWWclhu0aOh32VxhkwEJvzuWPeak=
github.com/onsi/gomega v1.13.0/go.mod h1:lRk9szgn8TxENtWd0Tp4c3wjlRfMTMH27I+3Je41yGY=
+github.com/onsi/gomega v1.14.0 h1:ep6kpPVwmr/nTbklSx2nrLNSIO62DoYAhnPNIMhK8gI=
+github.com/onsi/gomega v1.14.0/go.mod h1:cIuvLEne0aoVhAgh/O6ac0Op8WWw9H6eYCriF+tEHG0=
github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go
index 850af235f..b69ad4105 100644
--- a/libpod/container_internal_linux.go
+++ b/libpod/container_internal_linux.go
@@ -2490,6 +2490,11 @@ func (c *Container) fixVolumePermissions(v *ContainerNamedVolume) error {
// https://github.com/containers/podman/issues/10188
st, err := os.Lstat(filepath.Join(c.state.Mountpoint, v.Dest))
if err == nil {
+ if stat, ok := st.Sys().(*syscall.Stat_t); ok {
+ if err := os.Lchown(mountPoint, int(stat.Uid), int(stat.Gid)); err != nil {
+ return err
+ }
+ }
if err := os.Chmod(mountPoint, st.Mode()|0111); err != nil {
return err
}
diff --git a/libpod/container_log.go b/libpod/container_log.go
index 43b3f7736..743c9c61b 100644
--- a/libpod/container_log.go
+++ b/libpod/container_log.go
@@ -56,7 +56,7 @@ func (c *Container) readFromLogFile(ctx context.Context, options *logs.LogOption
for _, nll := range tailLog {
nll.CID = c.ID()
nll.CName = c.Name()
- if nll.Since(options.Since) {
+ if nll.Since(options.Since) && nll.Until(options.Until) {
logChannel <- nll
}
}
@@ -88,7 +88,7 @@ func (c *Container) readFromLogFile(ctx context.Context, options *logs.LogOption
}
nll.CID = c.ID()
nll.CName = c.Name()
- if nll.Since(options.Since) {
+ if nll.Since(options.Since) && nll.Until(options.Until) {
logChannel <- nll
}
}
diff --git a/libpod/container_log_linux.go b/libpod/container_log_linux.go
index 892ee34e3..9f9dd3b0d 100644
--- a/libpod/container_log_linux.go
+++ b/libpod/container_log_linux.go
@@ -97,6 +97,7 @@ func (c *Container) readFromJournal(ctx context.Context, options *logs.LogOption
}
}()
+ beforeTimeStamp := true
afterTimeStamp := false // needed for options.Since
tailQueue := []*logs.LogLine{} // needed for options.Tail
doTail := options.Tail > 0
@@ -156,6 +157,13 @@ func (c *Container) readFromJournal(ctx context.Context, options *logs.LogOption
}
afterTimeStamp = true
}
+ if beforeTimeStamp {
+ entryTime := time.Unix(0, int64(entry.RealtimeTimestamp)*int64(time.Microsecond))
+ if entryTime.Before(options.Until) || !options.Until.IsZero() {
+ continue
+ }
+ beforeTimeStamp = false
+ }
// If we're reading an event and the container exited/died,
// then we're done and can return.
diff --git a/libpod/logs/log.go b/libpod/logs/log.go
index 308053b47..1a0223edc 100644
--- a/libpod/logs/log.go
+++ b/libpod/logs/log.go
@@ -34,6 +34,7 @@ type LogOptions struct {
Details bool
Follow bool
Since time.Time
+ Until time.Time
Tail int64
Timestamps bool
Multi bool
@@ -184,7 +185,12 @@ func (l *LogLine) String(options *LogOptions) string {
// Since returns a bool as to whether a log line occurred after a given time
func (l *LogLine) Since(since time.Time) bool {
- return l.Time.After(since)
+ return l.Time.After(since) || since.IsZero()
+}
+
+// Until returns a bool as to whether a log line occurred before a given time
+func (l *LogLine) Until(until time.Time) bool {
+ return l.Time.Before(until) || until.IsZero()
}
// NewLogLine creates a logLine struct from a container log string
diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go
index 1b775a4f3..0f3e03e06 100644
--- a/libpod/networking_linux.go
+++ b/libpod/networking_linux.go
@@ -108,16 +108,36 @@ func (r *Runtime) getPodNetwork(id, name, nsPath string, networks []string, port
type RootlessCNI struct {
ns ns.NetNS
dir string
- lock lockfile.Locker
+ Lock lockfile.Locker
}
+// getPath will join the given path to the rootless cni dir
+func (r *RootlessCNI) getPath(path string) string {
+ return filepath.Join(r.dir, path)
+}
+
+// Do - run the given function in the rootless cni ns.
+// It does not lock the rootlessCNI lock, the caller
+// should only lock when needed, e.g. for cni operations.
func (r *RootlessCNI) Do(toRun func() error) error {
err := r.ns.Do(func(_ ns.NetNS) error {
- // before we can run the given function
- // we have to setup all mounts correctly
-
- // create a new mount namespace
- // this should happen inside the netns thread
+ // Before we can run the given function,
+ // we have to setup all mounts correctly.
+
+ // The order of the mounts is IMPORTANT.
+ // The idea of the extra mount ns is to make /run and /var/lib/cni writeable
+ // for the cni plugins but not affecting the podman user namespace.
+ // Because the plugins also need access to XDG_RUNTIME_DIR/netns some special setup is needed.
+
+ // The following bind mounts are needed
+ // 1. XDG_RUNTIME_DIR/netns -> XDG_RUNTIME_DIR/rootless-cni/XDG_RUNTIME_DIR/netns
+ // 2. /run/systemd -> XDG_RUNTIME_DIR/rootless-cni/run/systemd (only if it exists)
+ // 3. XDG_RUNTIME_DIR/rootless-cni/resolv.conf -> /etc/resolv.conf or XDG_RUNTIME_DIR/rootless-cni/run/symlink/target
+ // 4. XDG_RUNTIME_DIR/rootless-cni/var/lib/cni -> /var/lib/cni (if /var/lib/cni does not exists use the parent dir)
+ // 5. XDG_RUNTIME_DIR/rootless-cni/run -> /run
+
+ // Create a new mount namespace,
+ // this must happen inside the netns thread.
err := unix.Unshare(unix.CLONE_NEWNS)
if err != nil {
return errors.Wrapf(err, "cannot create a new mount namespace")
@@ -127,33 +147,70 @@ func (r *RootlessCNI) Do(toRun func() error) error {
if err != nil {
return errors.Wrap(err, "could not get network namespace directory")
}
- newNetNsDir := filepath.Join(r.dir, netNsDir)
- // mount the netns into the new run to keep them accessible
- // otherwise cni setup will fail because it cannot access the netns files
+ newNetNsDir := r.getPath(netNsDir)
+ // 1. Mount the netns into the new run to keep them accessible.
+ // Otherwise cni setup will fail because it cannot access the netns files.
err = unix.Mount(netNsDir, newNetNsDir, "none", unix.MS_BIND|unix.MS_SHARED|unix.MS_REC, "")
if err != nil {
return errors.Wrap(err, "failed to mount netns directory for rootless cni")
}
- // mount resolv.conf to make use of the host dns
- err = unix.Mount(filepath.Join(r.dir, "resolv.conf"), "/etc/resolv.conf", "none", unix.MS_BIND, "")
- if err != nil {
- return errors.Wrap(err, "failed to mount resolv.conf for rootless cni")
- }
-
- // also keep /run/systemd if it exists
- // many files are symlinked into this dir, for example /dev/log
+ // 2. Also keep /run/systemd if it exists.
+ // Many files are symlinked into this dir, for example /dev/log.
runSystemd := "/run/systemd"
_, err = os.Stat(runSystemd)
if err == nil {
- newRunSystemd := filepath.Join(r.dir, runSystemd[1:])
+ newRunSystemd := r.getPath(runSystemd)
err = unix.Mount(runSystemd, newRunSystemd, "none", unix.MS_BIND|unix.MS_REC, "")
if err != nil {
return errors.Wrap(err, "failed to mount /run/systemd directory for rootless cni")
}
}
- // cni plugins need access to /var/lib/cni and /run
+ // 3. On some distros /etc/resolv.conf is symlinked to somewhere under /run.
+ // Because the kernel will follow the symlink before mounting, it is not
+ // possible to mount a file at /etc/resolv.conf. We have to ensure that
+ // the link target will be available in the mount ns.
+ // see: https://github.com/containers/podman/issues/10855
+ resolvePath := "/etc/resolv.conf"
+ resolvePath, err = filepath.EvalSymlinks(resolvePath)
+ if err != nil {
+ return err
+ }
+ logrus.Debugf("The actual path of /etc/resolv.conf on the host is %q", resolvePath)
+ // When /etc/resolv.conf on the host is a symlink to /run/systemd/resolve/stub-resolv.conf,
+ // we have to mount an empty filesystem on /run/systemd/resolve in the child namespace,
+ // so as to isolate the directory from the host mount namespace.
+ //
+ // Otherwise our bind-mount for /run/systemd/resolve/stub-resolv.conf is unmounted
+ // when systemd-resolved unlinks and recreates /run/systemd/resolve/stub-resolv.conf on the host.
+ // see: https://github.com/containers/podman/issues/10929
+ if strings.HasPrefix(resolvePath, "/run/systemd/resolve/") {
+ rsr := r.getPath("/run/systemd/resolve")
+ err = unix.Mount("", rsr, "tmpfs", unix.MS_NOEXEC|unix.MS_NOSUID|unix.MS_NODEV, "")
+ if err != nil {
+ return errors.Wrapf(err, "failed to mount tmpfs on %q for rootless cni", rsr)
+ }
+ }
+ if strings.HasPrefix(resolvePath, "/run/") {
+ resolvePath = r.getPath(resolvePath)
+ err = os.MkdirAll(filepath.Dir(resolvePath), 0700)
+ if err != nil {
+ return errors.Wrap(err, "failed to create rootless-cni resolv.conf directory")
+ }
+ // we want to bind mount on this file so we have to create the file first
+ _, err = os.OpenFile(resolvePath, os.O_CREATE|os.O_RDONLY, 0700)
+ if err != nil {
+ return errors.Wrap(err, "failed to create rootless-cni resolv.conf file")
+ }
+ }
+ // mount resolv.conf to make use of the host dns
+ err = unix.Mount(r.getPath("resolv.conf"), resolvePath, "none", unix.MS_BIND, "")
+ if err != nil {
+ return errors.Wrap(err, "failed to mount resolv.conf for rootless cni")
+ }
+
+ // 4. CNI plugins need access to /var/lib/cni and /run
varDir := ""
varTarget := persistentCNIDir
// we can only mount to a target dir which exists, check /var/lib/cni recursively
@@ -161,10 +218,10 @@ func (r *RootlessCNI) Do(toRun func() error) error {
// configs under /var/custom and this would break
for {
if _, err := os.Stat(varTarget); err == nil {
- varDir = filepath.Join(r.dir, strings.TrimPrefix(varTarget, "/"))
+ varDir = r.getPath(varTarget)
break
}
- varTarget = filepath.Base(varTarget)
+ varTarget = filepath.Dir(varTarget)
if varTarget == "/" {
break
}
@@ -177,8 +234,9 @@ func (r *RootlessCNI) Do(toRun func() error) error {
if err != nil {
return errors.Wrapf(err, "failed to mount %s for rootless cni", varTarget)
}
- runDir := filepath.Join(r.dir, "run")
- // recursive mount to keep the netns mount
+
+ // 5. Mount the new prepared run dir to /run, it has to be recursive to keep the other bind mounts.
+ runDir := r.getPath("run")
err = unix.Mount(runDir, "/run", "none", unix.MS_BIND|unix.MS_REC, "")
if err != nil {
return errors.Wrap(err, "failed to mount /run for rootless cni")
@@ -191,16 +249,17 @@ func (r *RootlessCNI) Do(toRun func() error) error {
return err
}
-// Cleanup the rootless cni namespace if needed
-// check if we have running containers with the bridge network mode
+// Cleanup the rootless cni namespace if needed.
+// It checks if we have running containers with the bridge network mode.
+// Cleanup() will try to lock RootlessCNI, therefore you have to call it with an unlocked
func (r *RootlessCNI) Cleanup(runtime *Runtime) error {
_, err := os.Stat(r.dir)
if os.IsNotExist(err) {
// the directory does not exists no need for cleanup
return nil
}
- r.lock.Lock()
- defer r.lock.Unlock()
+ r.Lock.Lock()
+ defer r.Lock.Unlock()
running := func(c *Container) bool {
// we cannot use c.state() because it will try to lock the container
// using c.state.State directly should be good enough for this use case
@@ -221,7 +280,7 @@ func (r *RootlessCNI) Cleanup(runtime *Runtime) error {
// make sure the the cni results (cache) dir is empty
// libpod instances with another root dir are not covered by the check above
// this allows several libpod instances to use the same rootless cni ns
- contents, err := ioutil.ReadDir(filepath.Join(r.dir, "var/lib/cni/results"))
+ contents, err := ioutil.ReadDir(r.getPath("var/lib/cni/results"))
if (err == nil && len(contents) == 0) || os.IsNotExist(err) {
logrus.Debug("Cleaning up rootless cni namespace")
err = netns.UnmountNS(r.ns)
@@ -233,7 +292,7 @@ func (r *RootlessCNI) Cleanup(runtime *Runtime) error {
if err != nil {
logrus.Error(err)
}
- b, err := ioutil.ReadFile(filepath.Join(r.dir, "rootless-cni-slirp4netns.pid"))
+ b, err := ioutil.ReadFile(r.getPath("rootless-cni-slirp4netns.pid"))
if err == nil {
var i int
i, err = strconv.Atoi(string(b))
@@ -258,200 +317,216 @@ func (r *RootlessCNI) Cleanup(runtime *Runtime) error {
// GetRootlessCNINetNs returns the rootless cni object. If create is set to true
// the rootless cni namespace will be created if it does not exists already.
+// If called as root it returns always nil.
+// On success the returned RootlessCNI lock is locked and must be unlocked by the caller.
func (r *Runtime) GetRootlessCNINetNs(new bool) (*RootlessCNI, error) {
+ if !rootless.IsRootless() {
+ return nil, nil
+ }
var rootlessCNINS *RootlessCNI
- if rootless.IsRootless() {
- runDir, err := util.GetRuntimeDir()
- if err != nil {
- return nil, err
+ runDir, err := util.GetRuntimeDir()
+ if err != nil {
+ return nil, err
+ }
+
+ lfile := filepath.Join(runDir, "rootless-cni.lock")
+ lock, err := lockfile.GetLockfile(lfile)
+ if err != nil {
+ return nil, errors.Wrap(err, "failed to get rootless-cni lockfile")
+ }
+ lock.Lock()
+ defer func() {
+ // In case of an error (early exit) rootlessCNINS will be nil.
+ // Make sure to unlock otherwise we could deadlock.
+ if rootlessCNINS == nil {
+ lock.Unlock()
}
- cniDir := filepath.Join(runDir, "rootless-cni")
- err = os.MkdirAll(cniDir, 0700)
+ }()
+
+ cniDir := filepath.Join(runDir, "rootless-cni")
+ err = os.MkdirAll(cniDir, 0700)
+ if err != nil {
+ return nil, errors.Wrap(err, "could not create rootless-cni directory")
+ }
+
+ nsDir, err := netns.GetNSRunDir()
+ if err != nil {
+ return nil, err
+ }
+ path := filepath.Join(nsDir, rootlessCNINSName)
+ ns, err := ns.GetNS(path)
+ if err != nil {
+ if !new {
+ // return a error if we could not get the namespace and should no create one
+ return nil, errors.Wrap(err, "error getting rootless cni network namespace")
+ }
+ // create a new namespace
+ logrus.Debug("creating rootless cni network namespace")
+ ns, err = netns.NewNSWithName(rootlessCNINSName)
if err != nil {
- return nil, errors.Wrap(err, "could not create rootless-cni directory")
+ return nil, errors.Wrap(err, "error creating rootless cni network namespace")
+ }
+ // setup slirp4netns here
+ path := r.config.Engine.NetworkCmdPath
+ if path == "" {
+ var err error
+ path, err = exec.LookPath("slirp4netns")
+ if err != nil {
+ return nil, err
+ }
}
- lfile := filepath.Join(cniDir, "rootless-cni.lck")
- lock, err := lockfile.GetLockfile(lfile)
+ syncR, syncW, err := os.Pipe()
if err != nil {
- return nil, errors.Wrap(err, "failed to get rootless-cni lockfile")
+ return nil, errors.Wrapf(err, "failed to open pipe")
}
- lock.Lock()
- defer lock.Unlock()
+ defer errorhandling.CloseQuiet(syncR)
+ defer errorhandling.CloseQuiet(syncW)
- nsDir, err := netns.GetNSRunDir()
+ netOptions, err := parseSlirp4netnsNetworkOptions(r, nil)
if err != nil {
return nil, err
}
- path := filepath.Join(nsDir, rootlessCNINSName)
- ns, err := ns.GetNS(path)
+ slirpFeatures, err := checkSlirpFlags(path)
if err != nil {
- if new {
- // create a new namespace
- logrus.Debug("creating rootless cni network namespace")
- ns, err = netns.NewNSWithName(rootlessCNINSName)
- if err != nil {
- return nil, errors.Wrap(err, "error creating rootless cni network namespace")
- }
- // setup slirp4netns here
- path := r.config.Engine.NetworkCmdPath
- if path == "" {
- var err error
- path, err = exec.LookPath("slirp4netns")
- if err != nil {
- return nil, err
- }
- }
-
- syncR, syncW, err := os.Pipe()
- if err != nil {
- return nil, errors.Wrapf(err, "failed to open pipe")
- }
- defer errorhandling.CloseQuiet(syncR)
- defer errorhandling.CloseQuiet(syncW)
-
- netOptions, err := parseSlirp4netnsNetworkOptions(r, nil)
- if err != nil {
- return nil, err
- }
- slirpFeatures, err := checkSlirpFlags(path)
- if err != nil {
- return nil, errors.Wrapf(err, "error checking slirp4netns binary %s: %q", path, err)
- }
- cmdArgs, err := createBasicSlirp4netnsCmdArgs(netOptions, slirpFeatures)
- if err != nil {
- return nil, err
- }
- // Note we do not use --exit-fd, we kill this process by pid
- cmdArgs = append(cmdArgs, "-c", "-r", "3")
- cmdArgs = append(cmdArgs, "--netns-type=path", ns.Path(), "tap0")
-
- cmd := exec.Command(path, cmdArgs...)
- logrus.Debugf("slirp4netns command: %s", strings.Join(cmd.Args, " "))
- cmd.SysProcAttr = &syscall.SysProcAttr{
- Setpgid: true,
- }
-
- // workaround for https://github.com/rootless-containers/slirp4netns/pull/153
- if !netOptions.noPivotRoot && slirpFeatures.HasEnableSandbox {
- cmd.SysProcAttr.Cloneflags = syscall.CLONE_NEWNS
- cmd.SysProcAttr.Unshareflags = syscall.CLONE_NEWNS
- }
-
- // Leak one end of the pipe in slirp4netns
- cmd.ExtraFiles = append(cmd.ExtraFiles, syncW)
+ return nil, errors.Wrapf(err, "error checking slirp4netns binary %s: %q", path, err)
+ }
+ cmdArgs, err := createBasicSlirp4netnsCmdArgs(netOptions, slirpFeatures)
+ if err != nil {
+ return nil, err
+ }
+ // Note we do not use --exit-fd, we kill this process by pid
+ cmdArgs = append(cmdArgs, "-c", "-r", "3")
+ cmdArgs = append(cmdArgs, "--netns-type=path", ns.Path(), "tap0")
+
+ cmd := exec.Command(path, cmdArgs...)
+ logrus.Debugf("slirp4netns command: %s", strings.Join(cmd.Args, " "))
+ cmd.SysProcAttr = &syscall.SysProcAttr{
+ Setpgid: true,
+ }
- logPath := filepath.Join(r.config.Engine.TmpDir, "slirp4netns-rootless-cni.log")
- logFile, err := os.Create(logPath)
- if err != nil {
- return nil, errors.Wrapf(err, "failed to open slirp4netns log file %s", logPath)
- }
- defer logFile.Close()
- // Unlink immediately the file so we won't need to worry about cleaning it up later.
- // It is still accessible through the open fd logFile.
- if err := os.Remove(logPath); err != nil {
- return nil, errors.Wrapf(err, "delete file %s", logPath)
- }
- cmd.Stdout = logFile
- cmd.Stderr = logFile
- if err := cmd.Start(); err != nil {
- return nil, errors.Wrapf(err, "failed to start slirp4netns process")
- }
- // create pid file for the slirp4netns process
- // this is need to kill the process in the cleanup
- pid := strconv.Itoa(cmd.Process.Pid)
- err = ioutil.WriteFile(filepath.Join(cniDir, "rootless-cni-slirp4netns.pid"), []byte(pid), 0700)
- if err != nil {
- errors.Wrap(err, "unable to write rootless-cni slirp4netns pid file")
- }
+ // workaround for https://github.com/rootless-containers/slirp4netns/pull/153
+ if !netOptions.noPivotRoot && slirpFeatures.HasEnableSandbox {
+ cmd.SysProcAttr.Cloneflags = syscall.CLONE_NEWNS
+ cmd.SysProcAttr.Unshareflags = syscall.CLONE_NEWNS
+ }
- defer func() {
- if err := cmd.Process.Release(); err != nil {
- logrus.Errorf("unable to release command process: %q", err)
- }
- }()
+ // Leak one end of the pipe in slirp4netns
+ cmd.ExtraFiles = append(cmd.ExtraFiles, syncW)
- if err := waitForSync(syncR, cmd, logFile, 1*time.Second); err != nil {
- return nil, err
- }
+ logPath := filepath.Join(r.config.Engine.TmpDir, "slirp4netns-rootless-cni.log")
+ logFile, err := os.Create(logPath)
+ if err != nil {
+ return nil, errors.Wrapf(err, "failed to open slirp4netns log file %s", logPath)
+ }
+ defer logFile.Close()
+ // Unlink immediately the file so we won't need to worry about cleaning it up later.
+ // It is still accessible through the open fd logFile.
+ if err := os.Remove(logPath); err != nil {
+ return nil, errors.Wrapf(err, "delete file %s", logPath)
+ }
+ cmd.Stdout = logFile
+ cmd.Stderr = logFile
+ if err := cmd.Start(); err != nil {
+ return nil, errors.Wrapf(err, "failed to start slirp4netns process")
+ }
+ // create pid file for the slirp4netns process
+ // this is need to kill the process in the cleanup
+ pid := strconv.Itoa(cmd.Process.Pid)
+ err = ioutil.WriteFile(filepath.Join(cniDir, "rootless-cni-slirp4netns.pid"), []byte(pid), 0700)
+ if err != nil {
+ errors.Wrap(err, "unable to write rootless-cni slirp4netns pid file")
+ }
- // build a new resolv.conf file which uses the slirp4netns dns server address
- resolveIP, err := GetSlirp4netnsDNS(nil)
- if err != nil {
- return nil, errors.Wrap(err, "failed to determine default slirp4netns DNS address")
- }
+ defer func() {
+ if err := cmd.Process.Release(); err != nil {
+ logrus.Errorf("unable to release command process: %q", err)
+ }
+ }()
- if netOptions.cidr != "" {
- _, cidr, err := net.ParseCIDR(netOptions.cidr)
- if err != nil {
- return nil, errors.Wrap(err, "failed to parse slirp4netns cidr")
- }
- resolveIP, err = GetSlirp4netnsDNS(cidr)
- if err != nil {
- return nil, errors.Wrapf(err, "failed to determine slirp4netns DNS address from cidr: %s", cidr.String())
- }
- }
- conf, err := resolvconf.Get()
- if err != nil {
- return nil, err
- }
- searchDomains := resolvconf.GetSearchDomains(conf.Content)
- dnsOptions := resolvconf.GetOptions(conf.Content)
+ if err := waitForSync(syncR, cmd, logFile, 1*time.Second); err != nil {
+ return nil, err
+ }
- _, err = resolvconf.Build(filepath.Join(cniDir, "resolv.conf"), []string{resolveIP.String()}, searchDomains, dnsOptions)
- if err != nil {
- return nil, errors.Wrap(err, "failed to create rootless cni resolv.conf")
- }
+ // build a new resolv.conf file which uses the slirp4netns dns server address
+ resolveIP, err := GetSlirp4netnsDNS(nil)
+ if err != nil {
+ return nil, errors.Wrap(err, "failed to determine default slirp4netns DNS address")
+ }
- // create cni directories to store files
- // they will be bind mounted to the correct location in a extra mount ns
- err = os.MkdirAll(filepath.Join(cniDir, strings.TrimPrefix(persistentCNIDir, "/")), 0700)
- if err != nil {
- return nil, errors.Wrap(err, "could not create rootless-cni var directory")
- }
- runDir := filepath.Join(cniDir, "run")
- err = os.MkdirAll(runDir, 0700)
- if err != nil {
- return nil, errors.Wrap(err, "could not create rootless-cni run directory")
- }
- // relabel the new run directory to the iptables /run label
- // this is important, otherwise the iptables command will fail
- err = label.Relabel(runDir, "system_u:object_r:iptables_var_run_t:s0", false)
- if err != nil {
- return nil, errors.Wrap(err, "could not create relabel rootless-cni run directory")
- }
- // create systemd run directory
- err = os.MkdirAll(filepath.Join(runDir, "systemd"), 0700)
- if err != nil {
- return nil, errors.Wrap(err, "could not create rootless-cni systemd directory")
- }
- // create the directory for the netns files at the same location
- // relative to the rootless-cni location
- err = os.MkdirAll(filepath.Join(cniDir, nsDir), 0700)
- if err != nil {
- return nil, errors.Wrap(err, "could not create rootless-cni netns directory")
- }
- } else {
- // return a error if we could not get the namespace and should no create one
- return nil, errors.Wrap(err, "error getting rootless cni network namespace")
+ if netOptions.cidr != "" {
+ _, cidr, err := net.ParseCIDR(netOptions.cidr)
+ if err != nil {
+ return nil, errors.Wrap(err, "failed to parse slirp4netns cidr")
+ }
+ resolveIP, err = GetSlirp4netnsDNS(cidr)
+ if err != nil {
+ return nil, errors.Wrapf(err, "failed to determine slirp4netns DNS address from cidr: %s", cidr.String())
}
}
+ conf, err := resolvconf.Get()
+ if err != nil {
+ return nil, err
+ }
+ conf, err = resolvconf.FilterResolvDNS(conf.Content, netOptions.enableIPv6, true)
+ if err != nil {
+ return nil, err
+ }
+ searchDomains := resolvconf.GetSearchDomains(conf.Content)
+ dnsOptions := resolvconf.GetOptions(conf.Content)
+ nameServers := resolvconf.GetNameservers(conf.Content)
- // The CNI plugins need access to iptables in $PATH. As it turns out debian doesn't put
- // /usr/sbin in $PATH for rootless users. This will break rootless cni completely.
- // We might break existing users and we cannot expect everyone to change their $PATH so
- // lets add /usr/sbin to $PATH ourselves.
- path = os.Getenv("PATH")
- if !strings.Contains(path, "/usr/sbin") {
- path = path + ":/usr/sbin"
- os.Setenv("PATH", path)
+ _, err = resolvconf.Build(filepath.Join(cniDir, "resolv.conf"), append([]string{resolveIP.String()}, nameServers...), searchDomains, dnsOptions)
+ if err != nil {
+ return nil, errors.Wrap(err, "failed to create rootless cni resolv.conf")
}
- rootlessCNINS = &RootlessCNI{
- ns: ns,
- dir: cniDir,
- lock: lock,
+ // create cni directories to store files
+ // they will be bind mounted to the correct location in a extra mount ns
+ err = os.MkdirAll(filepath.Join(cniDir, strings.TrimPrefix(persistentCNIDir, "/")), 0700)
+ if err != nil {
+ return nil, errors.Wrap(err, "could not create rootless-cni var directory")
+ }
+ runDir := filepath.Join(cniDir, "run")
+ err = os.MkdirAll(runDir, 0700)
+ if err != nil {
+ return nil, errors.Wrap(err, "could not create rootless-cni run directory")
+ }
+ // relabel the new run directory to the iptables /run label
+ // this is important, otherwise the iptables command will fail
+ err = label.Relabel(runDir, "system_u:object_r:iptables_var_run_t:s0", false)
+ if err != nil {
+ return nil, errors.Wrap(err, "could not create relabel rootless-cni run directory")
}
+ // create systemd run directory
+ err = os.MkdirAll(filepath.Join(runDir, "systemd"), 0700)
+ if err != nil {
+ return nil, errors.Wrap(err, "could not create rootless-cni systemd directory")
+ }
+ // create the directory for the netns files at the same location
+ // relative to the rootless-cni location
+ err = os.MkdirAll(filepath.Join(cniDir, nsDir), 0700)
+ if err != nil {
+ return nil, errors.Wrap(err, "could not create rootless-cni netns directory")
+ }
+ }
+
+ // The CNI plugins need access to iptables in $PATH. As it turns out debian doesn't put
+ // /usr/sbin in $PATH for rootless users. This will break rootless cni completely.
+ // We might break existing users and we cannot expect everyone to change their $PATH so
+ // lets add /usr/sbin to $PATH ourselves.
+ path = os.Getenv("PATH")
+ if !strings.Contains(path, "/usr/sbin") {
+ path = path + ":/usr/sbin"
+ os.Setenv("PATH", path)
+ }
+
+ // Important set rootlessCNINS as last step.
+ // Do not return any errors after this.
+ rootlessCNINS = &RootlessCNI{
+ ns: ns,
+ dir: cniDir,
+ Lock: lock,
}
return rootlessCNINS, nil
}
@@ -501,6 +576,7 @@ func (r *Runtime) setUpOCICNIPod(podNetwork ocicni.PodNetwork) ([]ocicni.NetResu
if rootlessCNINS != nil {
// execute the cni setup in the rootless net ns
err = rootlessCNINS.Do(setUpPod)
+ rootlessCNINS.Lock.Unlock()
} else {
err = setUpPod()
}
@@ -713,6 +789,7 @@ func (r *Runtime) teardownOCICNIPod(podNetwork ocicni.PodNetwork) error {
if rootlessCNINS != nil {
// execute the cni setup in the rootless net ns
err = rootlessCNINS.Do(tearDownPod)
+ rootlessCNINS.Lock.Unlock()
if err == nil {
err = rootlessCNINS.Cleanup(r)
}
diff --git a/libpod/oci_conmon_exec_linux.go b/libpod/oci_conmon_exec_linux.go
index 09d3d1833..05a4e19b0 100644
--- a/libpod/oci_conmon_exec_linux.go
+++ b/libpod/oci_conmon_exec_linux.go
@@ -610,6 +610,9 @@ func attachExecHTTP(c *Container, sessionID string, r *http.Request, w http.Resp
_, err := utils.CopyDetachable(conn, httpBuf, detachKeys)
logrus.Debugf("STDIN copy completed")
stdinChan <- err
+ if connErr := conn.CloseWrite(); connErr != nil {
+ logrus.Errorf("Unable to close conn: %v", connErr)
+ }
}()
}
diff --git a/libpod/runtime.go b/libpod/runtime.go
index d31d00ae4..30659a3d4 100644
--- a/libpod/runtime.go
+++ b/libpod/runtime.go
@@ -946,9 +946,12 @@ func (r *Runtime) StorageConfig() storage.StoreOptions {
return r.storageConfig
}
-// GetStore returns the runtime stores
-func (r *Runtime) GetStore() storage.Store {
- return r.store
+// RunRoot retrieves the current c/storage temporary directory in use by Libpod.
+func (r *Runtime) RunRoot() string {
+ if r.store == nil {
+ return ""
+ }
+ return r.store.RunRoot()
}
// GetName retrieves the name associated with a given full ID.
diff --git a/nix/default-arm64.nix b/nix/default-arm64.nix
index d29f75520..8868788ae 100644
--- a/nix/default-arm64.nix
+++ b/nix/default-arm64.nix
@@ -30,8 +30,10 @@ let
"--enable-confdir=/etc"
"--enable-usbdropdir=/var/lib/pcsc/drivers"
"--disable-libsystemd"
+ "--disable-libudev"
+ "--disable-libusb"
];
- buildInputs = [ pkgs.python3 pkgs.udev pkgs.dbus pkgs.systemd ];
+ buildInputs = [ pkgs.python3 pkgs.dbus ];
});
systemd = (static pkg.systemd).overrideAttrs (x: {
outputs = [ "out" "dev" ];
@@ -69,6 +71,7 @@ let
export LDFLAGS='-s -w -static-libgcc -static'
export EXTRA_LDFLAGS='-s -w -linkmode external -extldflags "-static -lm"'
export BUILDTAGS='static netgo osusergo exclude_graphdriver_btrfs exclude_graphdriver_devicemapper seccomp apparmor selinux'
+ export CGO_ENABLED=1
'';
buildPhase = ''
patchShebangs .
diff --git a/nix/default.nix b/nix/default.nix
index f6194e3d9..4d15532c2 100644
--- a/nix/default.nix
+++ b/nix/default.nix
@@ -27,9 +27,11 @@ let
configureFlags = [
"--enable-confdir=/etc"
"--enable-usbdropdir=/var/lib/pcsc/drivers"
- "--with-systemdsystemunitdir=${placeholder "bin"}/lib/systemd/system"
+ "--disable-libsystemd"
+ "--disable-libudev"
+ "--disable-libusb"
];
- buildInputs = [ pkgs.python3 pkgs.udev pkgs.dbus pkgs.systemd ];
+ buildInputs = [ pkgs.python3 pkgs.dbus ];
});
systemd = (static pkg.systemd).overrideAttrs (x: {
outputs = [ "out" "dev" ];
@@ -67,6 +69,7 @@ let
export LDFLAGS='-s -w -static-libgcc -static'
export EXTRA_LDFLAGS='-s -w -linkmode external -extldflags "-static -lm"'
export BUILDTAGS='static netgo osusergo exclude_graphdriver_btrfs exclude_graphdriver_devicemapper seccomp apparmor selinux'
+ export CGO_ENABLED=1
'';
buildPhase = ''
patchShebangs .
diff --git a/nix/nixpkgs.json b/nix/nixpkgs.json
index a9771eade..efcfe202e 100644
--- a/nix/nixpkgs.json
+++ b/nix/nixpkgs.json
@@ -1,9 +1,9 @@
{
"url": "https://github.com/nixos/nixpkgs",
- "rev": "60cce7e5e1fdf62421ef6d4184ee399b46209366",
- "date": "2021-06-09T01:18:50-04:00",
- "path": "/nix/store/fixgn194626rb7gf99l9jaqm0hbqn2ix-nixpkgs",
- "sha256": "100xrb925cana1kfd0c7gwkjjalq891vfgr0rn1gl9j8gp3l3gx6",
+ "rev": "2a96414d7e350160a33ed0978449c9ff5b5a6eb3",
+ "date": "2021-07-13T18:21:47+02:00",
+ "path": "/nix/store/2ai9q8ac6vxb2rrngdz82y8jxnk15cvm-nixpkgs",
+ "sha256": "1dzrfqdjq3yq5jjskiqflzy58l2xx6059gay9p1k07zrlm1wigy5",
"fetchSubmodules": false,
"deepClone": false,
"leaveDotGit": false
diff --git a/pkg/api/handlers/compat/containers_logs.go b/pkg/api/handlers/compat/containers_logs.go
index cb4dee4d2..656e2c627 100644
--- a/pkg/api/handlers/compat/containers_logs.go
+++ b/pkg/api/handlers/compat/containers_logs.go
@@ -72,11 +72,12 @@ func LogsFromContainer(w http.ResponseWriter, r *http.Request) {
var until time.Time
if _, found := r.URL.Query()["until"]; found {
- // FIXME: until != since but the logs backend does not yet support until.
- since, err = util.ParseInputTime(query.Until)
- if err != nil {
- utils.BadRequest(w, "until", query.Until, err)
- return
+ if query.Until != "0" {
+ until, err = util.ParseInputTime(query.Until)
+ if err != nil {
+ utils.BadRequest(w, "until", query.Until, err)
+ return
+ }
}
}
@@ -84,6 +85,7 @@ func LogsFromContainer(w http.ResponseWriter, r *http.Request) {
Details: true,
Follow: query.Follow,
Since: since,
+ Until: until,
Tail: tail,
Timestamps: query.Timestamps,
}
@@ -119,7 +121,7 @@ func LogsFromContainer(w http.ResponseWriter, r *http.Request) {
for line := range logChannel {
if _, found := r.URL.Query()["until"]; found {
- if line.Time.After(until) {
+ if line.Time.After(until) && !until.IsZero() {
break
}
}
diff --git a/pkg/api/handlers/compat/networks.go b/pkg/api/handlers/compat/networks.go
index 4e1f31404..b990a916b 100644
--- a/pkg/api/handlers/compat/networks.go
+++ b/pkg/api/handlers/compat/networks.go
@@ -25,6 +25,12 @@ import (
"github.com/sirupsen/logrus"
)
+type pluginInterface struct {
+ PluginType string `json:"type"`
+ IPAM network.IPAMConfig `json:"ipam"`
+ IsGW bool `json:"isGateway"`
+}
+
func InspectNetwork(w http.ResponseWriter, r *http.Request) {
runtime := r.Context().Value("runtime").(*libpod.Runtime)
@@ -103,12 +109,12 @@ func getNetworkResourceByNameOrID(nameOrID string, runtime *libpod.Runtime, filt
}
}
- // No Bridge plugin means we bail
- bridge, err := genericPluginsToBridge(conf.Plugins, network.DefaultNetworkDriver)
+ plugin, err := getPlugin(conf.Plugins)
if err != nil {
return nil, err
}
- for _, outer := range bridge.IPAM.Ranges {
+
+ for _, outer := range plugin.IPAM.Ranges {
for _, n := range outer {
ipamConfig := dockerNetwork.IPAMConfig{
Subnet: n.Subnet,
@@ -140,19 +146,26 @@ func getNetworkResourceByNameOrID(nameOrID string, runtime *libpod.Runtime, filt
labels = map[string]string{}
}
+ isInternal := false
+ dockerDriver := plugin.PluginType
+ if plugin.PluginType == network.DefaultNetworkDriver {
+ isInternal = !plugin.IsGW
+ dockerDriver = "default"
+ }
+
report := types.NetworkResource{
Name: conf.Name,
ID: networkid.GetNetworkID(conf.Name),
Created: time.Unix(int64(stat.Ctim.Sec), int64(stat.Ctim.Nsec)), // nolint: unconvert
Scope: "local",
- Driver: network.DefaultNetworkDriver,
+ Driver: plugin.PluginType,
EnableIPv6: false,
IPAM: dockerNetwork.IPAM{
- Driver: "default",
+ Driver: dockerDriver,
Options: map[string]string{},
Config: ipamConfigs,
},
- Internal: !bridge.IsGW,
+ Internal: isInternal,
Attachable: false,
Ingress: false,
ConfigFrom: dockerNetwork.ConfigReference{},
@@ -166,23 +179,19 @@ func getNetworkResourceByNameOrID(nameOrID string, runtime *libpod.Runtime, filt
return &report, nil
}
-func genericPluginsToBridge(plugins []*libcni.NetworkConfig, pluginType string) (network.HostLocalBridge, error) {
- var bridge network.HostLocalBridge
- generic, err := findPluginByName(plugins, pluginType)
- if err != nil {
- return bridge, err
- }
- err = json.Unmarshal(generic, &bridge)
- return bridge, err
-}
+func getPlugin(plugins []*libcni.NetworkConfig) (pluginInterface, error) {
+ var plugin pluginInterface
-func findPluginByName(plugins []*libcni.NetworkConfig, pluginType string) ([]byte, error) {
for _, p := range plugins {
- if pluginType == p.Network.Type {
- return p.Bytes, nil
+ for _, pluginType := range network.SupportedNetworkDrivers {
+ if pluginType == p.Network.Type {
+ err := json.Unmarshal(p.Bytes, &plugin)
+ return plugin, err
+ }
}
}
- return nil, errors.New("unable to find bridge plugin")
+
+ return plugin, errors.New("unable to find supported plugin")
}
func ListNetworks(w http.ResponseWriter, r *http.Request) {
diff --git a/pkg/api/handlers/types.go b/pkg/api/handlers/types.go
index ee157cb56..59f948567 100644
--- a/pkg/api/handlers/types.go
+++ b/pkg/api/handlers/types.go
@@ -232,27 +232,32 @@ func ImageDataToImageInspect(ctx context.Context, l *libimage.Image) (*ImageInsp
Name: info.GraphDriver.Name,
Data: info.GraphDriver.Data,
}
+ // Add in basic ContainerConfig to satisfy docker-compose
+ cc := new(dockerContainer.Config)
+ cc.Hostname = info.ID[0:11] // short ID is the hostname
+ cc.Volumes = info.Config.Volumes
+
dockerImageInspect := docker.ImageInspect{
- Architecture: info.Architecture,
- Author: info.Author,
- Comment: info.Comment,
- Config: &config,
- Created: l.Created().Format(time.RFC3339Nano),
- DockerVersion: info.Version,
- GraphDriver: graphDriver,
- ID: "sha256:" + l.ID(),
- Metadata: docker.ImageMetadata{},
- Os: info.Os,
- OsVersion: info.Version,
- Parent: info.Parent,
- RepoDigests: info.RepoDigests,
- RepoTags: info.RepoTags,
- RootFS: rootfs,
- Size: info.Size,
- Variant: "",
- VirtualSize: info.VirtualSize,
+ Architecture: info.Architecture,
+ Author: info.Author,
+ Comment: info.Comment,
+ Config: &config,
+ ContainerConfig: cc,
+ Created: l.Created().Format(time.RFC3339Nano),
+ DockerVersion: info.Version,
+ GraphDriver: graphDriver,
+ ID: "sha256:" + l.ID(),
+ Metadata: docker.ImageMetadata{},
+ Os: info.Os,
+ OsVersion: info.Version,
+ Parent: info.Parent,
+ RepoDigests: info.RepoDigests,
+ RepoTags: info.RepoTags,
+ RootFS: rootfs,
+ Size: info.Size,
+ Variant: "",
+ VirtualSize: info.VirtualSize,
}
- // TODO: consider filling the container config.
return &ImageInspect{dockerImageInspect}, nil
}
diff --git a/pkg/autoupdate/autoupdate.go b/pkg/autoupdate/autoupdate.go
index 0a13e7e74..c51e2cd03 100644
--- a/pkg/autoupdate/autoupdate.go
+++ b/pkg/autoupdate/autoupdate.go
@@ -9,12 +9,13 @@ import (
"github.com/containers/common/pkg/config"
"github.com/containers/image/v5/docker"
"github.com/containers/image/v5/docker/reference"
- "github.com/containers/image/v5/manifest"
"github.com/containers/image/v5/transports/alltransports"
"github.com/containers/podman/v3/libpod"
"github.com/containers/podman/v3/libpod/define"
+ "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/systemd"
systemdDefine "github.com/containers/podman/v3/pkg/systemd/define"
+ "github.com/coreos/go-systemd/v22/dbus"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
@@ -74,12 +75,6 @@ func LookupPolicy(s string) (Policy, error) {
return "", errors.Errorf("invalid auto-update policy %q: valid policies are %+q", s, keys)
}
-// Options include parameters for auto updates.
-type Options struct {
- // Authfile to use when contacting registries.
- Authfile string
-}
-
// ValidateImageReference checks if the specified imageName is a fully-qualified
// image reference to the docker transport (without digest). Such a reference
// includes a domain, name and tag (e.g., quay.io/podman/stable:latest). The
@@ -119,7 +114,7 @@ func ValidateImageReference(imageName string) error {
//
// It returns a slice of successfully restarted systemd units and a slice of
// errors encountered during auto update.
-func AutoUpdate(runtime *libpod.Runtime, options Options) ([]string, []error) {
+func AutoUpdate(ctx context.Context, runtime *libpod.Runtime, options entities.AutoUpdateOptions) ([]*entities.AutoUpdateReport, []error) {
// Create a map from `image ID -> []*Container`.
containerMap, errs := imageContainersMap(runtime)
if len(containerMap) == 0 {
@@ -130,7 +125,7 @@ func AutoUpdate(runtime *libpod.Runtime, options Options) ([]string, []error) {
listOptions := &libimage.ListImagesOptions{
Filters: []string{"readonly=false"},
}
- imagesSlice, err := runtime.LibimageRuntime().ListImages(context.Background(), nil, listOptions)
+ imagesSlice, err := runtime.LibimageRuntime().ListImages(ctx, nil, listOptions)
if err != nil {
return nil, []error{err}
}
@@ -147,8 +142,8 @@ func AutoUpdate(runtime *libpod.Runtime, options Options) ([]string, []error) {
}
defer conn.Close()
- // Update images.
- containersToRestart := []*libpod.Container{}
+ // Update all images/container according to their auto-update policy.
+ var allReports []*entities.AutoUpdateReport
updatedRawImages := make(map[string]bool)
for imageID, policyMapper := range containerMap {
image, exists := imageMap[imageID]
@@ -156,76 +151,149 @@ func AutoUpdate(runtime *libpod.Runtime, options Options) ([]string, []error) {
errs = append(errs, errors.Errorf("container image ID %q not found in local storage", imageID))
return nil, errs
}
- // Now we have to check if the image of any containers must be updated.
- // Note that the image ID is NOT enough for this check as a given image
- // may have multiple tags.
- for _, registryCtr := range policyMapper[PolicyRegistryImage] {
- cid := registryCtr.ID()
- rawImageName := registryCtr.RawImageName()
- if rawImageName == "" {
- errs = append(errs, errors.Errorf("error registry auto-updating container %q: raw-image name is empty", cid))
- }
- readAuthenticationPath(registryCtr, options)
- needsUpdate, err := newerRemoteImageAvailable(runtime, image, rawImageName, options)
+
+ for _, ctr := range policyMapper[PolicyRegistryImage] {
+ report, err := autoUpdateRegistry(ctx, image, ctr, updatedRawImages, &options, conn, runtime)
if err != nil {
- errs = append(errs, errors.Wrapf(err, "error registry auto-updating container %q: image check for %q failed", cid, rawImageName))
- continue
+ errs = append(errs, err)
}
-
- if needsUpdate {
- logrus.Infof("Auto-updating container %q using registry image %q", cid, rawImageName)
- if _, updated := updatedRawImages[rawImageName]; !updated {
- _, err = updateImage(runtime, rawImageName, options)
- if err != nil {
- errs = append(errs, errors.Wrapf(err, "error registry auto-updating container %q: image update for %q failed", cid, rawImageName))
- continue
- }
- updatedRawImages[rawImageName] = true
- }
- containersToRestart = append(containersToRestart, registryCtr)
+ if report != nil {
+ allReports = append(allReports, report)
}
}
- for _, localCtr := range policyMapper[PolicyLocalImage] {
- cid := localCtr.ID()
- rawImageName := localCtr.RawImageName()
- if rawImageName == "" {
- errs = append(errs, errors.Errorf("error locally auto-updating container %q: raw-image name is empty", cid))
- }
- // This avoids restarting containers unnecessarily.
- needsUpdate, err := newerLocalImageAvailable(runtime, image, rawImageName)
+ for _, ctr := range policyMapper[PolicyLocalImage] {
+ report, err := autoUpdateLocally(ctx, image, ctr, &options, conn, runtime)
if err != nil {
- errs = append(errs, errors.Wrapf(err, "error locally auto-updating container %q: image check for %q failed", cid, rawImageName))
- continue
+ errs = append(errs, err)
}
-
- if needsUpdate {
- logrus.Infof("Auto-updating container %q using local image %q", cid, rawImageName)
- containersToRestart = append(containersToRestart, localCtr)
+ if report != nil {
+ allReports = append(allReports, report)
}
}
}
- // Restart containers.
- updatedUnits := []string{}
- for _, ctr := range containersToRestart {
- labels := ctr.Labels()
- unit, exists := labels[systemdDefine.EnvVariable]
- if !exists {
- // Shouldn't happen but let's be sure of it.
- errs = append(errs, errors.Errorf("error auto-updating container %q: no %s label found", ctr.ID(), systemdDefine.EnvVariable))
- continue
- }
- _, err := conn.RestartUnit(unit, "replace", nil)
- if err != nil {
- errs = append(errs, errors.Wrapf(err, "error auto-updating container %q: restarting systemd unit %q failed", ctr.ID(), unit))
- continue
+ return allReports, errs
+}
+
+// autoUpdateRegistry updates the image/container according to the "registry" policy.
+func autoUpdateRegistry(ctx context.Context, image *libimage.Image, ctr *libpod.Container, updatedRawImages map[string]bool, options *entities.AutoUpdateOptions, conn *dbus.Conn, runtime *libpod.Runtime) (*entities.AutoUpdateReport, error) {
+ cid := ctr.ID()
+ rawImageName := ctr.RawImageName()
+ if rawImageName == "" {
+ return nil, errors.Errorf("error registry auto-updating container %q: raw-image name is empty", cid)
+ }
+
+ labels := ctr.Labels()
+ unit, exists := labels[systemdDefine.EnvVariable]
+ if !exists {
+ return nil, errors.Errorf("error auto-updating container %q: no %s label found", ctr.ID(), systemdDefine.EnvVariable)
+ }
+
+ report := &entities.AutoUpdateReport{
+ ContainerID: cid,
+ ContainerName: ctr.Name(),
+ ImageName: rawImageName,
+ Policy: PolicyRegistryImage,
+ SystemdUnit: unit,
+ Updated: "failed",
+ }
+
+ if _, updated := updatedRawImages[rawImageName]; updated {
+ logrus.Infof("Auto-updating container %q using registry image %q", cid, rawImageName)
+ if err := restartSystemdUnit(ctr, unit, conn); err != nil {
+ return report, err
}
- logrus.Infof("Successfully restarted systemd unit %q", unit)
- updatedUnits = append(updatedUnits, unit)
+ report.Updated = "true"
+ return report, nil
+ }
+
+ authfile := getAuthfilePath(ctr, options)
+ needsUpdate, err := newerRemoteImageAvailable(ctx, runtime, image, rawImageName, authfile)
+ if err != nil {
+ return report, errors.Wrapf(err, "error registry auto-updating container %q: image check for %q failed", cid, rawImageName)
+ }
+
+ if !needsUpdate {
+ report.Updated = "false"
+ return report, nil
+ }
+
+ if options.DryRun {
+ report.Updated = "pending"
+ return report, nil
+ }
+
+ if _, err := updateImage(ctx, runtime, rawImageName, options); err != nil {
+ return report, errors.Wrapf(err, "error registry auto-updating container %q: image update for %q failed", cid, rawImageName)
+ }
+ updatedRawImages[rawImageName] = true
+
+ logrus.Infof("Auto-updating container %q using registry image %q", cid, rawImageName)
+ if err := restartSystemdUnit(ctr, unit, conn); err != nil {
+ return report, err
}
- return updatedUnits, errs
+ report.Updated = "true"
+ return report, nil
+}
+
+// autoUpdateRegistry updates the image/container according to the "local" policy.
+func autoUpdateLocally(ctx context.Context, image *libimage.Image, ctr *libpod.Container, options *entities.AutoUpdateOptions, conn *dbus.Conn, runtime *libpod.Runtime) (*entities.AutoUpdateReport, error) {
+ cid := ctr.ID()
+ rawImageName := ctr.RawImageName()
+ if rawImageName == "" {
+ return nil, errors.Errorf("error locally auto-updating container %q: raw-image name is empty", cid)
+ }
+
+ labels := ctr.Labels()
+ unit, exists := labels[systemdDefine.EnvVariable]
+ if !exists {
+ return nil, errors.Errorf("error auto-updating container %q: no %s label found", ctr.ID(), systemdDefine.EnvVariable)
+ }
+
+ report := &entities.AutoUpdateReport{
+ ContainerID: cid,
+ ContainerName: ctr.Name(),
+ ImageName: rawImageName,
+ Policy: PolicyLocalImage,
+ SystemdUnit: unit,
+ Updated: "failed",
+ }
+
+ needsUpdate, err := newerLocalImageAvailable(runtime, image, rawImageName)
+ if err != nil {
+ return report, errors.Wrapf(err, "error locally auto-updating container %q: image check for %q failed", cid, rawImageName)
+ }
+
+ if !needsUpdate {
+ report.Updated = "false"
+ return report, nil
+ }
+
+ if options.DryRun {
+ report.Updated = "pending"
+ return report, nil
+ }
+
+ logrus.Infof("Auto-updating container %q using local image %q", cid, rawImageName)
+ if err := restartSystemdUnit(ctr, unit, conn); err != nil {
+ return report, err
+ }
+
+ report.Updated = "true"
+ return report, nil
+}
+
+// restartSystemdUnit restarts the systemd unit the container is running in.
+func restartSystemdUnit(ctr *libpod.Container, unit string, conn *dbus.Conn) error {
+ _, err := conn.RestartUnit(unit, "replace", nil)
+ if err != nil {
+ return errors.Wrapf(err, "error auto-updating container %q: restarting systemd unit %q failed", ctr.ID(), unit)
+ }
+
+ logrus.Infof("Successfully restarted systemd unit %q of container %q", unit, ctr.ID())
+ return nil
}
// imageContainersMap generates a map[image ID] -> [containers using the image]
@@ -280,52 +348,25 @@ func imageContainersMap(runtime *libpod.Runtime) (map[string]policyMapper, []err
return containerMap, errors
}
-// readAuthenticationPath reads a container's labels and reads authentication path into options
-func readAuthenticationPath(ctr *libpod.Container, options Options) {
+// getAuthfilePath returns an authfile path, if set. The authfile label in the
+// container, if set, as precedence over the one set in the options.
+func getAuthfilePath(ctr *libpod.Container, options *entities.AutoUpdateOptions) string {
labels := ctr.Labels()
authFilePath, exists := labels[AuthfileLabel]
if exists {
- options.Authfile = authFilePath
+ return authFilePath
}
+ return options.Authfile
}
// newerRemoteImageAvailable returns true if there corresponding image on the remote
// registry is newer.
-func newerRemoteImageAvailable(runtime *libpod.Runtime, img *libimage.Image, origName string, options Options) (bool, error) {
+func newerRemoteImageAvailable(ctx context.Context, runtime *libpod.Runtime, img *libimage.Image, origName string, authfile string) (bool, error) {
remoteRef, err := docker.ParseReference("//" + origName)
if err != nil {
return false, err
}
-
- data, err := img.Inspect(context.Background(), false)
- if err != nil {
- return false, err
- }
-
- sys := runtime.SystemContext()
- sys.AuthFilePath = options.Authfile
-
- // We need to account for the arch that the image uses. It seems
- // common on ARM to tweak this option to pull the correct image. See
- // github.com/containers/podman/issues/6613.
- sys.ArchitectureChoice = data.Architecture
-
- remoteImg, err := remoteRef.NewImage(context.Background(), sys)
- if err != nil {
- return false, err
- }
-
- rawManifest, _, err := remoteImg.Manifest(context.Background())
- if err != nil {
- return false, err
- }
-
- remoteDigest, err := manifest.Digest(rawManifest)
- if err != nil {
- return false, err
- }
-
- return img.Digest().String() != remoteDigest.String(), nil
+ return img.HasDifferentDigest(ctx, remoteRef)
}
// newerLocalImageAvailable returns true if the container and local image have different digests
@@ -334,21 +375,16 @@ func newerLocalImageAvailable(runtime *libpod.Runtime, img *libimage.Image, rawI
if err != nil {
return false, err
}
-
- localDigest := localImg.Digest().String()
-
- ctrDigest := img.Digest().String()
-
- return localDigest != ctrDigest, nil
+ return localImg.Digest().String() != img.Digest().String(), nil
}
// updateImage pulls the specified image.
-func updateImage(runtime *libpod.Runtime, name string, options Options) (*libimage.Image, error) {
+func updateImage(ctx context.Context, runtime *libpod.Runtime, name string, options *entities.AutoUpdateOptions) (*libimage.Image, error) {
pullOptions := &libimage.PullOptions{}
pullOptions.AuthFilePath = options.Authfile
pullOptions.Writer = os.Stderr
- pulledImages, err := runtime.LibimageRuntime().Pull(context.Background(), name, config.PullPolicyAlways, pullOptions)
+ pulledImages, err := runtime.LibimageRuntime().Pull(ctx, name, config.PullPolicyAlways, pullOptions)
if err != nil {
return nil, err
}
diff --git a/pkg/bindings/README.md b/pkg/bindings/README.md
index 6fd7d7831..f41304e0f 100644
--- a/pkg/bindings/README.md
+++ b/pkg/bindings/README.md
@@ -154,3 +154,80 @@ func main() {
fmt.Println("Container started.")
}
```
+
+## Debugging tips <a name="debugging-tips"></a>
+
+To debug in a development setup, you can start the Podman system service
+in debug mode like:
+
+```bash
+$ podman --log-level=debug system service -t 0
+```
+
+The `--log-level=debug` echoes all the logged requests and is useful to
+trace the execution path at a finer granularity. A snippet of a sample run looks like:
+
+```bash
+INFO[0000] podman filtering at log level debug
+DEBU[0000] Called service.PersistentPreRunE(podman --log-level=debug system service -t0)
+DEBU[0000] Ignoring libpod.conf EventsLogger setting "/home/lsm5/.config/containers/containers.conf". Use "journald" if you want to change this setting and remove libpod.conf files.
+DEBU[0000] Reading configuration file "/usr/share/containers/containers.conf"
+DEBU[0000] Merged system config "/usr/share/containers/containers.conf": {Editors note: the remainder of this line was removed due to Jekyll formatting errors.}
+DEBU[0000] Using conmon: "/usr/bin/conmon"
+DEBU[0000] Initializing boltdb state at /home/lsm5/.local/share/containers/storage/libpod/bolt_state.db
+DEBU[0000] Overriding run root "/run/user/1000/containers" with "/run/user/1000" from database
+DEBU[0000] Using graph driver overlay
+DEBU[0000] Using graph root /home/lsm5/.local/share/containers/storage
+DEBU[0000] Using run root /run/user/1000
+DEBU[0000] Using static dir /home/lsm5/.local/share/containers/storage/libpod
+DEBU[0000] Using tmp dir /run/user/1000/libpod/tmp
+DEBU[0000] Using volume path /home/lsm5/.local/share/containers/storage/volumes
+DEBU[0000] Set libpod namespace to ""
+DEBU[0000] Not configuring container store
+DEBU[0000] Initializing event backend file
+DEBU[0000] using runtime "/usr/bin/runc"
+DEBU[0000] using runtime "/usr/bin/crun"
+WARN[0000] Error initializing configured OCI runtime kata: no valid executable found for OCI runtime kata: invalid argument
+DEBU[0000] using runtime "/usr/bin/crun"
+INFO[0000] Setting parallel job count to 25
+INFO[0000] podman filtering at log level debug
+DEBU[0000] Called service.PersistentPreRunE(podman --log-level=debug system service -t0)
+DEBU[0000] Ignoring libpod.conf EventsLogger setting "/home/lsm5/.config/containers/containers.conf". Use "journald" if you want to change this setting and remove libpod.conf files.
+DEBU[0000] Reading configuration file "/usr/share/containers/containers.conf"
+```
+
+If the Podman system service has been started via systemd socket activation,
+you can view the logs using journalctl. The logs after a sample run look like:
+
+```bash
+$ journalctl --user --no-pager -u podman.socket
+-- Reboot --
+Jul 22 13:50:40 nagato.nanadai.me systemd[1048]: Listening on Podman API Socket.
+$
+```
+
+```bash
+$ journalctl --user --no-pager -u podman.service
+Jul 22 13:50:53 nagato.nanadai.me systemd[1048]: Starting Podman API Service...
+Jul 22 13:50:54 nagato.nanadai.me podman[1527]: time="2020-07-22T13:50:54-04:00" level=error msg="Error refreshing volume 38480630a8bdaa3e1a0ebd34c94038591b0d7ad994b37be5b4f2072bb6ef0879: error acquiring lock 0 for volume 38480630a8bdaa3e1a0ebd34c94038591b0d7ad994b37be5b4f2072bb6ef0879: file exists"
+Jul 22 13:50:54 nagato.nanadai.me podman[1527]: time="2020-07-22T13:50:54-04:00" level=error msg="Error refreshing volume 47d410af4d762a0cc456a89e58f759937146fa3be32b5e95a698a1d4069f4024: error acquiring lock 0 for volume 47d410af4d762a0cc456a89e58f759937146fa3be32b5e95a698a1d4069f4024: file exists"
+Jul 22 13:50:54 nagato.nanadai.me podman[1527]: time="2020-07-22T13:50:54-04:00" level=error msg="Error refreshing volume 86e73f082e344dad38c8792fb86b2017c4f133f2a8db87f239d1d28a78cf0868: error acquiring lock 0 for volume 86e73f082e344dad38c8792fb86b2017c4f133f2a8db87f239d1d28a78cf0868: file exists"
+Jul 22 13:50:54 nagato.nanadai.me podman[1527]: time="2020-07-22T13:50:54-04:00" level=error msg="Error refreshing volume 9a16ea764be490a5563e384d9074ab0495e4d9119be380c664037d6cf1215631: error acquiring lock 0 for volume 9a16ea764be490a5563e384d9074ab0495e4d9119be380c664037d6cf1215631: file exists"
+Jul 22 13:50:54 nagato.nanadai.me podman[1527]: time="2020-07-22T13:50:54-04:00" level=error msg="Error refreshing volume bfd6b2a97217f8655add13e0ad3f6b8e1c79bc1519b7a1e15361a107ccf57fc0: error acquiring lock 0 for volume bfd6b2a97217f8655add13e0ad3f6b8e1c79bc1519b7a1e15361a107ccf57fc0: file exists"
+Jul 22 13:50:54 nagato.nanadai.me podman[1527]: time="2020-07-22T13:50:54-04:00" level=error msg="Error refreshing volume f9b9f630982452ebcbed24bd229b142fbeecd5d4c85791fca440b21d56fef563: error acquiring lock 0 for volume f9b9f630982452ebcbed24bd229b142fbeecd5d4c85791fca440b21d56fef563: file exists"
+Jul 22 13:50:54 nagato.nanadai.me podman[1527]: Trying to pull registry.fedoraproject.org/fedora:latest...
+Jul 22 13:50:55 nagato.nanadai.me podman[1527]: Getting image source signatures
+Jul 22 13:50:55 nagato.nanadai.me podman[1527]: Copying blob sha256:dd9f43919ba05f05d4f783c31e83e5e776c4f5d29dd72b9ec5056b9576c10053
+Jul 22 13:50:55 nagato.nanadai.me podman[1527]: Copying config sha256:00ff39a8bf19f810a7e641f7eb3ddc47635913a19c4996debd91fafb6b379069
+Jul 22 13:50:55 nagato.nanadai.me podman[1527]: Writing manifest to image destination
+Jul 22 13:50:55 nagato.nanadai.me podman[1527]: Storing signatures
+Jul 22 13:50:55 nagato.nanadai.me systemd[1048]: podman.service: unit configures an IP firewall, but not running as root.
+Jul 22 13:50:55 nagato.nanadai.me systemd[1048]: (This warning is only shown for the first unit using IP firewalling.)
+Jul 22 13:51:15 nagato.nanadai.me systemd[1048]: podman.service: Succeeded.
+Jul 22 13:51:15 nagato.nanadai.me systemd[1048]: Finished Podman API Service.
+Jul 22 13:51:15 nagato.nanadai.me systemd[1048]: podman.service: Consumed 1.339s CPU time.
+$
+```
+
+You can also verify that the information being passed back and forth is correct by putting
+with a tool like `socat`, which can dump what the socket is seeing.
diff --git a/pkg/bindings/containers/attach.go b/pkg/bindings/containers/attach.go
index cc12c8ab7..01c14d350 100644
--- a/pkg/bindings/containers/attach.go
+++ b/pkg/bindings/containers/attach.go
@@ -25,6 +25,12 @@ import (
"golang.org/x/crypto/ssh/terminal"
)
+// The CloseWriter interface is used to determine whether we can do a one-sided
+// close of a hijacked connection.
+type CloseWriter interface {
+ CloseWrite() error
+}
+
// Attach attaches to a running container
func Attach(ctx context.Context, nameOrID string, stdin io.Reader, stdout io.Writer, stderr io.Writer, attachReady chan bool, options *AttachOptions) error {
if options == nil {
@@ -161,6 +167,12 @@ func Attach(ctx context.Context, nameOrID string, stdin io.Reader, stdout io.Wri
logrus.Error("failed to write input to service: " + err.Error())
}
stdinChan <- err
+
+ if closeWrite, ok := socket.(CloseWriter); ok {
+ if err := closeWrite.CloseWrite(); err != nil {
+ logrus.Warnf("Failed to close STDIN for writing: %v", err)
+ }
+ }
}()
}
@@ -485,6 +497,13 @@ func ExecStartAndAttach(ctx context.Context, sessionID string, options *ExecStar
if err != nil {
logrus.Error("failed to write input to service: " + err.Error())
}
+
+ if closeWrite, ok := socket.(CloseWriter); ok {
+ logrus.Debugf("Closing STDIN")
+ if err := closeWrite.CloseWrite(); err != nil {
+ logrus.Warnf("Failed to close STDIN for writing: %v", err)
+ }
+ }
}()
}
diff --git a/pkg/bindings/images/build.go b/pkg/bindings/images/build.go
index 95d9d4df7..142204f27 100644
--- a/pkg/bindings/images/build.go
+++ b/pkg/bindings/images/build.go
@@ -301,6 +301,8 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
tarContent := []string{options.ContextDirectory}
newContainerFiles := []string{}
+
+ dontexcludes := []string{"!Dockerfile", "!Containerfile", "!.dockerignore", "!.containerignore"}
for _, c := range containerFiles {
if c == "/dev/stdin" {
content, err := ioutil.ReadAll(os.Stdin)
@@ -328,6 +330,7 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
// Do NOT add to tarfile
if strings.HasPrefix(containerfile, contextDir+string(filepath.Separator)) {
containerfile = strings.TrimPrefix(containerfile, contextDir+string(filepath.Separator))
+ dontexcludes = append(dontexcludes, "!"+containerfile)
} else {
// If Containerfile does not exists assume it is in context directory, do Not add to tarfile
if _, err := os.Lstat(containerfile); err != nil {
@@ -349,8 +352,7 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
}
params.Set("dockerfile", string(cFileJSON))
}
-
- tarfile, err := nTar(excludes, tarContent...)
+ tarfile, err := nTar(append(excludes, dontexcludes...), tarContent...)
if err != nil {
logrus.Errorf("cannot tar container entries %v error: %v", tarContent, err)
return nil, err
@@ -548,9 +550,13 @@ func nTar(excludes []string, sources ...string) (io.ReadCloser, error) {
}
func parseDockerignore(root string) ([]string, error) {
- ignore, err := ioutil.ReadFile(filepath.Join(root, ".dockerignore"))
- if err != nil && !os.IsNotExist(err) {
- return nil, errors.Wrapf(err, "error reading .dockerignore: '%s'", root)
+ ignore, err := ioutil.ReadFile(filepath.Join(root, ".containerignore"))
+ if err != nil {
+ var dockerIgnoreErr error
+ ignore, dockerIgnoreErr = ioutil.ReadFile(filepath.Join(root, ".dockerignore"))
+ if dockerIgnoreErr != nil && !os.IsNotExist(dockerIgnoreErr) {
+ return nil, errors.Wrapf(err, "error reading .containerignore: '%s'", root)
+ }
}
rawexcludes := strings.Split(string(ignore), "\n")
excludes := make([]string, 0, len(rawexcludes))
diff --git a/pkg/domain/entities/auto-update.go b/pkg/domain/entities/auto-update.go
index c51158816..eed617bf8 100644
--- a/pkg/domain/entities/auto-update.go
+++ b/pkg/domain/entities/auto-update.go
@@ -4,10 +4,25 @@ package entities
type AutoUpdateOptions struct {
// Authfile to use when contacting registries.
Authfile string
+ // Only check for but do not perform any update. If an update is
+ // pending, it will be indicated in the Updated field of
+ // AutoUpdateReport.
+ DryRun bool
}
// AutoUpdateReport contains the results from running auto-update.
type AutoUpdateReport struct {
- // Units - the restarted systemd units during auto-update.
- Units []string
+ // ID of the container *before* an update.
+ ContainerID string
+ // Name of the container *before* an update.
+ ContainerName string
+ // Name of the image.
+ ImageName string
+ // The configured auto-update policy.
+ Policy string
+ // SystemdUnit running a container configured for auto updates.
+ SystemdUnit string
+ // Indicates the update status: true, false, failed, pending (see
+ // DryRun).
+ Updated string
}
diff --git a/pkg/domain/entities/engine_container.go b/pkg/domain/entities/engine_container.go
index 28e5160db..62e83fab3 100644
--- a/pkg/domain/entities/engine_container.go
+++ b/pkg/domain/entities/engine_container.go
@@ -14,7 +14,7 @@ import (
type ContainerCopyFunc func() error
type ContainerEngine interface {
- AutoUpdate(ctx context.Context, options AutoUpdateOptions) (*AutoUpdateReport, []error)
+ AutoUpdate(ctx context.Context, options AutoUpdateOptions) ([]*AutoUpdateReport, []error)
Config(ctx context.Context) (*config.Config, error)
ContainerAttach(ctx context.Context, nameOrID string, options AttachOptions) error
ContainerCheckpoint(ctx context.Context, namesOrIds []string, options CheckpointOptions) ([]*CheckpointReport, error)
diff --git a/pkg/domain/infra/abi/auto-update.go b/pkg/domain/infra/abi/auto-update.go
index c9d7f2130..b98ee1cb2 100644
--- a/pkg/domain/infra/abi/auto-update.go
+++ b/pkg/domain/infra/abi/auto-update.go
@@ -7,11 +7,6 @@ import (
"github.com/containers/podman/v3/pkg/domain/entities"
)
-func (ic *ContainerEngine) AutoUpdate(ctx context.Context, options entities.AutoUpdateOptions) (*entities.AutoUpdateReport, []error) {
- // Convert the entities options to the autoupdate ones. We can't use
- // them in the entities package as low-level packages must not leak
- // into the remote client.
- autoOpts := autoupdate.Options{Authfile: options.Authfile}
- units, failures := autoupdate.AutoUpdate(ic.Libpod, autoOpts)
- return &entities.AutoUpdateReport{Units: units}, failures
+func (ic *ContainerEngine) AutoUpdate(ctx context.Context, options entities.AutoUpdateOptions) ([]*entities.AutoUpdateReport, []error) {
+ return autoupdate.AutoUpdate(ctx, ic.Libpod, options)
}
diff --git a/pkg/domain/infra/abi/system.go b/pkg/domain/infra/abi/system.go
index ebe59e871..155cda21d 100644
--- a/pkg/domain/infra/abi/system.go
+++ b/pkg/domain/infra/abi/system.go
@@ -403,6 +403,8 @@ func (ic *ContainerEngine) Unshare(ctx context.Context, args []string, options e
if err != nil {
return err
}
+ // make sure to unlock, unshare can run for a long time
+ rootlesscni.Lock.Unlock()
defer rootlesscni.Cleanup(ic.Libpod)
return rootlesscni.Do(unshare)
}
diff --git a/pkg/domain/infra/tunnel/auto-update.go b/pkg/domain/infra/tunnel/auto-update.go
index 41165cc74..038c60537 100644
--- a/pkg/domain/infra/tunnel/auto-update.go
+++ b/pkg/domain/infra/tunnel/auto-update.go
@@ -7,6 +7,6 @@ import (
"github.com/pkg/errors"
)
-func (ic *ContainerEngine) AutoUpdate(ctx context.Context, options entities.AutoUpdateOptions) (*entities.AutoUpdateReport, []error) {
+func (ic *ContainerEngine) AutoUpdate(ctx context.Context, options entities.AutoUpdateOptions) ([]*entities.AutoUpdateReport, []error) {
return nil, []error{errors.New("not implemented")}
}
diff --git a/pkg/systemd/generate/containers.go b/pkg/systemd/generate/containers.go
index 0e6e1b4df..083520316 100644
--- a/pkg/systemd/generate/containers.go
+++ b/pkg/systemd/generate/containers.go
@@ -160,16 +160,11 @@ func generateContainerInfo(ctr *libpod.Container, options entities.GenerateSyste
nameOrID, serviceName := containerServiceName(ctr, options)
- store := ctr.Runtime().GetStore()
- if store == nil {
- return nil, errors.Errorf("could not determine storage store for container")
- }
-
var runRoot string
if options.New {
runRoot = "%t/containers"
} else {
- runRoot = store.RunRoot()
+ runRoot = ctr.Runtime().RunRoot()
if runRoot == "" {
return nil, errors.Errorf("could not lookup container's runroot: got empty string")
}
diff --git a/test/apiv2/20-containers.at b/test/apiv2/20-containers.at
index ef51757c9..c5b2f5ec1 100644
--- a/test/apiv2/20-containers.at
+++ b/test/apiv2/20-containers.at
@@ -211,15 +211,11 @@ t GET containers/$cid/json 200 \
t POST containers/create Image=$IMAGE Entrypoint='["top"]' 201 \
.Id~[0-9a-f]\\{64\\}
cid_top=$(jq -r '.Id' <<<"$output")
-network_expect="{}"
-if root; then
- network_expect='.podman.NetworkID=podman'
-fi
t GET containers/${cid_top}/json 200 \
.Config.Entrypoint[0]="top" \
.Config.Cmd='[]' \
- .Path="top"
- .NetworkSettings.Networks="$network_expect"
+ .Path="top" \
+ .NetworkSettings.Networks.podman.NetworkID=podman
t POST containers/${cid_top}/start 204
# make sure the container is running
t GET containers/${cid_top}/json 200 \
diff --git a/test/apiv2/30-volumes.at b/test/apiv2/30-volumes.at
index 5feceea7b..b639e05f9 100644
--- a/test/apiv2/30-volumes.at
+++ b/test/apiv2/30-volumes.at
@@ -13,13 +13,14 @@ t POST libpod/volumes/create name=foo1 201 \
.CreatedAt~[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}.* \
.Labels={} \
.Options={}
+# TODO(mwhahaha): there might be a bug here since options is null and not {}
t POST volumes/create 201 \
- .Name~[0-9a-f]\\{64\\}
+ .Name~[0-9a-f]\\{64\\} \
.Driver=local \
- .Mountpoint=$volumepath/~[0-9a-f]\\{64\\}/_data \
+ .Mountpoint~$volumepath/[0-9a-f]\\{64\\}/_data \
.CreatedAt~[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}.* \
.Labels={} \
- .Options={}
+ .Options=null
t POST libpod/volumes/create 201
t POST libpod/volumes/create \
Name=foo2 \
diff --git a/test/apiv2/35-networks.at b/test/apiv2/35-networks.at
index 59947faac..7a36b605f 100644
--- a/test/apiv2/35-networks.at
+++ b/test/apiv2/35-networks.at
@@ -142,4 +142,18 @@ t GET networks?filters='{"label":["zaq"]}' 200 length=1
t POST networks/prune?filters='{"until":["5000000000"]}' 200
t GET networks?filters='{"label":["zaq"]}' 200 length=0
+# test macvlan network response
+podman network create --driver macvlan macvlan1
+
+# libpod api inspect the macvlan network
+t GET libpod/networks/macvlan1/json 200 .name="macvlan1"
+
+# compat api inspect the macvlan network
+t GET networks/macvlan1 200 .Name="macvlan1"
+
+# clean the macvlan network
+t DELETE libpod/networks/macvlan1 200 \
+ .[0].Name~macvlan1 \
+ .[0].Err=null
+
# vim: filetype=sh
diff --git a/test/apiv2/python/rest_api/test_v2_0_0_container.py b/test/apiv2/python/rest_api/test_v2_0_0_container.py
index 2fab4aeb9..f252bd401 100644
--- a/test/apiv2/python/rest_api/test_v2_0_0_container.py
+++ b/test/apiv2/python/rest_api/test_v2_0_0_container.py
@@ -1,5 +1,6 @@
import random
import unittest
+import json
import requests
from dateutil.parser import parse
@@ -97,6 +98,18 @@ class ContainerTestCase(APITestCase):
def test_logs(self):
r = requests.get(self.uri(self.resolve_container("/containers/{}/logs?stdout=true")))
self.assertEqual(r.status_code, 200, r.text)
+ r = requests.post(
+ self.podman_url + "/v1.40/containers/create?name=topcontainer",
+ json={"Cmd": ["top", "ls"], "Image": "alpine:latest"},
+ )
+ self.assertEqual(r.status_code, 201, r.text)
+ payload = r.json()
+ container_id = payload["Id"]
+ self.assertIsNotNone(container_id)
+ r = requests.get(self.podman_url + f"/v1.40/containers/{payload['Id']}/logs?follow=false&stdout=true&until=0")
+ self.assertEqual(r.status_code, 200, r.text)
+ r = requests.get(self.podman_url + f"/v1.40/containers/{payload['Id']}/logs?follow=false&stdout=true&until=1")
+ self.assertEqual(r.status_code, 200, r.text)
def test_commit(self):
r = requests.post(self.uri(self.resolve_container("/commit?container={}")))
diff --git a/test/compose/uptwice/Dockerfile b/test/compose/uptwice/Dockerfile
new file mode 100644
index 000000000..b993af04d
--- /dev/null
+++ b/test/compose/uptwice/Dockerfile
@@ -0,0 +1,2 @@
+FROM alpine
+WORKDIR /app
diff --git a/test/compose/uptwice/docker-compose.yml b/test/compose/uptwice/docker-compose.yml
new file mode 100644
index 000000000..e06f9e554
--- /dev/null
+++ b/test/compose/uptwice/docker-compose.yml
@@ -0,0 +1,5 @@
+version: '3'
+services:
+ app:
+ build: .
+ command: sleep 10002
diff --git a/test/compose/uptwice/tests.sh b/test/compose/uptwice/tests.sh
new file mode 100644
index 000000000..291694d83
--- /dev/null
+++ b/test/compose/uptwice/tests.sh
@@ -0,0 +1,4 @@
+# -*- bash -*-
+
+sed -i -e 's/10001/10002/' docker-compose.yml
+docker-compose up -d
diff --git a/test/e2e/attach_test.go b/test/e2e/attach_test.go
index 146ff27a5..5843462f2 100644
--- a/test/e2e/attach_test.go
+++ b/test/e2e/attach_test.go
@@ -8,6 +8,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman attach", func() {
@@ -36,48 +37,48 @@ var _ = Describe("Podman attach", func() {
It("podman attach to bogus container", func() {
session := podmanTest.Podman([]string{"attach", "foobar"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
It("podman attach to non-running container", func() {
session := podmanTest.Podman([]string{"create", "--name", "test1", "-i", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
results := podmanTest.Podman([]string{"attach", "test1"})
results.WaitWithDefaultTimeout()
- Expect(results.ExitCode()).To(Equal(125))
+ Expect(results).Should(Exit(125))
})
It("podman container attach to non-running container", func() {
session := podmanTest.Podman([]string{"container", "create", "--name", "test1", "-i", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
results := podmanTest.Podman([]string{"container", "attach", "test1"})
results.WaitWithDefaultTimeout()
- Expect(results.ExitCode()).To(Equal(125))
+ Expect(results).Should(Exit(125))
})
It("podman attach to multiple containers", func() {
session := podmanTest.RunTopContainer("test1")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.RunTopContainer("test2")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
results := podmanTest.Podman([]string{"attach", "test1", "test2"})
results.WaitWithDefaultTimeout()
- Expect(results.ExitCode()).To(Equal(125))
+ Expect(results).Should(Exit(125))
})
It("podman attach to a running container", func() {
session := podmanTest.Podman([]string{"run", "-d", "--name", "test", ALPINE, "/bin/sh", "-c", "while true; do echo test; sleep 1; done"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
results := podmanTest.Podman([]string{"attach", "test"})
time.Sleep(2 * time.Second)
@@ -88,11 +89,11 @@ var _ = Describe("Podman attach", func() {
It("podman attach to the latest container", func() {
session := podmanTest.Podman([]string{"run", "-d", "--name", "test1", ALPINE, "/bin/sh", "-c", "while true; do echo test1; sleep 1; done"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "-d", "--name", "test2", ALPINE, "/bin/sh", "-c", "while true; do echo test2; sleep 1; done"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := "-l"
if IsRemote() {
@@ -108,7 +109,7 @@ var _ = Describe("Podman attach", func() {
It("podman attach to a container with --sig-proxy set to false", func() {
session := podmanTest.Podman([]string{"run", "-d", "--name", "test", ALPINE, "/bin/sh", "-c", "while true; do echo test; sleep 1; done"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
results := podmanTest.Podman([]string{"attach", "--sig-proxy=false", "test"})
time.Sleep(2 * time.Second)
diff --git a/test/e2e/build_test.go b/test/e2e/build_test.go
index abaacdd5e..aca2b831b 100644
--- a/test/e2e/build_test.go
+++ b/test/e2e/build_test.go
@@ -12,6 +12,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman build", func() {
@@ -42,7 +43,7 @@ var _ = Describe("Podman build", func() {
podmanTest.AddImageToRWStore(ALPINE)
session := podmanTest.Podman([]string{"build", "--pull-never", "build/basicalpine"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
iid := session.OutputToStringArray()[len(session.OutputToStringArray())-1]
@@ -55,14 +56,14 @@ var _ = Describe("Podman build", func() {
session = podmanTest.Podman([]string{"rmi", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman build with logfile", func() {
logfile := filepath.Join(podmanTest.TempDir, "logfile")
session := podmanTest.Podman([]string{"build", "--pull-never", "--tag", "test", "--logfile", logfile, "build/basicalpine"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Verify that OS and Arch are being set
inspect := podmanTest.Podman([]string{"inspect", "test"})
@@ -77,7 +78,7 @@ var _ = Describe("Podman build", func() {
session = podmanTest.Podman([]string{"rmi", "test"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
// If the context directory is pointing at a file and not a directory,
@@ -85,7 +86,7 @@ var _ = Describe("Podman build", func() {
It("podman build context directory a file", func() {
session := podmanTest.Podman([]string{"build", "--pull-never", "build/context_dir_a_file"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
// Check that builds with different values for the squash options
@@ -93,47 +94,47 @@ var _ = Describe("Podman build", func() {
It("podman build basic alpine with squash", func() {
session := podmanTest.Podman([]string{"build", "--pull-never", "-f", "build/squash/Dockerfile.squash-a", "-t", "test-squash-a:latest", "build/squash"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RootFS.Layers}}", "test-squash-a"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Check for two layers
Expect(len(strings.Fields(session.OutputToString()))).To(Equal(2))
session = podmanTest.Podman([]string{"build", "--pull-never", "-f", "build/squash/Dockerfile.squash-b", "--squash", "-t", "test-squash-b:latest", "build/squash"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RootFS.Layers}}", "test-squash-b"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Check for three layers
Expect(len(strings.Fields(session.OutputToString()))).To(Equal(3))
session = podmanTest.Podman([]string{"build", "--pull-never", "-f", "build/squash/Dockerfile.squash-c", "--squash", "-t", "test-squash-c:latest", "build/squash"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RootFS.Layers}}", "test-squash-c"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Check for two layers
Expect(len(strings.Fields(session.OutputToString()))).To(Equal(2))
session = podmanTest.Podman([]string{"build", "--pull-never", "-f", "build/squash/Dockerfile.squash-c", "--squash-all", "-t", "test-squash-d:latest", "build/squash"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RootFS.Layers}}", "test-squash-d"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Check for one layers
Expect(len(strings.Fields(session.OutputToString()))).To(Equal(1))
session = podmanTest.Podman([]string{"rm", "-a"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman build Containerfile locations", func() {
@@ -168,7 +169,7 @@ var _ = Describe("Podman build", func() {
session.WaitWithDefaultTimeout()
// Then
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(strings.Fields(session.OutputToString())).
To(ContainElement("scratch"))
})
@@ -188,7 +189,7 @@ var _ = Describe("Podman build", func() {
session := podmanTest.Podman([]string{"build", "--pull-never", "build/basicalpine", "--iidfile", targetFile})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
id, _ := ioutil.ReadFile(targetFile)
// Verify that id is correct
@@ -204,11 +205,11 @@ var _ = Describe("Podman build", func() {
"build", "--pull-never", "-f", "build/basicalpine/Containerfile.path", "-t", "test-path",
})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "test-path", "printenv", "PATH"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
stdoutLines := session.OutputToStringArray()
Expect(stdoutLines[0]).Should(Equal(path))
})
@@ -228,7 +229,7 @@ RUN printenv http_proxy`, ALPINE)
Expect(err).To(BeNil())
session := podmanTest.Podman([]string{"build", "--pull-never", "--http-proxy", "--file", dockerfilePath, podmanTest.TempDir})
session.Wait(120)
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
ok, _ := session.GrepString("1.2.3.4")
Expect(ok).To(BeTrue())
os.Unsetenv("http_proxy")
@@ -237,7 +238,7 @@ RUN printenv http_proxy`, ALPINE)
It("podman build and check identity", func() {
session := podmanTest.Podman([]string{"build", "--pull-never", "-f", "build/basicalpine/Containerfile.path", "--no-cache", "-t", "test", "build/basicalpine"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Verify that OS and Arch are being set
inspect := podmanTest.Podman([]string{"image", "inspect", "--format", "{{ index .Config.Labels }}", "test"})
@@ -282,7 +283,7 @@ RUN find /test`, ALPINE)
session := podmanTest.Podman([]string{"build", "--pull-never", "-t", "test", "-f", "Containerfile", targetSubPath})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
ok, _ := session.GrepString("/test/dummy")
Expect(ok).To(BeTrue())
})
@@ -324,7 +325,7 @@ RUN find /test`, ALPINE)
session := podmanTest.Podman([]string{"build", "--pull-never", "-t", "test", "-f", "subdir/Containerfile", "."})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman remote test .dockerignore", func() {
@@ -388,7 +389,7 @@ subdir**`
session := podmanTest.Podman([]string{"build", "-t", "test", "."})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
ok, _ := session.GrepString("/testfilter/dummy1")
Expect(ok).NotTo(BeTrue())
ok, _ = session.GrepString("/testfilter/dummy2")
@@ -448,7 +449,7 @@ RUN [[ -L /test/dummy-symlink ]] && echo SYMLNKOK || echo SYMLNKERR`, ALPINE)
session := podmanTest.Podman([]string{"build", "--pull-never", "-t", "test", targetSubPath})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
ok, _ := session.GrepString("/test/dummy")
Expect(ok).To(BeTrue())
ok, _ = session.GrepString("/test/emptyDir")
@@ -481,7 +482,7 @@ RUN grep CapEff /proc/self/status`
session.WaitWithDefaultTimeout()
// Then
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(strings.Fields(session.OutputToString())).
To(ContainElement(ALPINE))
Expect(strings.Fields(session.OutputToString())).
@@ -507,7 +508,7 @@ RUN grep CapEff /proc/self/status`
})
session.WaitWithDefaultTimeout()
// Then
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// When
session = podmanTest.Podman([]string{
@@ -515,7 +516,7 @@ RUN grep CapEff /proc/self/status`
})
session.WaitWithDefaultTimeout()
// Then
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// When
session = podmanTest.Podman([]string{
@@ -523,7 +524,7 @@ RUN grep CapEff /proc/self/status`
})
session.WaitWithDefaultTimeout()
// Then
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// When
session = podmanTest.Podman([]string{
@@ -531,7 +532,7 @@ RUN grep CapEff /proc/self/status`
})
session.WaitWithDefaultTimeout()
// Then
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
It("podman build --timestamp flag", func() {
@@ -543,7 +544,7 @@ RUN echo hello`, ALPINE)
Expect(err).To(BeNil())
session := podmanTest.Podman([]string{"build", "--pull-never", "-t", "test", "--timestamp", "0", "--file", containerfilePath, podmanTest.TempDir})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
inspect := podmanTest.Podman([]string{"image", "inspect", "--format", "{{ .Created }}", "test"})
inspect.WaitWithDefaultTimeout()
@@ -561,7 +562,7 @@ RUN echo hello`, ALPINE)
session := podmanTest.Podman([]string{"build", "--log-rusage", "--pull-never", targetPath})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("(system)"))
Expect(session.OutputToString()).To(ContainSubstring("(user)"))
Expect(session.OutputToString()).To(ContainSubstring("(elapsed)"))
@@ -574,7 +575,7 @@ RUN echo hello`, ALPINE)
Expect(err).To(BeNil())
session := podmanTest.Podman([]string{"build", "--pull-never", "-t", "test", "--arch", "foo", "--os", "bar", "--file", containerfilePath, podmanTest.TempDir})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
inspect := podmanTest.Podman([]string{"image", "inspect", "--format", "{{ .Architecture }}", "test"})
inspect.WaitWithDefaultTimeout()
@@ -593,7 +594,7 @@ RUN echo hello`, ALPINE)
Expect(err).To(BeNil())
session := podmanTest.Podman([]string{"build", "--pull-never", "-t", "test", "--os", "windows", "--file", containerfilePath, podmanTest.TempDir})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
inspect := podmanTest.Podman([]string{"image", "inspect", "--format", "{{ .Architecture }}", "test"})
inspect.WaitWithDefaultTimeout()
@@ -616,11 +617,11 @@ RUN ls /dev/fuse`, ALPINE)
Expect(err).To(BeNil())
session := podmanTest.Podman([]string{"build", "--pull-never", "-t", "test", "--file", containerfilePath, podmanTest.TempDir})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
session = podmanTest.Podman([]string{"build", "--pull-never", "--device", "/dev/fuse", "-t", "test", "--file", containerfilePath, podmanTest.TempDir})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman build device rename test", func() {
@@ -632,10 +633,10 @@ RUN ls /dev/test1`, ALPINE)
Expect(err).To(BeNil())
session := podmanTest.Podman([]string{"build", "--pull-never", "-t", "test", "--file", containerfilePath, podmanTest.TempDir})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
session = podmanTest.Podman([]string{"build", "--pull-never", "--device", "/dev/zero:/dev/test1", "-t", "test", "--file", containerfilePath, podmanTest.TempDir})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
})
diff --git a/test/e2e/checkpoint_test.go b/test/e2e/checkpoint_test.go
index 70a1d09ed..b5bbfcd5c 100644
--- a/test/e2e/checkpoint_test.go
+++ b/test/e2e/checkpoint_test.go
@@ -10,6 +10,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
func getRunString(input []string) []string {
@@ -80,20 +81,20 @@ var _ = Describe("Podman checkpoint", func() {
localRunString := getRunString([]string{ALPINE, "top"})
session := podmanTest.Podman(localRunString)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
result := podmanTest.Podman([]string{"container", "checkpoint", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Exited"))
result = podmanTest.Podman([]string{"container", "restore", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
})
@@ -102,19 +103,19 @@ var _ = Describe("Podman checkpoint", func() {
localRunString := getRunString([]string{"--name", "test_name", ALPINE, "top"})
session := podmanTest.Podman(localRunString)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"container", "checkpoint", "test_name"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Exited"))
result = podmanTest.Podman([]string{"container", "restore", "test_name"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
})
@@ -123,36 +124,36 @@ var _ = Describe("Podman checkpoint", func() {
localRunString := getRunString([]string{ALPINE, "top"})
session := podmanTest.Podman(localRunString)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
result := podmanTest.Podman([]string{"container", "checkpoint", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Exited"))
result = podmanTest.Podman([]string{"pause", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(125))
+ Expect(result).Should(Exit(125))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Exited"))
result = podmanTest.Podman([]string{"container", "restore", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
result = podmanTest.Podman([]string{"rm", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(2))
+ Expect(result).Should(Exit(2))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
result = podmanTest.Podman([]string{"rm", "-f", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
@@ -161,36 +162,36 @@ var _ = Describe("Podman checkpoint", func() {
localRunString := getRunString([]string{"--name", "first", ALPINE, "top"})
session1 := podmanTest.Podman(localRunString)
session1.WaitWithDefaultTimeout()
- Expect(session1.ExitCode()).To(Equal(0))
+ Expect(session1).Should(Exit(0))
localRunString = getRunString([]string{"--name", "second", ALPINE, "top"})
session2 := podmanTest.Podman(localRunString)
session2.WaitWithDefaultTimeout()
- Expect(session2.ExitCode()).To(Equal(0))
+ Expect(session2).Should(Exit(0))
result := podmanTest.Podman([]string{"container", "checkpoint", "-l"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
ps := podmanTest.Podman([]string{"ps", "-q", "--no-trunc"})
ps.WaitWithDefaultTimeout()
- Expect(ps.ExitCode()).To(Equal(0))
+ Expect(ps).Should(Exit(0))
Expect(ps.LineInOutputContains(session1.OutputToString())).To(BeTrue())
Expect(ps.LineInOutputContains(session2.OutputToString())).To(BeFalse())
result = podmanTest.Podman([]string{"container", "restore", "-l"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(2))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
Expect(podmanTest.GetContainerStatus()).To(Not(ContainSubstring("Exited")))
result = podmanTest.Podman([]string{"rm", "-fa"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
@@ -198,36 +199,36 @@ var _ = Describe("Podman checkpoint", func() {
localRunString := getRunString([]string{"--name", "first", ALPINE, "top"})
session1 := podmanTest.Podman(localRunString)
session1.WaitWithDefaultTimeout()
- Expect(session1.ExitCode()).To(Equal(0))
+ Expect(session1).Should(Exit(0))
localRunString = getRunString([]string{"--name", "second", ALPINE, "top"})
session2 := podmanTest.Podman(localRunString)
session2.WaitWithDefaultTimeout()
- Expect(session2.ExitCode()).To(Equal(0))
+ Expect(session2).Should(Exit(0))
result := podmanTest.Podman([]string{"container", "checkpoint", "-a"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
ps := podmanTest.Podman([]string{"ps", "-q", "--no-trunc"})
ps.WaitWithDefaultTimeout()
- Expect(ps.ExitCode()).To(Equal(0))
+ Expect(ps).Should(Exit(0))
Expect(ps.LineInOutputContains(session1.OutputToString())).To(BeFalse())
Expect(ps.LineInOutputContains(session2.OutputToString())).To(BeFalse())
result = podmanTest.Podman([]string{"container", "restore", "-a"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(2))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
Expect(podmanTest.GetContainerStatus()).To(Not(ContainSubstring("Exited")))
result = podmanTest.Podman([]string{"rm", "-fa"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
@@ -237,11 +238,11 @@ var _ = Describe("Podman checkpoint", func() {
localRunString := getRunString([]string{redis})
session := podmanTest.Podman(localRunString)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
IP := podmanTest.Podman([]string{"inspect", "-l", "--format={{.NetworkSettings.IPAddress}}"})
IP.WaitWithDefaultTimeout()
- Expect(IP.ExitCode()).To(Equal(0))
+ Expect(IP).Should(Exit(0))
// Open a network connection to the redis server
conn, err := net.Dial("tcp", IP.OutputToString()+":6379")
@@ -252,7 +253,7 @@ var _ = Describe("Podman checkpoint", func() {
result := podmanTest.Podman([]string{"container", "checkpoint", "-l"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(125))
+ Expect(result).Should(Exit(125))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
@@ -260,7 +261,7 @@ var _ = Describe("Podman checkpoint", func() {
result = podmanTest.Podman([]string{"container", "checkpoint", "-l", "--tcp-established"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Exited"))
@@ -268,7 +269,7 @@ var _ = Describe("Podman checkpoint", func() {
result = podmanTest.Podman([]string{"container", "restore", "-l"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(125))
+ Expect(result).Should(Exit(125))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Exited"))
@@ -276,13 +277,13 @@ var _ = Describe("Podman checkpoint", func() {
result = podmanTest.Podman([]string{"container", "restore", "-l", "--tcp-established"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
result = podmanTest.Podman([]string{"rm", "-fa"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
conn.Close()
@@ -292,14 +293,14 @@ var _ = Describe("Podman checkpoint", func() {
localRunString := getRunString([]string{ALPINE, "top"})
session := podmanTest.Podman(localRunString)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
// Checkpoint container, but leave it running
result := podmanTest.Podman([]string{"container", "checkpoint", "--leave-running", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
// Make sure it is still running
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
@@ -308,7 +309,7 @@ var _ = Describe("Podman checkpoint", func() {
result = podmanTest.Podman([]string{"container", "stop", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Exited"))
@@ -316,13 +317,13 @@ var _ = Describe("Podman checkpoint", func() {
result = podmanTest.Podman([]string{"container", "restore", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
result = podmanTest.Podman([]string{"rm", "-fa"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
@@ -330,20 +331,20 @@ var _ = Describe("Podman checkpoint", func() {
localRunString := getRunString([]string{"--name", "test_name", ALPINE, "top"})
session := podmanTest.Podman(localRunString)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
IPBefore := podmanTest.Podman([]string{"inspect", "-l", "--format={{.NetworkSettings.IPAddress}}"})
IPBefore.WaitWithDefaultTimeout()
- Expect(IPBefore.ExitCode()).To(Equal(0))
+ Expect(IPBefore).Should(Exit(0))
MACBefore := podmanTest.Podman([]string{"inspect", "-l", "--format={{.NetworkSettings.MacAddress}}"})
MACBefore.WaitWithDefaultTimeout()
- Expect(MACBefore.ExitCode()).To(Equal(0))
+ Expect(MACBefore).Should(Exit(0))
result := podmanTest.Podman([]string{"container", "checkpoint", "test_name"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Exited"))
@@ -352,11 +353,11 @@ var _ = Describe("Podman checkpoint", func() {
IPAfter := podmanTest.Podman([]string{"inspect", "-l", "--format={{.NetworkSettings.IPAddress}}"})
IPAfter.WaitWithDefaultTimeout()
- Expect(IPAfter.ExitCode()).To(Equal(0))
+ Expect(IPAfter).Should(Exit(0))
MACAfter := podmanTest.Podman([]string{"inspect", "-l", "--format={{.NetworkSettings.MacAddress}}"})
MACAfter.WaitWithDefaultTimeout()
- Expect(MACAfter.ExitCode()).To(Equal(0))
+ Expect(MACAfter).Should(Exit(0))
// Check that IP address did not change between checkpointing and restoring
Expect(IPBefore.OutputToString()).To(Equal(IPAfter.OutputToString()))
@@ -364,13 +365,13 @@ var _ = Describe("Podman checkpoint", func() {
// Check that MAC address did not change between checkpointing and restoring
Expect(MACBefore.OutputToString()).To(Equal(MACAfter.OutputToString()))
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
result = podmanTest.Podman([]string{"rm", "-fa"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
@@ -380,7 +381,7 @@ var _ = Describe("Podman checkpoint", func() {
localRunString := getRunString([]string{"--rm", ALPINE, "top"})
session := podmanTest.Podman(localRunString)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
cid := session.OutputToString()
fileName := "/tmp/checkpoint-" + cid + ".tar.gz"
@@ -390,7 +391,7 @@ var _ = Describe("Podman checkpoint", func() {
// As the container has been started with '--rm' it will be completely
// cleaned up after checkpointing.
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
@@ -405,20 +406,20 @@ var _ = Describe("Podman checkpoint", func() {
result = podmanTest.Podman([]string{"container", "restore", "-i", fileName, "-n", "restore_again", "--ignore-static-ip"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
result = podmanTest.Podman([]string{"container", "restore", "-i", fileName})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(2))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
result = podmanTest.Podman([]string{"rm", "-fa"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
@@ -431,7 +432,7 @@ var _ = Describe("Podman checkpoint", func() {
localRunString := getRunString([]string{"--rm", ALPINE, "top"})
session := podmanTest.Podman(localRunString)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
cid := session.OutputToString()
fileName := "/tmp/checkpoint-" + cid + ".tar"
@@ -442,7 +443,7 @@ var _ = Describe("Podman checkpoint", func() {
// As the container has been started with '--rm' it will be completely
// cleaned up after checkpointing.
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
@@ -450,7 +451,7 @@ var _ = Describe("Podman checkpoint", func() {
result = podmanTest.Podman([]string{"container", "restore", "-i", fileName})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
@@ -460,7 +461,7 @@ var _ = Describe("Podman checkpoint", func() {
// As the container has been started with '--rm' it will be completely
// cleaned up after checkpointing.
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
@@ -468,7 +469,7 @@ var _ = Describe("Podman checkpoint", func() {
result = podmanTest.Podman([]string{"container", "restore", "-i", fileName})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
@@ -478,7 +479,7 @@ var _ = Describe("Podman checkpoint", func() {
// As the container has been started with '--rm' it will be completely
// cleaned up after checkpointing.
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
@@ -486,7 +487,7 @@ var _ = Describe("Podman checkpoint", func() {
result = podmanTest.Podman([]string{"container", "restore", "-i", fileName})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
@@ -496,7 +497,7 @@ var _ = Describe("Podman checkpoint", func() {
// As the container has been started with '--rm' it will be completely
// cleaned up after checkpointing.
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
@@ -504,7 +505,7 @@ var _ = Describe("Podman checkpoint", func() {
result = podmanTest.Podman([]string{"container", "restore", "-i", fileName})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
@@ -512,13 +513,13 @@ var _ = Describe("Podman checkpoint", func() {
result = podmanTest.Podman([]string{"container", "checkpoint", "-l", "-e", fileName, "-c", "non-existing"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(125))
+ Expect(result).Should(Exit(125))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
result = podmanTest.Podman([]string{"rm", "-fa"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
@@ -531,7 +532,7 @@ var _ = Describe("Podman checkpoint", func() {
localRunString := getRunString([]string{"--rm", ALPINE, "top"})
session := podmanTest.Podman(localRunString)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
cid := session.OutputToString()
fileName := "/tmp/checkpoint-" + cid + ".tar.gz"
@@ -539,15 +540,15 @@ var _ = Describe("Podman checkpoint", func() {
// Change the container's root file-system
result := podmanTest.Podman([]string{"exec", "-l", "/bin/sh", "-c", "echo test" + cid + "test > /test.output"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
result = podmanTest.Podman([]string{"exec", "-l", "/bin/sh", "-c", "rm /etc/motd"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
result = podmanTest.Podman([]string{"diff", "-l"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(ContainSubstring("C /etc"))
Expect(result.OutputToString()).To(ContainSubstring("A /test.output"))
Expect(result.OutputToString()).To(ContainSubstring("D /etc/motd"))
@@ -557,7 +558,7 @@ var _ = Describe("Podman checkpoint", func() {
result = podmanTest.Podman([]string{"container", "checkpoint", "-l", "-e", fileName})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
@@ -565,7 +566,7 @@ var _ = Describe("Podman checkpoint", func() {
result = podmanTest.Podman([]string{"container", "restore", "-i", fileName})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
@@ -573,12 +574,12 @@ var _ = Describe("Podman checkpoint", func() {
// Verify the changes to the container's root file-system
result = podmanTest.Podman([]string{"exec", "-l", "cat", "/test.output"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(ContainSubstring("test" + cid + "test"))
result = podmanTest.Podman([]string{"diff", "-l"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(ContainSubstring("C /etc"))
Expect(result.OutputToString()).To(ContainSubstring("A /test.output"))
Expect(result.OutputToString()).To(ContainSubstring("D /etc/motd"))
@@ -592,7 +593,7 @@ var _ = Describe("Podman checkpoint", func() {
localRunString := getRunString([]string{"--rm", ALPINE, "top"})
session := podmanTest.Podman(localRunString)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
cid := session.OutputToString()
fileName := "/tmp/checkpoint-" + cid + ".tar.gz"
@@ -600,13 +601,13 @@ var _ = Describe("Podman checkpoint", func() {
// Change the container's root file-system
result := podmanTest.Podman([]string{"exec", "-l", "/bin/sh", "-c", "echo test" + cid + "test > /test.output"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
// Checkpoint the container
result = podmanTest.Podman([]string{"container", "checkpoint", "-l", "-e", fileName})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
@@ -614,7 +615,7 @@ var _ = Describe("Podman checkpoint", func() {
result = podmanTest.Podman([]string{"container", "restore", "--ignore-rootfs", "-i", fileName})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
@@ -622,7 +623,7 @@ var _ = Describe("Podman checkpoint", func() {
// Verify the changes to the container's root file-system
result = podmanTest.Podman([]string{"exec", "-l", "cat", "/test.output"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(1))
+ Expect(result).Should(Exit(1))
Expect(result.ErrorToString()).To(ContainSubstring("cat: can't open '/test.output': No such file or directory"))
// Remove exported checkpoint
@@ -633,7 +634,7 @@ var _ = Describe("Podman checkpoint", func() {
localRunString := getRunString([]string{"--rm", ALPINE, "top"})
session := podmanTest.Podman(localRunString)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
cid := session.OutputToString()
fileName := "/tmp/checkpoint-" + cid + ".tar.gz"
@@ -641,13 +642,13 @@ var _ = Describe("Podman checkpoint", func() {
// Change the container's root file-system
result := podmanTest.Podman([]string{"exec", "-l", "/bin/sh", "-c", "echo test" + cid + "test > /test.output"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
// Checkpoint the container
result = podmanTest.Podman([]string{"container", "checkpoint", "--ignore-rootfs", "-l", "-e", fileName})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
@@ -655,7 +656,7 @@ var _ = Describe("Podman checkpoint", func() {
result = podmanTest.Podman([]string{"container", "restore", "-i", fileName})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
@@ -663,7 +664,7 @@ var _ = Describe("Podman checkpoint", func() {
// Verify the changes to the container's root file-system
result = podmanTest.Podman([]string{"exec", "-l", "cat", "/test.output"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(1))
+ Expect(result).Should(Exit(1))
Expect(result.ErrorToString()).To(ContainSubstring("cat: can't open '/test.output': No such file or directory"))
// Remove exported checkpoint
@@ -675,7 +676,7 @@ var _ = Describe("Podman checkpoint", func() {
localRunString := getRunString([]string{"--rm", ALPINE, "top"})
session := podmanTest.Podman(localRunString)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
cid := session.OutputToString()
fileName := "/tmp/checkpoint-" + cid + ".tar.gz"
@@ -684,7 +685,7 @@ var _ = Describe("Podman checkpoint", func() {
result := podmanTest.Podman([]string{"container", "checkpoint", "-l", "-e", fileName})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
@@ -692,7 +693,7 @@ var _ = Describe("Podman checkpoint", func() {
result = podmanTest.Podman([]string{"container", "restore", "-i", fileName})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
@@ -700,11 +701,11 @@ var _ = Describe("Podman checkpoint", func() {
// Exec in the container
result = podmanTest.Podman([]string{"exec", "-l", "/bin/sh", "-c", "echo " + cid + " > /test.output"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
result = podmanTest.Podman([]string{"exec", "-l", "cat", "/test.output"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(ContainSubstring(cid))
// Remove exported checkpoint
@@ -733,20 +734,20 @@ var _ = Describe("Podman checkpoint", func() {
// As the container has been started with '--rm' it will be completely
// cleaned up after checkpointing.
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
result = podmanTest.Podman([]string{"container", "restore", "-i", fileName})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
result = podmanTest.Podman([]string{"rm", "-fa"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
@@ -759,7 +760,7 @@ var _ = Describe("Podman checkpoint", func() {
"build", "-f", "build/basicalpine/Containerfile.volume", "-t", "test-cr-volume",
})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Start the container
localRunString := getRunString([]string{
@@ -771,7 +772,7 @@ var _ = Describe("Podman checkpoint", func() {
})
session = podmanTest.Podman(localRunString)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
cid := session.OutputToString()
@@ -781,28 +782,28 @@ var _ = Describe("Podman checkpoint", func() {
"exec", "-l", "/bin/sh", "-c", "echo " + cid + " > /volume0/test.output",
})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
// Add file in volume1
result = podmanTest.Podman([]string{
"exec", "-l", "/bin/sh", "-c", "echo " + cid + " > /volume1/test.output",
})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
// Add file in volume2
result = podmanTest.Podman([]string{
"exec", "-l", "/bin/sh", "-c", "echo " + cid + " > /volume2/test.output",
})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
checkpointFileName := "/tmp/checkpoint-" + cid + ".tar.gz"
// Checkpoint the container
result = podmanTest.Podman([]string{"container", "checkpoint", "-l", "-e", checkpointFileName})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
@@ -817,12 +818,12 @@ var _ = Describe("Podman checkpoint", func() {
// Remove named volume
session = podmanTest.Podman([]string{"volume", "rm", "my-test-vol"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Restoring container
result = podmanTest.Podman([]string{"container", "restore", "-i", checkpointFileName})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
@@ -830,19 +831,19 @@ var _ = Describe("Podman checkpoint", func() {
// Validate volume0 content
result = podmanTest.Podman([]string{"exec", "-l", "cat", "/volume0/test.output"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(ContainSubstring(cid))
// Validate volume1 content
result = podmanTest.Podman([]string{"exec", "-l", "cat", "/volume1/test.output"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(ContainSubstring(cid))
// Validate volume2 content
result = podmanTest.Podman([]string{"exec", "-l", "cat", "/volume2/test.output"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(ContainSubstring(cid))
// Remove exported checkpoint
@@ -856,27 +857,27 @@ var _ = Describe("Podman checkpoint", func() {
localRunString := getRunString([]string{ALPINE, "top"})
session := podmanTest.Podman(localRunString)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
result := podmanTest.Podman([]string{"container", "checkpoint", "-P", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
result = podmanTest.Podman([]string{"container", "checkpoint", "--with-previous", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Exited"))
result = podmanTest.Podman([]string{"container", "restore", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
})
@@ -888,7 +889,7 @@ var _ = Describe("Podman checkpoint", func() {
localRunString := getRunString([]string{ALPINE, "top"})
session := podmanTest.Podman(localRunString)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
preCheckpointFileName := "/tmp/pre-checkpoint-" + cid + ".tar.gz"
checkpointFileName := "/tmp/checkpoint-" + cid + ".tar.gz"
@@ -896,26 +897,26 @@ var _ = Describe("Podman checkpoint", func() {
result := podmanTest.Podman([]string{"container", "checkpoint", "-P", "-e", preCheckpointFileName, cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
result = podmanTest.Podman([]string{"container", "checkpoint", "--with-previous", "-e", checkpointFileName, cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Exited"))
result = podmanTest.Podman([]string{"rm", "-f", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
result = podmanTest.Podman([]string{"container", "restore", "-i", checkpointFileName, "--import-previous", preCheckpointFileName})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
@@ -927,7 +928,7 @@ var _ = Describe("Podman checkpoint", func() {
localRunString := getRunString([]string{"-p", "1234:6379", "--rm", redis})
session := podmanTest.Podman(localRunString)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
fileName := "/tmp/checkpoint-" + cid + ".tar.gz"
@@ -944,7 +945,7 @@ var _ = Describe("Podman checkpoint", func() {
// As the container has been started with '--rm' it will be completely
// cleaned up after checkpointing.
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
@@ -952,7 +953,7 @@ var _ = Describe("Podman checkpoint", func() {
result = podmanTest.Podman([]string{"container", "restore", "-p", "1235:6379", "-i", fileName})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
@@ -969,7 +970,7 @@ var _ = Describe("Podman checkpoint", func() {
result = podmanTest.Podman([]string{"rm", "-fa"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
diff --git a/test/e2e/commit_test.go b/test/e2e/commit_test.go
index 70a66124a..0a368b10f 100644
--- a/test/e2e/commit_test.go
+++ b/test/e2e/commit_test.go
@@ -8,6 +8,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman commit", func() {
@@ -41,7 +42,7 @@ var _ = Describe("Podman commit", func() {
session := podmanTest.Podman([]string{"commit", "test1", "foobar.com/test1-image:latest"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
check := podmanTest.Podman([]string{"inspect", "foobar.com/test1-image:latest"})
check.WaitWithDefaultTimeout()
@@ -56,7 +57,7 @@ var _ = Describe("Podman commit", func() {
session := podmanTest.Podman([]string{"commit", "test1", "a"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
check := podmanTest.Podman([]string{"inspect", "localhost/a:latest"})
check.WaitWithDefaultTimeout()
@@ -71,7 +72,7 @@ var _ = Describe("Podman commit", func() {
session := podmanTest.Podman([]string{"container", "commit", "test1", "foobar.com/test1-image:latest"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
check := podmanTest.Podman([]string{"image", "inspect", "foobar.com/test1-image:latest"})
check.WaitWithDefaultTimeout()
@@ -86,7 +87,7 @@ var _ = Describe("Podman commit", func() {
session := podmanTest.Podman([]string{"commit", "-f", "docker", "--message", "testing-commit", "test1", "foobar.com/test1-image:latest"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
check := podmanTest.Podman([]string{"inspect", "foobar.com/test1-image:latest"})
check.WaitWithDefaultTimeout()
@@ -101,7 +102,7 @@ var _ = Describe("Podman commit", func() {
session := podmanTest.Podman([]string{"commit", "--author", "snoopy", "test1", "foobar.com/test1-image:latest"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
check := podmanTest.Podman([]string{"inspect", "foobar.com/test1-image:latest"})
check.WaitWithDefaultTimeout()
@@ -112,12 +113,12 @@ var _ = Describe("Podman commit", func() {
It("podman commit container with change flag", func() {
test := podmanTest.Podman([]string{"run", "--name", "test1", "-d", ALPINE, "ls"})
test.WaitWithDefaultTimeout()
- Expect(test.ExitCode()).To(Equal(0))
+ Expect(test).Should(Exit(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
session := podmanTest.Podman([]string{"commit", "--change", "LABEL=image=blue", "test1", "foobar.com/test1-image:latest"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
check := podmanTest.Podman([]string{"inspect", "foobar.com/test1-image:latest"})
check.WaitWithDefaultTimeout()
@@ -135,12 +136,12 @@ var _ = Describe("Podman commit", func() {
It("podman commit container with change flag and JSON entrypoint with =", func() {
test := podmanTest.Podman([]string{"run", "--name", "test1", "-d", ALPINE, "ls"})
test.WaitWithDefaultTimeout()
- Expect(test.ExitCode()).To(Equal(0))
+ Expect(test).Should(Exit(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
session := podmanTest.Podman([]string{"commit", "--change", `ENTRYPOINT ["foo", "bar=baz"]`, "test1", "foobar.com/test1-image:latest"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
check := podmanTest.Podman([]string{"inspect", "foobar.com/test1-image:latest"})
check.WaitWithDefaultTimeout()
@@ -154,25 +155,25 @@ var _ = Describe("Podman commit", func() {
It("podman commit container with change CMD flag", func() {
test := podmanTest.Podman([]string{"run", "--name", "test1", "-d", ALPINE, "ls"})
test.WaitWithDefaultTimeout()
- Expect(test.ExitCode()).To(Equal(0))
+ Expect(test).Should(Exit(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
session := podmanTest.Podman([]string{"commit", "--change", "CMD a b c", "test1", "foobar.com/test1-image:latest"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"inspect", "--format", "{{.Config.Cmd}}", "foobar.com/test1-image:latest"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("sh -c a b c"))
session = podmanTest.Podman([]string{"commit", "--change", "CMD=[\"a\",\"b\",\"c\"]", "test1", "foobar.com/test1-image:latest"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"inspect", "--format", "{{.Config.Cmd}}", "foobar.com/test1-image:latest"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Not(ContainSubstring("sh -c")))
})
@@ -183,25 +184,25 @@ var _ = Describe("Podman commit", func() {
session := podmanTest.Podman([]string{"commit", "--pause=false", "test1", "foobar.com/test1-image:latest"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
check := podmanTest.Podman([]string{"inspect", "foobar.com/test1-image:latest"})
check.WaitWithDefaultTimeout()
- Expect(check.ExitCode()).To(Equal(0))
+ Expect(check).Should(Exit(0))
})
It("podman commit with volumes mounts and no include-volumes", func() {
s := podmanTest.Podman([]string{"run", "--name", "test1", "-v", "/tmp:/foo", "alpine", "date"})
s.WaitWithDefaultTimeout()
- Expect(s.ExitCode()).To(Equal(0))
+ Expect(s).Should(Exit(0))
c := podmanTest.Podman([]string{"commit", "test1", "newimage"})
c.WaitWithDefaultTimeout()
- Expect(c.ExitCode()).To(Equal(0))
+ Expect(c).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", "newimage"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
image := inspect.InspectImageJSON()
_, ok := image[0].Config.Volumes["/foo"]
Expect(ok).To(BeFalse())
@@ -213,36 +214,36 @@ var _ = Describe("Podman commit", func() {
SkipIfRemote("--testing Remote Volumes")
s := podmanTest.Podman([]string{"run", "--name", "test1", "-v", "/tmp:/foo", "alpine", "date"})
s.WaitWithDefaultTimeout()
- Expect(s.ExitCode()).To(Equal(0))
+ Expect(s).Should(Exit(0))
c := podmanTest.Podman([]string{"commit", "--include-volumes", "test1", "newimage"})
c.WaitWithDefaultTimeout()
- Expect(c.ExitCode()).To(Equal(0))
+ Expect(c).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", "newimage"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
image := inspect.InspectImageJSON()
_, ok := image[0].Config.Volumes["/foo"]
Expect(ok).To(BeTrue())
r := podmanTest.Podman([]string{"run", "newimage"})
r.WaitWithDefaultTimeout()
- Expect(r.ExitCode()).To(Equal(0))
+ Expect(r).Should(Exit(0))
})
It("podman commit container check env variables", func() {
s := podmanTest.Podman([]string{"run", "--name", "test1", "-e", "TEST=1=1-01=9.01", "-it", "alpine", "true"})
s.WaitWithDefaultTimeout()
- Expect(s.ExitCode()).To(Equal(0))
+ Expect(s).Should(Exit(0))
c := podmanTest.Podman([]string{"commit", "test1", "newimage"})
c.WaitWithDefaultTimeout()
- Expect(c.ExitCode()).To(Equal(0))
+ Expect(c).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", "newimage"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
image := inspect.InspectImageJSON()
envMap := make(map[string]bool)
@@ -271,7 +272,7 @@ var _ = Describe("Podman commit", func() {
session := podmanTest.Podman([]string{"commit", "test1", "foobar.com/test1-image:latest", "--iidfile", targetFile})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
id, _ := ioutil.ReadFile(targetFile)
check := podmanTest.Podman([]string{"inspect", "foobar.com/test1-image:latest"})
@@ -288,20 +289,20 @@ var _ = Describe("Podman commit", func() {
session := podmanTest.Podman([]string{"secret", "create", "mysecret", secretFilePath})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--secret", "mysecret", "--name", "secr", ALPINE, "cat", "/run/secrets/mysecret"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal(secretsString))
session = podmanTest.Podman([]string{"commit", "secr", "foobar.com/test1-image:latest"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "foobar.com/test1-image:latest", "cat", "/run/secrets/mysecret"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
})
@@ -313,16 +314,16 @@ var _ = Describe("Podman commit", func() {
session := podmanTest.Podman([]string{"secret", "create", "mysecret", secretFilePath})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--secret", "source=mysecret,type=env", "--name", "secr", ALPINE, "printenv", "mysecret"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal(secretsString))
session = podmanTest.Podman([]string{"commit", "secr", "foobar.com/test1-image:latest"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "foobar.com/test1-image:latest", "printenv", "mysecret"})
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index 1aeeca4cb..5a6cf7ffb 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -321,11 +321,11 @@ func (p *PodmanTestIntegration) createArtifact(image string) {
if _, err := os.Stat(destName); os.IsNotExist(err) {
pull := p.PodmanNoCache([]string{"pull", image})
pull.Wait(440)
- Expect(pull.ExitCode()).To(Equal(0))
+ Expect(pull).Should(Exit(0))
save := p.PodmanNoCache([]string{"save", "-o", destName, image})
save.Wait(90)
- Expect(save.ExitCode()).To(Equal(0))
+ Expect(save).Should(Exit(0))
fmt.Printf("\n")
} else {
fmt.Printf(" already exists.\n")
diff --git a/test/e2e/container_inspect_test.go b/test/e2e/container_inspect_test.go
index 840f13e3d..9a95a275a 100644
--- a/test/e2e/container_inspect_test.go
+++ b/test/e2e/container_inspect_test.go
@@ -7,6 +7,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman container inspect", func() {
@@ -36,7 +37,7 @@ var _ = Describe("Podman container inspect", func() {
const testContainer = "container-inspect-test-1"
setup := podmanTest.RunTopContainer(testContainer)
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
data := podmanTest.InspectContainer(testContainer)
Expect(data[0].Config.Annotations[annotations.ContainerManager]).
diff --git a/test/e2e/containers_conf_test.go b/test/e2e/containers_conf_test.go
index 054454798..3349b8be3 100644
--- a/test/e2e/containers_conf_test.go
+++ b/test/e2e/containers_conf_test.go
@@ -11,6 +11,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman run", func() {
@@ -47,12 +48,12 @@ var _ = Describe("Podman run", func() {
//containers.conf is set to "nofile=500:500"
session := podmanTest.Podman([]string{"run", "--rm", fedoraMinimal, "ulimit", "-n"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("500"))
session = podmanTest.Podman([]string{"run", "--rm", "--ulimit", "nofile=2048:2048", fedoraMinimal, "ulimit", "-n"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("2048"))
})
@@ -60,7 +61,7 @@ var _ = Describe("Podman run", func() {
//containers.conf default env includes foo
session := podmanTest.Podman([]string{"run", ALPINE, "printenv"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("foo=bar"))
})
@@ -68,7 +69,7 @@ var _ = Describe("Podman run", func() {
//containers.conf devices includes notone
session := podmanTest.Podman([]string{"run", "--device", "/dev/null:/dev/bar", ALPINE, "ls", "/dev"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("bar"))
Expect(session.OutputToString()).To(ContainSubstring("notone"))
})
@@ -77,7 +78,7 @@ var _ = Describe("Podman run", func() {
//containers.conf default sets shm-size=201k, which ends up as 200k
session := podmanTest.Podman([]string{"run", ALPINE, "grep", "shm", "/proc/self/mounts"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("size=200k"))
})
@@ -85,7 +86,7 @@ var _ = Describe("Podman run", func() {
SkipIfRootlessCgroupsV1("Not supported for rootless + CGroupsV1")
cap := podmanTest.Podman([]string{"run", ALPINE, "grep", "CapEff", "/proc/self/status"})
cap.WaitWithDefaultTimeout()
- Expect(cap.ExitCode()).To(Equal(0))
+ Expect(cap).Should(Exit(0))
os.Setenv("CONTAINERS_CONF", "config/containers-ns.conf")
if IsRemote() {
@@ -93,7 +94,7 @@ var _ = Describe("Podman run", func() {
}
session := podmanTest.Podman([]string{"run", BB, "grep", "CapEff", "/proc/self/status"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).ToNot(Equal(cap.OutputToString()))
})
@@ -102,7 +103,7 @@ var _ = Describe("Podman run", func() {
setup.WaitWithDefaultTimeout()
result := podmanTest.Podman([]string{"top", "test1", "capeff"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(ContainSubstring("SYS_CHROOT"))
Expect(result.OutputToString()).To(ContainSubstring("NET_RAW"))
})
@@ -116,7 +117,7 @@ var _ = Describe("Podman run", func() {
setup.WaitWithDefaultTimeout()
result := podmanTest.Podman([]string{"container", "top", "test1", "capeff"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).ToNot(ContainSubstring("SYS_CHROOT"))
Expect(result.OutputToString()).ToNot(ContainSubstring("NET_RAW"))
})
@@ -130,7 +131,7 @@ var _ = Describe("Podman run", func() {
//containers.conf default ipcns to default to host
session := podmanTest.Podman([]string{"run", ALPINE, "ls", "-l", nspath})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
fields := strings.Split(session.OutputToString(), " ")
ctrNS := strings.TrimSuffix(fields[len(fields)-1], "\n")
@@ -175,12 +176,12 @@ var _ = Describe("Podman run", func() {
}
logc := podmanTest.Podman([]string{"run", "-d", ALPINE, "sh", "-c", "echo podman; sleep 0.1; echo podman; sleep 0.1; echo podman"})
logc.WaitWithDefaultTimeout()
- Expect(logc.ExitCode()).To(Equal(0))
+ Expect(logc).Should(Exit(0))
cid := logc.OutputToString()
wait := podmanTest.Podman([]string{"wait", cid})
wait.WaitWithDefaultTimeout()
- Expect(wait.ExitCode()).To(Equal(0))
+ Expect(wait).Should(Exit(0))
cmd := exec.Command("journalctl", "--no-pager", "-o", "json", "--output-fields=CONTAINER_TAG", fmt.Sprintf("CONTAINER_ID_FULL=%s", cid))
out, err := cmd.CombinedOutput()
@@ -202,55 +203,55 @@ var _ = Describe("Podman run", func() {
}
result := podmanTest.Podman([]string{"run", ALPINE, "ls", tempdir})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
})
It("podman run containers.conf sysctl test", func() {
//containers.conf is set to "net.ipv4.ping_group_range=0 1000"
session := podmanTest.Podman([]string{"run", "--rm", fedoraMinimal, "cat", "/proc/sys/net/ipv4/ping_group_range"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("1000"))
// Ignore containers.conf setting if --net=host
session = podmanTest.Podman([]string{"run", "--rm", "--net", "host", fedoraMinimal, "cat", "/proc/sys/net/ipv4/ping_group_range"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).ToNot((ContainSubstring("1000")))
})
It("podman run containers.conf search domain", func() {
session := podmanTest.Podman([]string{"run", ALPINE, "cat", "/etc/resolv.conf"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session.LineInOutputStartsWith("search foobar.com")
})
It("podman run add dns server", func() {
session := podmanTest.Podman([]string{"run", ALPINE, "cat", "/etc/resolv.conf"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session.LineInOutputStartsWith("server 1.2.3.4")
})
It("podman run add dns option", func() {
session := podmanTest.Podman([]string{"run", ALPINE, "cat", "/etc/resolv.conf"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session.LineInOutputStartsWith("options debug")
})
It("podman run containers.conf remove all search domain", func() {
session := podmanTest.Podman([]string{"run", "--dns-search=.", ALPINE, "cat", "/etc/resolv.conf"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.LineInOutputStartsWith("search")).To(BeFalse())
})
It("podman run use containers.conf search domain", func() {
session := podmanTest.Podman([]string{"run", ALPINE, "cat", "/etc/resolv.conf"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.LineInOutputStartsWith("search")).To(BeTrue())
Expect(session.OutputToString()).To(ContainSubstring("foobar.com"))
@@ -262,7 +263,7 @@ var _ = Describe("Podman run", func() {
//containers.conf timezone set to Pacific/Honolulu
session := podmanTest.Podman([]string{"run", ALPINE, "date", "+'%H %Z'"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("HST"))
})
@@ -274,14 +275,14 @@ var _ = Describe("Podman run", func() {
session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "sh", "-c", "umask"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("0002"))
})
It("podman set network cmd options slirp options to allow host loopback", func() {
session := podmanTest.Podman([]string{"run", "--network", "slirp4netns", ALPINE, "ping", "-c1", "10.0.2.2"})
session.Wait(30)
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman-remote test localcontainers.conf versus remote containers.conf", func() {
@@ -294,13 +295,13 @@ var _ = Describe("Podman run", func() {
// env
session := podmanTest.Podman([]string{"run", ALPINE, "printenv", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("bar"))
// dns-search, server, options
session = podmanTest.Podman([]string{"run", ALPINE, "cat", "/etc/resolv.conf"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.LineInOutputStartsWith("search")).To(BeTrue())
Expect(session.OutputToString()).To(ContainSubstring("foobar.com"))
Expect(session.OutputToString()).To(ContainSubstring("1.2.3.4"))
@@ -309,32 +310,32 @@ var _ = Describe("Podman run", func() {
// sysctls
session = podmanTest.Podman([]string{"run", "--rm", ALPINE, "cat", "/proc/sys/net/ipv4/ping_group_range"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("1000"))
// shm-size
session = podmanTest.Podman([]string{"run", ALPINE, "grep", "shm", "/proc/self/mounts"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("size=200k"))
// ulimits
session = podmanTest.Podman([]string{"run", "--rm", fedoraMinimal, "ulimit", "-n"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("500"))
// Configuration that comes from remote client
// Timezone
session = podmanTest.Podman([]string{"run", ALPINE, "date", "+'%H %Z'"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Or(ContainSubstring("EST"), ContainSubstring("EDT")))
// Umask
session = podmanTest.Podman([]string{"run", "--rm", ALPINE, "sh", "-c", "umask"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("0022"))
})
@@ -342,7 +343,7 @@ var _ = Describe("Podman run", func() {
//containers.conf is set to "run.oci.keep_original_groups=1"
session := podmanTest.Podman([]string{"create", "--rm", "--name", "test", fedoraMinimal})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", "--format", "{{ .Config.Annotations }}", "test"})
inspect.WaitWithDefaultTimeout()
@@ -357,18 +358,18 @@ var _ = Describe("Podman run", func() {
session = podmanTest.Podman([]string{"run", "-dt", "--add-host", "test1:127.0.0.1", "--no-hosts=false", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman run with no-hosts=true /etc/hosts does not include hostname", func() {
session := podmanTest.Podman([]string{"run", "--rm", "--name", "test", ALPINE, "cat", "/etc/hosts"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Not(ContainSubstring("test")))
session = podmanTest.Podman([]string{"run", "--rm", "--name", "test", "--no-hosts=false", ALPINE, "cat", "/etc/hosts"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("test"))
})
@@ -387,7 +388,7 @@ var _ = Describe("Podman run", func() {
session := podmanTest.Podman([]string{"info", "--format", "{{.Host.Security.SECCOMPProfilePath}}"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal(profile))
})
})
diff --git a/test/e2e/cp_test.go b/test/e2e/cp_test.go
index be4901833..360b8c7fc 100644
--- a/test/e2e/cp_test.go
+++ b/test/e2e/cp_test.go
@@ -10,6 +10,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
// NOTE: Only smoke tests. The system tests (i.e., "./test/system/*") take
@@ -55,7 +56,7 @@ var _ = Describe("Podman cp", func() {
// Create a container. NOTE that container mustn't be running for copying.
session := podmanTest.Podman([]string{"create", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
name := session.OutputToString()
// Copy TO the container.
@@ -68,7 +69,7 @@ var _ = Describe("Podman cp", func() {
// The file will now be created (and written to).
session = podmanTest.Podman([]string{"cp", srcFile.Name(), name + ":foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Copy FROM the container.
@@ -79,11 +80,11 @@ var _ = Describe("Podman cp", func() {
session = podmanTest.Podman([]string{"cp", name + ":foo", destFile.Name()})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"start", name})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Now make sure the content matches.
roundtripContent, err := ioutil.ReadFile(destFile.Name())
@@ -106,17 +107,17 @@ var _ = Describe("Podman cp", func() {
// Create a container. NOTE that container mustn't be running for copying.
session := podmanTest.Podman([]string{"create", "--pid=host", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
name := session.OutputToString()
session = podmanTest.Podman([]string{"start", name})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// The file will now be created (and written to).
session = podmanTest.Podman([]string{"cp", srcFile.Name(), name + ":foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Copy FROM the container.
@@ -127,7 +128,7 @@ var _ = Describe("Podman cp", func() {
session = podmanTest.Podman([]string{"cp", name + ":foo", destFile.Name()})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Now make sure the content matches.
roundtripContent, err := ioutil.ReadFile(destFile.Name())
@@ -150,25 +151,25 @@ var _ = Describe("Podman cp", func() {
session := podmanTest.Podman([]string{"run", "-d", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
name := session.OutputToString()
session = podmanTest.Podman([]string{"exec", name, "ln", "-s", "/tmp", "/test"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"cp", "--pause=false", srcFile.Name(), name + ":/test"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"exec", name, "cat", "/tmp/" + filepath.Base(srcFile.Name())})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(string(originalContent)))
session = podmanTest.Podman([]string{"exec", name, "cat", "/test/" + filepath.Base(srcFile.Name())})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(string(originalContent)))
})
@@ -188,21 +189,21 @@ var _ = Describe("Podman cp", func() {
Expect(err).To(BeNil())
session := podmanTest.Podman([]string{"volume", "create", "data"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"create", "-v", "data:/data", "--name", "container1", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"cp", srcFile.Name(), "container1" + ":/data/file.txt"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Now get the volume's mount point, read the file and make
// sure the contents match.
session = podmanTest.Podman([]string{"volume", "inspect", "data", "--format", "{{.Mountpoint}}"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
volumeMountPoint := session.OutputToString()
copiedContent, err := ioutil.ReadFile(filepath.Join(volumeMountPoint, "file.txt"))
@@ -221,19 +222,19 @@ var _ = Describe("Podman cp", func() {
setup := podmanTest.RunTopContainer("testctr")
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
session := podmanTest.Podman([]string{"exec", "testctr", "adduser", "-S", "testuser"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"exec", "-u", "testuser", "testctr", "touch", "/tmp/testfile"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"cp", "--pause=false", "testctr:/tmp/testfile", srcFile.Name()})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// owner of the file copied to local machine is not testuser
u, err := user.Current()
@@ -245,12 +246,12 @@ var _ = Describe("Podman cp", func() {
session = podmanTest.Podman([]string{"cp", "--pause=false", srcFile.Name(), "testctr:testfile2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// owner of the file copied to a container is the root user
session = podmanTest.Podman([]string{"exec", "-it", "testctr", "ls", "-l", "testfile2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("root"))
})
@@ -259,18 +260,18 @@ var _ = Describe("Podman cp", func() {
container := "copyroottohost"
session := podmanTest.RunTopContainer(container)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"exec", container, "touch", "/dummy.txt"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
tmpDir, err := ioutil.TempDir("", "")
Expect(err).To(BeNil())
session = podmanTest.Podman([]string{"cp", container + ":/", tmpDir})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cmd := exec.Command("ls", "-la", tmpDir)
output, err := cmd.Output()
diff --git a/test/e2e/create_staticip_test.go b/test/e2e/create_staticip_test.go
index 2cf552274..205855fd6 100644
--- a/test/e2e/create_staticip_test.go
+++ b/test/e2e/create_staticip_test.go
@@ -8,6 +8,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman create with --ip flag", func() {
@@ -52,7 +53,7 @@ var _ = Describe("Podman create with --ip flag", func() {
SkipIfRootless("--ip not supported without network in rootless mode")
result := podmanTest.Podman([]string{"create", "--name", "test", "--ip", "203.0.113.124", ALPINE, "ls"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
result = podmanTest.Podman([]string{"start", "test"})
result.WaitWithDefaultTimeout()
@@ -67,17 +68,17 @@ var _ = Describe("Podman create with --ip flag", func() {
result.WaitWithDefaultTimeout()
// Rootless static ip assignment without network should error
if rootless.IsRootless() {
- Expect(result.ExitCode()).To(Equal(125))
+ Expect(result).Should(Exit(125))
} else {
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
result = podmanTest.Podman([]string{"start", "test"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
result = podmanTest.Podman([]string{"logs", "test"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(ContainSubstring(ip + "/16"))
}
})
@@ -87,19 +88,19 @@ var _ = Describe("Podman create with --ip flag", func() {
ip := GetRandomIPAddress()
result := podmanTest.Podman([]string{"create", "--log-driver", "k8s-file", "--name", "test1", "--ip", ip, ALPINE, "sleep", "999"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
result = podmanTest.Podman([]string{"create", "--log-driver", "k8s-file", "--name", "test2", "--ip", ip, ALPINE, "ip", "addr"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
result = podmanTest.Podman([]string{"start", "test1"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
// race prevention: wait until IP address is assigned
for i := 0; i < 5; i++ {
result = podmanTest.Podman([]string{"inspect", "--format", "{{.NetworkSettings.IPAddress}}", "test1"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
if result.OutputToString() != "" {
break
}
diff --git a/test/e2e/create_staticmac_test.go b/test/e2e/create_staticmac_test.go
index 1df93553d..7cb638e47 100644
--- a/test/e2e/create_staticmac_test.go
+++ b/test/e2e/create_staticmac_test.go
@@ -8,6 +8,7 @@ import (
"github.com/containers/storage/pkg/stringid"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman run with --mac-address flag", func() {
@@ -40,9 +41,9 @@ var _ = Describe("Podman run with --mac-address flag", func() {
result := podmanTest.Podman([]string{"run", "--mac-address", "92:d0:c6:0a:29:34", ALPINE, "ip", "addr"})
result.WaitWithDefaultTimeout()
if rootless.IsRootless() {
- Expect(result.ExitCode()).To(Equal(125))
+ Expect(result).Should(Exit(125))
} else {
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(ContainSubstring("92:d0:c6:0a:29:34"))
}
})
@@ -52,11 +53,11 @@ var _ = Describe("Podman run with --mac-address flag", func() {
session := podmanTest.Podman([]string{"network", "create", net})
session.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(net)
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"run", "--network", net, "--mac-address", "92:d0:c6:00:29:34", ALPINE, "ip", "addr"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(ContainSubstring("92:d0:c6:00:29:34"))
})
})
diff --git a/test/e2e/create_test.go b/test/e2e/create_test.go
index e4db6b845..975596dee 100644
--- a/test/e2e/create_test.go
+++ b/test/e2e/create_test.go
@@ -12,6 +12,7 @@ import (
"github.com/containers/storage/pkg/stringid"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman create", func() {
@@ -42,7 +43,7 @@ var _ = Describe("Podman create", func() {
session := podmanTest.Podman([]string{"create", "--name", "local_image_test", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
cid := session.OutputToString()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
check := podmanTest.Podman([]string{"inspect", "local_image_test"})
@@ -54,39 +55,39 @@ var _ = Describe("Podman create", func() {
It("podman create container based on a remote image", func() {
session := podmanTest.Podman([]string{"create", BB_GLIBC, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
})
It("podman container create container based on a remote image", func() {
session := podmanTest.Podman([]string{"container", "create", BB_GLIBC, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
})
It("podman create using short options", func() {
session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
})
It("podman create using existing name", func() {
session := podmanTest.Podman([]string{"create", "--name=foo", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
session = podmanTest.Podman([]string{"create", "--name=foo", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
It("podman create adds annotation", func() {
session := podmanTest.Podman([]string{"create", "--annotation", "HELLO=WORLD", "--name", "annotate_test", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
check := podmanTest.Podman([]string{"inspect", "annotate_test"})
@@ -100,24 +101,24 @@ var _ = Describe("Podman create", func() {
It("podman create --entrypoint command", func() {
session := podmanTest.Podman([]string{"create", "--name", "entrypoint_test", "--entrypoint", "/bin/foobar", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
result := podmanTest.Podman([]string{"inspect", "entrypoint_test", "--format", "{{.Config.Entrypoint}}"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(Equal("/bin/foobar"))
})
It("podman create --entrypoint \"\"", func() {
session := podmanTest.Podman([]string{"create", "--entrypoint", "", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
result := podmanTest.Podman([]string{"inspect", session.OutputToString(), "--format", "{{.Config.Entrypoint}}"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(Equal(""))
})
@@ -125,12 +126,12 @@ var _ = Describe("Podman create", func() {
jsonString := `[ "/bin/foo", "-c"]`
session := podmanTest.Podman([]string{"create", "--name", "entrypoint_json", "--entrypoint", jsonString, ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
result := podmanTest.Podman([]string{"inspect", "entrypoint_json", "--format", "{{.Config.Entrypoint}}"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(Equal("/bin/foo -c"))
})
@@ -144,15 +145,15 @@ var _ = Describe("Podman create", func() {
session := podmanTest.Podman([]string{"create", "--name", "test", "--mount", "type=bind,src=" + vol1 + ",target=/myvol1,z", "--mount", "type=bind,src=" + vol2 + ",target=/myvol2,z", ALPINE, "touch", "/myvol2/foo.txt"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"start", "test"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"logs", "test"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).ToNot(ContainSubstring("cannot touch"))
})
@@ -167,35 +168,35 @@ var _ = Describe("Podman create", func() {
os.Mkdir(mountPath, 0755)
session := podmanTest.Podman([]string{"create", "--log-driver", "k8s-file", "--name", "test", "--mount", fmt.Sprintf("type=bind,src=%s,target=/create/test", mountPath), ALPINE, "grep", "/create/test", "/proc/self/mountinfo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"start", "test"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"logs", "test"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("/create/test rw"))
session = podmanTest.Podman([]string{"create", "--log-driver", "k8s-file", "--name", "test_ro", "--mount", fmt.Sprintf("type=bind,src=%s,target=/create/test,ro", mountPath), ALPINE, "grep", "/create/test", "/proc/self/mountinfo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"start", "test_ro"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"logs", "test_ro"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("/create/test ro"))
session = podmanTest.Podman([]string{"create", "--log-driver", "k8s-file", "--name", "test_shared", "--mount", fmt.Sprintf("type=bind,src=%s,target=/create/test,shared", mountPath), ALPINE, "grep", "/create/test", "/proc/self/mountinfo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"start", "test_shared"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"logs", "test_shared"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
found, matches := session.GrepString("/create/test")
Expect(found).Should(BeTrue())
Expect(matches[0]).To(ContainSubstring("rw"))
@@ -205,20 +206,20 @@ var _ = Describe("Podman create", func() {
os.Mkdir(mountPath, 0755)
session = podmanTest.Podman([]string{"create", "--log-driver", "k8s-file", "--name", "test_tmpfs", "--mount", "type=tmpfs,target=/create/test", ALPINE, "grep", "/create/test", "/proc/self/mountinfo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"start", "test_tmpfs"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"logs", "test_tmpfs"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("/create/test rw,nosuid,nodev,relatime - tmpfs"))
})
It("podman create --pod automatically", func() {
session := podmanTest.Podman([]string{"create", "--pod", "new:foobar", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
check := podmanTest.Podman([]string{"pod", "ps", "--no-trunc"})
check.WaitWithDefaultTimeout()
@@ -231,7 +232,7 @@ var _ = Describe("Podman create", func() {
// if used together.
session := podmanTest.Podman([]string{"create", "--pod", "foo", "--pod-id-file", "bar", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
tmpDir, err := ioutil.TempDir("", "")
Expect(err).To(BeNil())
@@ -244,11 +245,11 @@ var _ = Describe("Podman create", func() {
// Now, let's create a pod with --pod-id-file.
session = podmanTest.Podman([]string{"pod", "create", "--pod-id-file", podIDFile, "--name", podName})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pod", "inspect", podName})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.IsJSONOutputValid()).To(BeTrue())
podData := session.InspectPodToJSON()
@@ -256,7 +257,7 @@ var _ = Describe("Podman create", func() {
// some checks to make sure it's working as expected.
session = podmanTest.Podman([]string{"create", "--pod-id-file", podIDFile, "--name", ctrName, ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
ctrJSON := podmanTest.InspectContainer(ctrName)
Expect(podData.ID).To(Equal(ctrJSON[0].Pod)) // Make sure the container's pod matches the pod's ID
@@ -266,7 +267,7 @@ var _ = Describe("Podman create", func() {
name := "test101"
create := podmanTest.Podman([]string{"create", "--name", name, redis})
create.WaitWithDefaultTimeout()
- Expect(create.ExitCode()).To(Equal(0))
+ Expect(create).Should(Exit(0))
ctrJSON := podmanTest.InspectContainer(name)
Expect(len(ctrJSON)).To(Equal(1))
@@ -282,62 +283,62 @@ var _ = Describe("Podman create", func() {
session = podmanTest.Podman([]string{"create", "--pull", "always", "--name=foo", "testimage:00000000"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman create using image list by tag", func() {
session := podmanTest.Podman([]string{"create", "--pull=always", "--arch=arm64", "--name=foo", ALPINELISTTAG})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To((Equal(0)))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"inspect", "--format", "{{.Image}}", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To((Equal(0)))
+ Expect(session).Should(Exit(0))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64ID))
session = podmanTest.Podman([]string{"inspect", "--format", "{{.ImageName}}", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To((Equal(0)))
+ Expect(session).Should(Exit(0))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTTAG))
})
It("podman create using image list by digest", func() {
session := podmanTest.Podman([]string{"create", "--pull=always", "--arch=arm64", "--name=foo", ALPINELISTDIGEST})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To((Equal(0)))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"inspect", "--format", "{{.Image}}", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To((Equal(0)))
+ Expect(session).Should(Exit(0))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64ID))
session = podmanTest.Podman([]string{"inspect", "--format", "{{.ImageName}}", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To((Equal(0)))
+ Expect(session).Should(Exit(0))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTDIGEST))
})
It("podman create using image list instance by digest", func() {
session := podmanTest.Podman([]string{"create", "--pull=always", "--arch=arm64", "--name=foo", ALPINEARM64DIGEST})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To((Equal(0)))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"inspect", "--format", "{{.Image}}", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To((Equal(0)))
+ Expect(session).Should(Exit(0))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64ID))
session = podmanTest.Podman([]string{"inspect", "--format", "{{.ImageName}}", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To((Equal(0)))
+ Expect(session).Should(Exit(0))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64DIGEST))
})
It("podman create using cross-arch image list instance by digest", func() {
session := podmanTest.Podman([]string{"create", "--pull=always", "--arch=arm64", "--name=foo", ALPINEARM64DIGEST})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To((Equal(0)))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"inspect", "--format", "{{.Image}}", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To((Equal(0)))
+ Expect(session).Should(Exit(0))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64ID))
session = podmanTest.Podman([]string{"inspect", "--format", "{{.ImageName}}", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To((Equal(0)))
+ Expect(session).Should(Exit(0))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64DIGEST))
})
@@ -351,11 +352,11 @@ var _ = Describe("Podman create", func() {
SkipIfRemote("SigPolicy not handled by remote")
session := podmanTest.Podman([]string{"create", "--pull=always", "--signature-policy", "/no/such/file", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
session = podmanTest.Podman([]string{"create", "--pull=always", "--signature-policy", "/etc/containers/policy.json", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman create with unset label", func() {
@@ -363,7 +364,7 @@ var _ = Describe("Podman create", func() {
ctrName := "testctr"
session := podmanTest.Podman([]string{"create", "--label", "TESTKEY1=", "--label", "TESTKEY2", "--name", ctrName, ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", ctrName})
inspect.WaitWithDefaultTimeout()
@@ -381,7 +382,7 @@ var _ = Describe("Podman create", func() {
ctrName := "testctr"
session := podmanTest.Podman([]string{"create", "--label", "TESTKEY1=value1", "--label", "TESTKEY2=bar", "--name", ctrName, ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", ctrName})
inspect.WaitWithDefaultTimeout()
@@ -400,7 +401,7 @@ var _ = Describe("Podman create", func() {
ctrName := "testctr"
session := podmanTest.Podman([]string{"create", "-t", "--restart", "on-failure:5", "--name", ctrName, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", ctrName})
inspect.WaitWithDefaultTimeout()
@@ -413,7 +414,7 @@ var _ = Describe("Podman create", func() {
It("podman create with --restart-policy=always:5 fails", func() {
session := podmanTest.Podman([]string{"create", "-t", "--restart", "always:5", ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
})
It("podman create with --restart-policy unless-stopped", func() {
@@ -421,7 +422,7 @@ var _ = Describe("Podman create", func() {
unlessStopped := "unless-stopped"
session := podmanTest.Podman([]string{"create", "-t", "--restart", unlessStopped, "--name", ctrName, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", ctrName})
inspect.WaitWithDefaultTimeout()
@@ -435,7 +436,7 @@ var _ = Describe("Podman create", func() {
ctrName := "testCtr"
session := podmanTest.Podman([]string{"create", "-t", "-m", fmt.Sprintf("%db", numMem), "--name", ctrName, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", ctrName})
inspect.WaitWithDefaultTimeout()
@@ -450,7 +451,7 @@ var _ = Describe("Podman create", func() {
ctrName := "testCtr"
session := podmanTest.Podman([]string{"create", "-t", "--cpus", fmt.Sprintf("%d", numCpus), "--name", ctrName, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", ctrName})
inspect.WaitWithDefaultTimeout()
@@ -463,14 +464,14 @@ var _ = Describe("Podman create", func() {
// Make sure we error out with --name.
session := podmanTest.Podman([]string{"create", "--replace", ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
// Create and replace 5 times in a row the "same" container.
ctrName := "testCtr"
for i := 0; i < 5; i++ {
session = podmanTest.Podman([]string{"create", "--replace", "--name", ctrName, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
}
})
@@ -478,7 +479,7 @@ var _ = Describe("Podman create", func() {
ctrName := "testCtr"
session := podmanTest.Podman([]string{"create", "--name", ctrName, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", ctrName})
inspect.WaitWithDefaultTimeout()
@@ -490,11 +491,11 @@ var _ = Describe("Podman create", func() {
It("podman create --tz", func() {
session := podmanTest.Podman([]string{"create", "--tz", "foo", "--name", "bad", ALPINE, "date"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
session = podmanTest.Podman([]string{"create", "--tz", "America", "--name", "dir", ALPINE, "date"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
session = podmanTest.Podman([]string{"create", "--tz", "Pacific/Honolulu", "--name", "zone", ALPINE, "date"})
session.WaitWithDefaultTimeout()
@@ -552,7 +553,7 @@ var _ = Describe("Podman create", func() {
session = podmanTest.Podman([]string{"create", "--umask", "9999", "--name", "bad", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
Expect(session.ErrorToString()).To(ContainSubstring("Invalid umask"))
})
@@ -561,11 +562,11 @@ var _ = Describe("Podman create", func() {
name := "createwithstaticip"
pod := podmanTest.RunTopContainerInPod("", "new:"+name)
pod.WaitWithDefaultTimeout()
- Expect(pod.ExitCode()).To(BeZero())
+ Expect(pod).Should(Exit(0))
session := podmanTest.Podman([]string{"create", "--pod", name, "--ip", "192.168.1.2", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).ToNot(BeZero())
+ Expect(session).Should(ExitWithError())
})
It("create container in pod with mac should fail", func() {
@@ -573,112 +574,112 @@ var _ = Describe("Podman create", func() {
name := "createwithstaticmac"
pod := podmanTest.RunTopContainerInPod("", "new:"+name)
pod.WaitWithDefaultTimeout()
- Expect(pod.ExitCode()).To(BeZero())
+ Expect(pod).Should(Exit(0))
session := podmanTest.Podman([]string{"create", "--pod", name, "--mac-address", "52:54:00:6d:2f:82", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).ToNot(BeZero())
+ Expect(session).Should(ExitWithError())
})
It("create container in pod with network should not fail", func() {
name := "createwithnetwork"
pod := podmanTest.RunTopContainerInPod("", "new:"+name)
pod.WaitWithDefaultTimeout()
- Expect(pod.ExitCode()).To(BeZero())
+ Expect(pod).Should(Exit(0))
netName := "pod" + stringid.GenerateNonCryptoID()
session := podmanTest.Podman([]string{"network", "create", netName})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
defer podmanTest.removeCNINetwork(netName)
session = podmanTest.Podman([]string{"create", "--pod", name, "--network", netName, ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
})
It("create container in pod with ports should fail", func() {
name := "createwithports"
pod := podmanTest.RunTopContainerInPod("", "new:"+name)
pod.WaitWithDefaultTimeout()
- Expect(pod.ExitCode()).To(BeZero())
+ Expect(pod).Should(Exit(0))
session := podmanTest.Podman([]string{"create", "--pod", name, "-p", "8080:80", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).ToNot(BeZero())
+ Expect(session).Should(ExitWithError())
})
It("create container in pod ppublish ports should fail", func() {
name := "createwithpublishports"
pod := podmanTest.RunTopContainerInPod("", "new:"+name)
pod.WaitWithDefaultTimeout()
- Expect(pod.ExitCode()).To(BeZero())
+ Expect(pod).Should(Exit(0))
session := podmanTest.Podman([]string{"create", "--pod", name, "-P", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).ToNot(BeZero())
+ Expect(session).Should(ExitWithError())
})
It("create use local store image if input image contains a manifest list", func() {
session := podmanTest.Podman([]string{"pull", BB})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"manifest", "create", "mylist"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"manifest", "add", "--all", "mylist", BB})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"create", "mylist"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
})
It("podman create -d should fail, can not detach create containers", func() {
session := podmanTest.Podman([]string{"create", "-d", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
Expect(session.ErrorToString()).To(ContainSubstring("unknown shorthand flag"))
session = podmanTest.Podman([]string{"create", "--detach", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
Expect(session.ErrorToString()).To(ContainSubstring("unknown flag"))
session = podmanTest.Podman([]string{"create", "--detach-keys", "ctrl-x", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
Expect(session.ErrorToString()).To(ContainSubstring("unknown flag"))
})
It("podman create --platform", func() {
session := podmanTest.Podman([]string{"create", "--platform=linux/bogus", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
expectedError := "no image found in manifest list for architecture bogus"
Expect(session.ErrorToString()).To(ContainSubstring(expectedError))
session = podmanTest.Podman([]string{"create", "--platform=linux/arm64", "--os", "windows", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
expectedError = "--platform option can not be specified with --arch or --os"
Expect(session.ErrorToString()).To(ContainSubstring(expectedError))
session = podmanTest.Podman([]string{"create", "-q", "--platform=linux/arm64", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
setup := podmanTest.Podman([]string{"container", "inspect", session.OutputToString()})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
data := setup.InspectContainerToJSON()
setup = podmanTest.Podman([]string{"image", "inspect", data[0].Image})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
idata := setup.InspectImageJSON() // returns []inspect.ImageData
Expect(len(idata)).To(Equal(1))
diff --git a/test/e2e/diff_test.go b/test/e2e/diff_test.go
index cf955772b..65ec0d1de 100644
--- a/test/e2e/diff_test.go
+++ b/test/e2e/diff_test.go
@@ -9,6 +9,7 @@ import (
"github.com/containers/storage/pkg/stringid"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman diff", func() {
@@ -38,27 +39,27 @@ var _ = Describe("Podman diff", func() {
It("podman diff of image", func() {
session := podmanTest.Podman([]string{"diff", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 0))
})
It("podman diff bogus image", func() {
session := podmanTest.Podman([]string{"diff", "1234"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
It("podman diff image with json output", func() {
session := podmanTest.Podman([]string{"diff", "--format=json", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.IsJSONOutputValid()).To(BeTrue())
})
It("podman diff container and committed image", func() {
session := podmanTest.Podman([]string{"run", "--name=diff-test", ALPINE, "touch", "/tmp/diff-test"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"diff", "diff-test"})
session.WaitWithDefaultTimeout()
containerDiff := session.OutputToStringArray()
@@ -67,7 +68,7 @@ var _ = Describe("Podman diff", func() {
Expect(session.LineInOutputContains("A /tmp/diff-test")).To(BeTrue())
session = podmanTest.Podman([]string{"commit", "diff-test", "diff-test-img"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"diff", "diff-test-img"})
session.WaitWithDefaultTimeout()
imageDiff := session.OutputToStringArray()
@@ -78,7 +79,7 @@ var _ = Describe("Podman diff", func() {
It("podman diff latest container", func() {
session := podmanTest.Podman([]string{"run", "--name", "diff-test", ALPINE, "touch", "/tmp/diff-test"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
if !IsRemote() {
session = podmanTest.Podman([]string{"diff", "-l"})
} else {
@@ -89,7 +90,7 @@ var _ = Describe("Podman diff", func() {
sort.Strings(containerDiff)
Expect(session.LineInOutputContains("C /tmp")).To(BeTrue())
Expect(session.LineInOutputContains("A /tmp/diff-test")).To(BeTrue())
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman image diff", func() {
@@ -118,13 +119,13 @@ RUN echo test
session := podmanTest.Podman([]string{"image", "diff", image})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(BeNumerically("==", 1))
Expect(session.OutputToString()).To(Equal("A " + file3))
session = podmanTest.Podman([]string{"image", "diff", image, baseImage})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(BeNumerically("==", 4))
Expect(session.LineInOutputContains("A " + file1)).To(BeTrue())
Expect(session.LineInOutputContains("A " + file2)).To(BeTrue())
@@ -134,20 +135,20 @@ RUN echo test
It("podman image diff of single image", func() {
session := podmanTest.Podman([]string{"image", "diff", BB})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 0))
})
It("podman image diff bogus image", func() {
session := podmanTest.Podman([]string{"image", "diff", "1234", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
It("podman image diff of the same image", func() {
session := podmanTest.Podman([]string{"image", "diff", ALPINE, ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(BeNumerically("==", 0))
})
@@ -165,25 +166,25 @@ RUN touch %s`, ALPINE, imagefile)
session := podmanTest.Podman([]string{"run", "--name", name, ALPINE, "touch", confile})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// podman diff prefers image over container when they have the same name
session = podmanTest.Podman([]string{"diff", name})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(BeNumerically("==", 2))
Expect(session.OutputToString()).To(ContainSubstring(imagefile))
session = podmanTest.Podman([]string{"image", "diff", name})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(BeNumerically("==", 2))
Expect(session.OutputToString()).To(ContainSubstring(imagefile))
// container diff has to show the container
session = podmanTest.Podman([]string{"container", "diff", name})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(BeNumerically("==", 2))
Expect(session.OutputToString()).To(ContainSubstring(confile))
})
diff --git a/test/e2e/events_test.go b/test/e2e/events_test.go
index cc7c4d996..e2a169383 100644
--- a/test/e2e/events_test.go
+++ b/test/e2e/events_test.go
@@ -52,7 +52,7 @@ var _ = Describe("Podman events", func() {
Expect(ec).To(Equal(0))
result := podmanTest.Podman([]string{"events", "--stream=false"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(BeZero())
+ Expect(result).Should(Exit(0))
})
It("podman events with an event filter", func() {
@@ -61,7 +61,7 @@ var _ = Describe("Podman events", func() {
Expect(ec).To(Equal(0))
result := podmanTest.Podman([]string{"events", "--stream=false", "--filter", "event=start"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray()) >= 1)
})
@@ -75,7 +75,7 @@ var _ = Describe("Podman events", func() {
time.Sleep(5 * time.Second)
result := podmanTest.Podman([]string{"events", "--stream=false", "--filter", "event=start", "--filter", fmt.Sprintf("container=%s", cid)})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).To(Equal(1))
Expect(!strings.Contains(result.OutputToString(), cid2))
})
@@ -86,7 +86,7 @@ var _ = Describe("Podman events", func() {
Expect(ec).To(Equal(0))
result := podmanTest.Podman([]string{"events", "--stream=false", "--filter", "type=pod", "--filter", fmt.Sprintf("container=%s", cid)})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).To(Equal(0))
})
@@ -96,11 +96,11 @@ var _ = Describe("Podman events", func() {
setup.WaitWithDefaultTimeout()
stop := podmanTest.Podman([]string{"pod", "stop", "foobarpod"})
stop.WaitWithDefaultTimeout()
- Expect(stop.ExitCode()).To(Equal(0))
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(stop).Should(Exit(0))
+ Expect(setup).Should(Exit(0))
result := podmanTest.Podman([]string{"events", "--stream=false", "--filter", "type=pod", "--filter", "pod=foobarpod"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
fmt.Println(result.OutputToStringArray())
Expect(len(result.OutputToStringArray()) >= 2)
})
@@ -111,7 +111,7 @@ var _ = Describe("Podman events", func() {
Expect(ec).To(Equal(0))
result := podmanTest.Podman([]string{"events", "--stream=false", "--since", "1m"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(BeZero())
+ Expect(result).Should(Exit(0))
})
It("podman events --until", func() {
@@ -120,7 +120,7 @@ var _ = Describe("Podman events", func() {
Expect(ec).To(Equal(0))
result := podmanTest.Podman([]string{"events", "--stream=false", "--until", "1h"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(BeZero())
+ Expect(result).Should(Exit(0))
})
It("podman events format", func() {
@@ -157,7 +157,7 @@ var _ = Describe("Podman events", func() {
name3 := stringid.GenerateNonCryptoID()
session := podmanTest.Podman([]string{"create", "--name", name1, ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
var wg sync.WaitGroup
wg.Add(1)
@@ -169,17 +169,17 @@ var _ = Describe("Podman events", func() {
time.Sleep(time.Second * 2)
session = podmanTest.Podman([]string{"create", "--name", name2, ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"create", "--name", name3, ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
}()
// unix timestamp in 10 seconds
until := time.Now().Add(time.Second * 10).Unix()
result := podmanTest.Podman([]string{"events", "--since", "30s", "--until", fmt.Sprint(until)})
result.Wait(11)
- Expect(result.ExitCode()).To(BeZero())
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(ContainSubstring(name1))
Expect(result.OutputToString()).To(ContainSubstring(name2))
Expect(result.OutputToString()).To(ContainSubstring(name3))
diff --git a/test/e2e/exec_test.go b/test/e2e/exec_test.go
index e6f63a391..02680e739 100644
--- a/test/e2e/exec_test.go
+++ b/test/e2e/exec_test.go
@@ -8,6 +8,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman exec", func() {
@@ -37,61 +38,61 @@ var _ = Describe("Podman exec", func() {
It("podman exec into bogus container", func() {
session := podmanTest.Podman([]string{"exec", "foobar", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
It("podman exec without command", func() {
session := podmanTest.Podman([]string{"exec", "foobar"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
It("podman exec simple command", func() {
setup := podmanTest.RunTopContainer("test1")
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
session := podmanTest.Podman([]string{"exec", "test1", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman container exec simple command", func() {
setup := podmanTest.RunTopContainer("test1")
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
session := podmanTest.Podman([]string{"container", "exec", "test1", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman exec simple command using latest", func() {
setup := podmanTest.RunTopContainer("test1")
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
cid := "-l"
if IsRemote() {
cid = "test1"
}
session := podmanTest.Podman([]string{"exec", cid, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman exec environment test", func() {
setup := podmanTest.RunTopContainer("test1")
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
session := podmanTest.Podman([]string{"exec", "--env", "FOO=BAR", "test1", "printenv", "FOO"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("BAR"))
session = podmanTest.Podman([]string{"exec", "--env", "PATH=/bin", "test1", "printenv", "PATH"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("/bin"))
})
@@ -99,12 +100,12 @@ var _ = Describe("Podman exec", func() {
// remote doesn't properly interpret os.Setenv
setup := podmanTest.RunTopContainer("test1")
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
os.Setenv("FOO", "BAR")
session := podmanTest.Podman([]string{"exec", "--env", "FOO", "test1", "printenv", "FOO"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("BAR"))
os.Unsetenv("FOO")
})
@@ -112,11 +113,11 @@ var _ = Describe("Podman exec", func() {
It("podman exec exit code", func() {
setup := podmanTest.RunTopContainer("test1")
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
session := podmanTest.Podman([]string{"exec", "test1", "sh", "-c", "exit 100"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(100))
+ Expect(session).Should(Exit(100))
})
It("podman exec in keep-id container drops privileges", func() {
@@ -124,63 +125,63 @@ var _ = Describe("Podman exec", func() {
ctrName := "testctr1"
testCtr := podmanTest.Podman([]string{"run", "-d", "--name", ctrName, "--userns=keep-id", ALPINE, "top"})
testCtr.WaitWithDefaultTimeout()
- Expect(testCtr.ExitCode()).To(Equal(0))
+ Expect(testCtr).Should(Exit(0))
session := podmanTest.Podman([]string{"exec", ctrName, "grep", "CapEff", "/proc/self/status"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("0000000000000000"))
})
It("podman exec --privileged", func() {
session := podmanTest.Podman([]string{"run", "--privileged", "--rm", ALPINE, "sh", "-c", "grep ^CapBnd /proc/self/status | cut -f 2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
bndPerms := session.OutputToString()
session = podmanTest.Podman([]string{"run", "--privileged", "--rm", ALPINE, "sh", "-c", "grep ^CapEff /proc/self/status | cut -f 2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
effPerms := session.OutputToString()
setup := podmanTest.RunTopContainer("test-privileged")
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
session = podmanTest.Podman([]string{"exec", "--privileged", "test-privileged", "sh", "-c", "grep ^CapEff /proc/self/status | cut -f 2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(effPerms))
session = podmanTest.Podman([]string{"exec", "--privileged", "test-privileged", "sh", "-c", "grep ^CapBnd /proc/self/status | cut -f 2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(bndPerms))
})
It("podman exec --privileged", func() {
session := podmanTest.Podman([]string{"run", "--privileged", "--user=bin", "--rm", ALPINE, "sh", "-c", "grep ^CapBnd /proc/self/status | cut -f 2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
bndPerms := session.OutputToString()
session = podmanTest.Podman([]string{"run", "--privileged", "--user=bin", "--rm", ALPINE, "sh", "-c", "grep ^CapEff /proc/self/status | cut -f 2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
effPerms := session.OutputToString()
setup := podmanTest.RunTopContainer("test-privileged")
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
session = podmanTest.Podman([]string{"exec", "--privileged", "--user=bin", "test-privileged", "sh", "-c", "grep ^CapEff /proc/self/status | cut -f 2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(effPerms))
session = podmanTest.Podman([]string{"exec", "--privileged", "--user=bin", "test-privileged", "sh", "-c", "grep ^CapBnd /proc/self/status | cut -f 2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(bndPerms))
})
@@ -188,52 +189,52 @@ var _ = Describe("Podman exec", func() {
It("podman exec --privileged", func() {
session := podmanTest.Podman([]string{"run", "--privileged", "--rm", ALPINE, "sh", "-c", "grep ^CapBnd /proc/self/status | cut -f 2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
bndPerms := session.OutputToString()
setup := podmanTest.RunTopContainer("test-privileged")
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
session = podmanTest.Podman([]string{"exec", "--privileged", "--user=bin", "test-privileged", "sh", "-c", "grep ^CapEff /proc/self/status | cut -f 2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("00000000"))
session = podmanTest.Podman([]string{"exec", "--privileged", "--user=bin", "test-privileged", "sh", "-c", "grep ^CapBnd /proc/self/status | cut -f 2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(bndPerms))
})
It("podman exec --privileged container not running as root", func() {
session := podmanTest.Podman([]string{"run", "--privileged", "--rm", ALPINE, "sh", "-c", "grep ^CapBnd /proc/self/status | cut -f 2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
bndPerms := session.OutputToString()
setup := podmanTest.RunTopContainerWithArgs("test-privileged", []string{"--user=bin"})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
session = podmanTest.Podman([]string{"exec", "--privileged", "test-privileged", "sh", "-c", "grep ^CapEff /proc/self/status | cut -f 2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("00000000"))
session = podmanTest.Podman([]string{"exec", "--privileged", "--user=bin", "test-privileged", "sh", "-c", "grep ^CapEff /proc/self/status | cut -f 2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("00000000"))
session = podmanTest.Podman([]string{"exec", "--privileged", "--user=root", "test-privileged", "sh", "-c", "grep ^CapEff /proc/self/status | cut -f 2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(bndPerms))
session = podmanTest.Podman([]string{"exec", "--privileged", "--user=bin", "test-privileged", "sh", "-c", "grep ^CapBnd /proc/self/status | cut -f 2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(bndPerms))
})
@@ -241,26 +242,26 @@ var _ = Describe("Podman exec", func() {
capAdd := "--cap-add=net_bind_service"
session := podmanTest.Podman([]string{"run", "--user=bin", capAdd, "--rm", ALPINE, "sh", "-c", "grep ^CapBnd /proc/self/status | cut -f 2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
bndPerms := session.OutputToString()
session = podmanTest.Podman([]string{"run", "--user=bin", capAdd, "--rm", ALPINE, "sh", "-c", "grep ^CapEff /proc/self/status | cut -f 2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
effPerms := session.OutputToString()
setup := podmanTest.RunTopContainerWithArgs("test-privileged", []string{"--user=bin", capAdd})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
session = podmanTest.Podman([]string{"exec", "test-privileged", "sh", "-c", "grep ^CapBnd /proc/self/status | cut -f 2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(bndPerms))
session = podmanTest.Podman([]string{"exec", "test-privileged", "sh", "-c", "grep ^CapEff /proc/self/status | cut -f 2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(effPerms))
})
@@ -269,111 +270,111 @@ var _ = Describe("Podman exec", func() {
capDrop := "--cap-drop=all"
session := podmanTest.Podman([]string{"run", "--user=bin", capDrop, capAdd, "--rm", ALPINE, "sh", "-c", "grep ^CapBnd /proc/self/status | cut -f 2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
bndPerms := session.OutputToString()
session = podmanTest.Podman([]string{"run", "--user=bin", capDrop, capAdd, "--rm", ALPINE, "sh", "-c", "grep ^CapEff /proc/self/status | cut -f 2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
effPerms := session.OutputToString()
setup := podmanTest.RunTopContainerWithArgs("test-privileged", []string{"--user=bin", capDrop, capAdd})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
session = podmanTest.Podman([]string{"exec", "test-privileged", "sh", "-c", "grep ^CapBnd /proc/self/status | cut -f 2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(bndPerms))
session = podmanTest.Podman([]string{"exec", "--privileged", "test-privileged", "sh", "-c", "grep ^CapInh /proc/self/status | cut -f 2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(effPerms))
session = podmanTest.Podman([]string{"exec", "test-privileged", "sh", "-c", "grep ^CapEff /proc/self/status | cut -f 2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(effPerms))
session = podmanTest.Podman([]string{"exec", "test-privileged", "sh", "-c", "grep ^CapPrm /proc/self/status | cut -f 2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(effPerms))
session = podmanTest.Podman([]string{"exec", "test-privileged", "sh", "-c", "grep ^CapAmb /proc/self/status | cut -f 2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(effPerms))
})
It("podman exec --privileged with user", func() {
session := podmanTest.Podman([]string{"run", "--privileged", "--user=bin", "--rm", ALPINE, "sh", "-c", "grep ^CapBnd /proc/self/status | cut -f 2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
bindPerms := session.OutputToString()
setup := podmanTest.RunTopContainerWithArgs("test-privileged", []string{"--privileged", "--user=bin"})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
session = podmanTest.Podman([]string{"exec", "--privileged", "test-privileged", "sh", "-c", "grep ^CapBnd /proc/self/status | cut -f 2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(bindPerms))
session = podmanTest.Podman([]string{"exec", "--privileged", "test-privileged", "sh", "-c", "grep ^CapEff /proc/self/status | cut -f 2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("0000000000000000"))
})
It("podman exec terminal doesn't hang", func() {
setup := podmanTest.Podman([]string{"run", "-dti", "--name", "test1", fedoraMinimal, "sleep", "+Inf"})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
for i := 0; i < 5; i++ {
session := podmanTest.Podman([]string{"exec", "-ti", "test1", "true"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
}
})
It("podman exec pseudo-terminal sanity check", func() {
setup := podmanTest.Podman([]string{"run", "--detach", "--name", "test1", fedoraMinimal, "sleep", "+Inf"})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
session := podmanTest.Podman([]string{"exec", "--interactive", "--tty", "test1", "/usr/bin/stty", "--all"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(" onlcr"))
})
It("podman exec simple command with user", func() {
setup := podmanTest.RunTopContainer("test1")
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
session := podmanTest.Podman([]string{"exec", "--user", "root", "test1", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman exec with user only in container", func() {
testUser := "test123"
setup := podmanTest.Podman([]string{"run", "--name", "test1", "-d", fedoraMinimal, "sleep", "60"})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
session := podmanTest.Podman([]string{"exec", "test1", "useradd", testUser})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session2 := podmanTest.Podman([]string{"exec", "--user", testUser, "test1", "whoami"})
session2.WaitWithDefaultTimeout()
- Expect(session2.ExitCode()).To(Equal(0))
+ Expect(session2).Should(Exit(0))
Expect(session2.OutputToString()).To(Equal(testUser))
})
@@ -381,41 +382,41 @@ var _ = Describe("Podman exec", func() {
testUser := "guest"
setup := podmanTest.Podman([]string{"run", "--user", testUser, "-d", ALPINE, "top"})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
ctrID := setup.OutputToString()
session := podmanTest.Podman([]string{"exec", ctrID, "whoami"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(testUser))
overrideUser := "root"
session = podmanTest.Podman([]string{"exec", "--user", overrideUser, ctrID, "whoami"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(overrideUser))
})
It("podman exec simple working directory test", func() {
setup := podmanTest.RunTopContainer("test1")
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
session := podmanTest.Podman([]string{"exec", "--workdir", "/tmp", "test1", "pwd"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("/tmp"))
session = podmanTest.Podman([]string{"exec", "-w", "/tmp", "test1", "pwd"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("/tmp"))
})
It("podman exec missing working directory test", func() {
setup := podmanTest.RunTopContainer("test1")
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
session := podmanTest.Podman([]string{"exec", "--workdir", "/missing", "test1", "pwd"})
session.WaitWithDefaultTimeout()
@@ -429,27 +430,27 @@ var _ = Describe("Podman exec", func() {
It("podman exec cannot be invoked", func() {
setup := podmanTest.RunTopContainer("test1")
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
session := podmanTest.Podman([]string{"exec", "test1", "/etc"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(126))
+ Expect(session).Should(Exit(126))
})
It("podman exec command not found", func() {
setup := podmanTest.RunTopContainer("test1")
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
session := podmanTest.Podman([]string{"exec", "test1", "notthere"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(127))
+ Expect(session).Should(Exit(127))
})
It("podman exec preserve fds sanity check", func() {
setup := podmanTest.RunTopContainer("test1")
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
devNull, err := os.Open("/dev/null")
Expect(err).To(BeNil())
@@ -459,7 +460,7 @@ var _ = Describe("Podman exec", func() {
}
session := podmanTest.PodmanExtraFiles([]string{"exec", "--preserve-fds", "1", "test1", "ls"}, files)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman exec preserves --group-add groups", func() {
@@ -468,21 +469,21 @@ var _ = Describe("Podman exec", func() {
ctrName1 := "ctr1"
ctr1 := podmanTest.Podman([]string{"run", "-ti", "--name", ctrName1, fedoraMinimal, "groupadd", "-g", gid, groupName})
ctr1.WaitWithDefaultTimeout()
- Expect(ctr1.ExitCode()).To(Equal(0))
+ Expect(ctr1).Should(Exit(0))
imgName := "img1"
commit := podmanTest.Podman([]string{"commit", ctrName1, imgName})
commit.WaitWithDefaultTimeout()
- Expect(commit.ExitCode()).To(Equal(0))
+ Expect(commit).Should(Exit(0))
ctrName2 := "ctr2"
ctr2 := podmanTest.Podman([]string{"run", "-d", "--name", ctrName2, "--group-add", groupName, imgName, "sleep", "300"})
ctr2.WaitWithDefaultTimeout()
- Expect(ctr2.ExitCode()).To(Equal(0))
+ Expect(ctr2).Should(Exit(0))
exec := podmanTest.Podman([]string{"exec", "-ti", ctrName2, "id"})
exec.WaitWithDefaultTimeout()
- Expect(exec.ExitCode()).To(Equal(0))
+ Expect(exec).Should(Exit(0))
Expect(exec.OutputToString()).To(ContainSubstring(fmt.Sprintf("%s(%s)", gid, groupName)))
})
@@ -497,11 +498,11 @@ RUN useradd -u 1000 auser`, fedoraMinimal)
ctrName := "testctr"
ctr := podmanTest.Podman([]string{"run", "-t", "-i", "-d", "--name", ctrName, "--user", "auser:first", "--group-add", "second", imgName, "sleep", "300"})
ctr.WaitWithDefaultTimeout()
- Expect(ctr.ExitCode()).To(Equal(0))
+ Expect(ctr).Should(Exit(0))
exec := podmanTest.Podman([]string{"exec", "-t", ctrName, "id"})
exec.WaitWithDefaultTimeout()
- Expect(exec.ExitCode()).To(Equal(0))
+ Expect(exec).Should(Exit(0))
output := exec.OutputToString()
Expect(output).To(ContainSubstring("4000(first)"))
Expect(output).To(ContainSubstring("4001(second)"))
@@ -510,18 +511,18 @@ RUN useradd -u 1000 auser`, fedoraMinimal)
// Kill the container just so the test does not take 15 seconds to stop.
kill := podmanTest.Podman([]string{"kill", ctrName})
kill.WaitWithDefaultTimeout()
- Expect(kill.ExitCode()).To(Equal(0))
+ Expect(kill).Should(Exit(0))
})
It("podman exec --detach", func() {
ctrName := "testctr"
ctr := podmanTest.Podman([]string{"run", "-t", "-i", "-d", "--name", ctrName, ALPINE, "top"})
ctr.WaitWithDefaultTimeout()
- Expect(ctr.ExitCode()).To(Equal(0))
+ Expect(ctr).Should(Exit(0))
exec1 := podmanTest.Podman([]string{"exec", "-t", "-i", "-d", ctrName, "top"})
exec1.WaitWithDefaultTimeout()
- Expect(ctr.ExitCode()).To(Equal(0))
+ Expect(ctr).Should(Exit(0))
data := podmanTest.InspectContainer(ctrName)
Expect(len(data)).To(Equal(1))
@@ -530,13 +531,13 @@ RUN useradd -u 1000 auser`, fedoraMinimal)
exec2 := podmanTest.Podman([]string{"exec", "-t", "-i", ctrName, "ps", "-a"})
exec2.WaitWithDefaultTimeout()
- Expect(ctr.ExitCode()).To(Equal(0))
+ Expect(ctr).Should(Exit(0))
Expect(strings.Count(exec2.OutputToString(), "top")).To(Equal(2))
// Ensure that stop with a running detached exec session is
// clean.
stop := podmanTest.Podman([]string{"stop", ctrName})
stop.WaitWithDefaultTimeout()
- Expect(stop.ExitCode()).To(Equal(0))
+ Expect(stop).Should(Exit(0))
})
})
diff --git a/test/e2e/exists_test.go b/test/e2e/exists_test.go
index f0a55dd94..260b6d5f2 100644
--- a/test/e2e/exists_test.go
+++ b/test/e2e/exists_test.go
@@ -50,7 +50,7 @@ var _ = Describe("Podman image|container exists", func() {
It("podman container exists in local storage by name", func() {
setup := podmanTest.RunTopContainer("foobar")
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
session := podmanTest.Podman([]string{"container", "exists", "foobar"})
session.WaitWithDefaultTimeout()
@@ -69,7 +69,7 @@ var _ = Describe("Podman image|container exists", func() {
It("podman container exists in local storage by short container ID", func() {
setup := podmanTest.RunTopContainer("")
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
cid := setup.OutputToString()[0:12]
session := podmanTest.Podman([]string{"container", "exists", cid})
diff --git a/test/e2e/export_test.go b/test/e2e/export_test.go
index 61aebb5f2..a9dd09d8e 100644
--- a/test/e2e/export_test.go
+++ b/test/e2e/export_test.go
@@ -7,6 +7,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman export", func() {
@@ -40,7 +41,7 @@ var _ = Describe("Podman export", func() {
outfile := filepath.Join(podmanTest.TempDir, "container.tar")
result := podmanTest.Podman([]string{"export", "-o", outfile, cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
_, err := os.Stat(outfile)
Expect(err).To(BeNil())
@@ -55,7 +56,7 @@ var _ = Describe("Podman export", func() {
outfile := filepath.Join(podmanTest.TempDir, "container.tar")
result := podmanTest.Podman([]string{"container", "export", "-o", outfile, cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
_, err := os.Stat(outfile)
Expect(err).To(BeNil())
diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go
index 4c0fc6db0..8996bf6a0 100644
--- a/test/e2e/generate_kube_test.go
+++ b/test/e2e/generate_kube_test.go
@@ -11,6 +11,7 @@ import (
"github.com/ghodss/yaml"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
v1 "k8s.io/api/core/v1"
)
@@ -53,11 +54,11 @@ var _ = Describe("Podman generate kube", func() {
It("podman generate kube on container", func() {
session := podmanTest.RunTopContainer("top")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
kube := podmanTest.Podman([]string{"generate", "kube", "top"})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.Out.Contents(), pod)
@@ -74,11 +75,11 @@ var _ = Describe("Podman generate kube", func() {
It("podman generate service kube on container with --security-opt level", func() {
session := podmanTest.Podman([]string{"create", "--name", "test", "--security-opt", "label=level:s0:c100,c200", "alpine"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
kube := podmanTest.Podman([]string{"generate", "kube", "test"})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.Out.Contents(), pod)
@@ -89,11 +90,11 @@ var _ = Describe("Podman generate kube", func() {
It("podman generate service kube on container with --security-opt disable", func() {
session := podmanTest.Podman([]string{"create", "--name", "test-disable", "--security-opt", "label=disable", "alpine"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
kube := podmanTest.Podman([]string{"generate", "kube", "test-disable"})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
pod := new(v1.Pod)
err = yaml.Unmarshal(kube.Out.Contents(), pod)
@@ -104,11 +105,11 @@ var _ = Describe("Podman generate kube", func() {
It("podman generate service kube on container with --security-opt type", func() {
session := podmanTest.Podman([]string{"create", "--name", "test", "--security-opt", "label=type:foo_bar_t", "alpine"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
kube := podmanTest.Podman([]string{"generate", "kube", "test"})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
pod := new(v1.Pod)
err = yaml.Unmarshal(kube.Out.Contents(), pod)
@@ -119,11 +120,11 @@ var _ = Describe("Podman generate kube", func() {
It("podman generate service kube on container", func() {
session := podmanTest.RunTopContainer("top")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
kube := podmanTest.Podman([]string{"generate", "kube", "-s", "top"})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
// TODO - test generated YAML - service produces multiple
// structs.
@@ -138,11 +139,11 @@ var _ = Describe("Podman generate kube", func() {
session := podmanTest.RunTopContainerInPod("topcontainer", "toppod")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
kube := podmanTest.Podman([]string{"generate", "kube", "toppod"})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.Out.Contents(), pod)
@@ -159,15 +160,15 @@ var _ = Describe("Podman generate kube", func() {
It("podman generate kube multiple pods", func() {
pod1 := podmanTest.Podman([]string{"run", "-dt", "--pod", "new:pod1", ALPINE, "top"})
pod1.WaitWithDefaultTimeout()
- Expect(pod1.ExitCode()).To(Equal(0))
+ Expect(pod1).Should(Exit(0))
pod2 := podmanTest.Podman([]string{"run", "-dt", "--pod", "new:pod2", ALPINE, "top"})
pod2.WaitWithDefaultTimeout()
- Expect(pod2.ExitCode()).To(Equal(0))
+ Expect(pod2).Should(Exit(0))
kube := podmanTest.Podman([]string{"generate", "kube", "pod1", "pod2"})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
Expect(string(kube.Out.Contents())).To(ContainSubstring(`name: pod1`))
Expect(string(kube.Out.Contents())).To(ContainSubstring(`name: pod2`))
@@ -176,15 +177,15 @@ var _ = Describe("Podman generate kube", func() {
It("podman generate kube on pod with host network", func() {
podSession := podmanTest.Podman([]string{"pod", "create", "--name", "testHostNetwork", "--network", "host"})
podSession.WaitWithDefaultTimeout()
- Expect(podSession.ExitCode()).To(Equal(0))
+ Expect(podSession).Should(Exit(0))
session := podmanTest.Podman([]string{"create", "--name", "topcontainer", "--pod", "testHostNetwork", "--network", "host", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
kube := podmanTest.Podman([]string{"generate", "kube", "testHostNetwork"})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.Out.Contents(), pod)
@@ -195,11 +196,11 @@ var _ = Describe("Podman generate kube", func() {
It("podman generate kube on container with host network", func() {
session := podmanTest.RunTopContainerWithArgs("topcontainer", []string{"--network", "host"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
kube := podmanTest.Podman([]string{"generate", "kube", "topcontainer"})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.Out.Contents(), pod)
@@ -215,21 +216,21 @@ var _ = Describe("Podman generate kube", func() {
"--add-host", "test2.podman.io" + ":" + testIP,
})
podSession.WaitWithDefaultTimeout()
- Expect(podSession.ExitCode()).To(Equal(0))
+ Expect(podSession).Should(Exit(0))
ctr1Name := "ctr1"
ctr1Session := podmanTest.Podman([]string{"create", "--name", ctr1Name, "--pod", podName, ALPINE, "top"})
ctr1Session.WaitWithDefaultTimeout()
- Expect(ctr1Session.ExitCode()).To(Equal(0))
+ Expect(ctr1Session).Should(Exit(0))
ctr2Name := "ctr2"
ctr2Session := podmanTest.Podman([]string{"create", "--name", ctr2Name, "--pod", podName, ALPINE, "top"})
ctr2Session.WaitWithDefaultTimeout()
- Expect(ctr2Session.ExitCode()).To(Equal(0))
+ Expect(ctr2Session).Should(Exit(0))
kube := podmanTest.Podman([]string{"generate", "kube", podName})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.Out.Contents(), pod)
@@ -245,11 +246,11 @@ var _ = Describe("Podman generate kube", func() {
session := podmanTest.RunTopContainerInPod("topcontainer", "toppod")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
kube := podmanTest.Podman([]string{"generate", "kube", "-s", "toppod"})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
// TODO: How do we test unmarshal with a service? We have two
// structs that need to be unmarshalled...
@@ -270,17 +271,17 @@ var _ = Describe("Podman generate kube", func() {
podName := v[0]
podSession := podmanTest.Podman([]string{"pod", "create", "--name", podName})
podSession.WaitWithDefaultTimeout()
- Expect(podSession.ExitCode()).To(Equal(0))
+ Expect(podSession).Should(Exit(0))
ctrName := "ctr" + strconv.Itoa(k)
ctr1Session := podmanTest.Podman([]string{"create", "--name", ctrName, "--pod", podName,
"--restart", v[1], ALPINE, "top"})
ctr1Session.WaitWithDefaultTimeout()
- Expect(ctr1Session.ExitCode()).To(Equal(0))
+ Expect(ctr1Session).Should(Exit(0))
kube := podmanTest.Podman([]string{"generate", "kube", podName})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.Out.Contents(), pod)
@@ -294,16 +295,16 @@ var _ = Describe("Podman generate kube", func() {
podName := "testMemoryLimit"
podSession := podmanTest.Podman([]string{"pod", "create", "--name", podName})
podSession.WaitWithDefaultTimeout()
- Expect(podSession.ExitCode()).To(Equal(0))
+ Expect(podSession).Should(Exit(0))
ctr1Name := "ctr1"
ctr1Session := podmanTest.Podman([]string{"create", "--name", ctr1Name, "--pod", podName, "--memory", "10Mi", ALPINE, "top"})
ctr1Session.WaitWithDefaultTimeout()
- Expect(ctr1Session.ExitCode()).To(Equal(0))
+ Expect(ctr1Session).Should(Exit(0))
kube := podmanTest.Podman([]string{"generate", "kube", podName})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.Out.Contents(), pod)
@@ -319,23 +320,23 @@ var _ = Describe("Podman generate kube", func() {
podName := "testCpuLimit"
podSession := podmanTest.Podman([]string{"pod", "create", "--name", podName})
podSession.WaitWithDefaultTimeout()
- Expect(podSession.ExitCode()).To(Equal(0))
+ Expect(podSession).Should(Exit(0))
ctr1Name := "ctr1"
ctr1Session := podmanTest.Podman([]string{"create", "--name", ctr1Name, "--pod", podName,
"--cpus", "0.5", ALPINE, "top"})
ctr1Session.WaitWithDefaultTimeout()
- Expect(ctr1Session.ExitCode()).To(Equal(0))
+ Expect(ctr1Session).Should(Exit(0))
ctr2Name := "ctr2"
ctr2Session := podmanTest.Podman([]string{"create", "--name", ctr2Name, "--pod", podName,
"--cpu-period", "100000", "--cpu-quota", "50000", ALPINE, "top"})
ctr2Session.WaitWithDefaultTimeout()
- Expect(ctr2Session.ExitCode()).To(Equal(0))
+ Expect(ctr2Session).Should(Exit(0))
kube := podmanTest.Podman([]string{"generate", "kube", podName})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.Out.Contents(), pod)
@@ -351,21 +352,21 @@ var _ = Describe("Podman generate kube", func() {
podName := "test"
podSession := podmanTest.Podman([]string{"pod", "create", "--name", podName, "-p", "4000:4000", "-p", "5000:5000"})
podSession.WaitWithDefaultTimeout()
- Expect(podSession.ExitCode()).To(Equal(0))
+ Expect(podSession).Should(Exit(0))
ctr1Name := "ctr1"
ctr1Session := podmanTest.Podman([]string{"create", "--name", ctr1Name, "--pod", podName, ALPINE, "top"})
ctr1Session.WaitWithDefaultTimeout()
- Expect(ctr1Session.ExitCode()).To(Equal(0))
+ Expect(ctr1Session).Should(Exit(0))
ctr2Name := "ctr2"
ctr2Session := podmanTest.Podman([]string{"create", "--name", ctr2Name, "--pod", podName, ALPINE, "top"})
ctr2Session.WaitWithDefaultTimeout()
- Expect(ctr2Session.ExitCode()).To(Equal(0))
+ Expect(ctr2Session).Should(Exit(0))
kube := podmanTest.Podman([]string{"generate", "kube", podName})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.Out.Contents(), pod)
@@ -397,33 +398,33 @@ var _ = Describe("Podman generate kube", func() {
session := podmanTest.Podman([]string{"create", "--pod", podName, "--name", "test1", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session2 := podmanTest.Podman([]string{"create", "--pod", podName, "--name", "test2", ALPINE, "top"})
session2.WaitWithDefaultTimeout()
- Expect(session2.ExitCode()).To(Equal(0))
+ Expect(session2).Should(Exit(0))
outputFile := filepath.Join(podmanTest.RunRoot, "pod.yaml")
kube := podmanTest.Podman([]string{"generate", "kube", "-f", outputFile, podName})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
session3 := podmanTest.Podman([]string{"pod", "rm", "-af"})
session3.WaitWithDefaultTimeout()
- Expect(session3.ExitCode()).To(Equal(0))
+ Expect(session3).Should(Exit(0))
session4 := podmanTest.Podman([]string{"play", "kube", outputFile})
session4.WaitWithDefaultTimeout()
- Expect(session4.ExitCode()).To(Equal(0))
+ Expect(session4).Should(Exit(0))
session5 := podmanTest.Podman([]string{"pod", "ps"})
session5.WaitWithDefaultTimeout()
- Expect(session5.ExitCode()).To(Equal(0))
+ Expect(session5).Should(Exit(0))
Expect(session5.OutputToString()).To(ContainSubstring(podName))
session6 := podmanTest.Podman([]string{"ps", "-a"})
session6.WaitWithDefaultTimeout()
- Expect(session6.ExitCode()).To(Equal(0))
+ Expect(session6).Should(Exit(0))
psOut := session6.OutputToString()
Expect(psOut).To(ContainSubstring("test1"))
Expect(psOut).To(ContainSubstring("test2"))
@@ -436,31 +437,31 @@ var _ = Describe("Podman generate kube", func() {
session := podmanTest.Podman([]string{"create", "--pod", podName, "--name", "test1", "--user", "100:200", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", "--format", "{{.Config.User}}", "test1"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring("100:200"))
outputFile := filepath.Join(podmanTest.RunRoot, "pod.yaml")
kube := podmanTest.Podman([]string{"generate", "kube", "-f", outputFile, podName})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
session = podmanTest.Podman([]string{"pod", "rm", "-af"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
podmanTest.AddImageToRWStore(ALPINE)
session = podmanTest.Podman([]string{"play", "kube", outputFile})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// container name in pod is <podName>-<ctrName>
inspect1 := podmanTest.Podman([]string{"inspect", "--format", "{{.Config.User}}", "toppod-test1"})
inspect1.WaitWithDefaultTimeout()
- Expect(inspect1.ExitCode()).To(Equal(0))
+ Expect(inspect1).Should(Exit(0))
Expect(inspect1.OutputToString()).To(ContainSubstring(inspect.OutputToString()))
})
@@ -475,24 +476,24 @@ var _ = Describe("Podman generate kube", func() {
session1 := podmanTest.Podman([]string{"run", "-d", "--pod", "new:test1", "--name", ctrName, "-v", vol1 + ":/volume/:z", "alpine", "top"})
session1.WaitWithDefaultTimeout()
- Expect(session1.ExitCode()).To(Equal(0))
+ Expect(session1).Should(Exit(0))
outputFile := filepath.Join(podmanTest.RunRoot, "pod.yaml")
kube := podmanTest.Podman([]string{"generate", "kube", "test1", "-f", outputFile})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
rm := podmanTest.Podman([]string{"pod", "rm", "-f", "test1"})
rm.WaitWithDefaultTimeout()
- Expect(rm.ExitCode()).To(Equal(0))
+ Expect(rm).Should(Exit(0))
play := podmanTest.Podman([]string{"play", "kube", outputFile})
play.WaitWithDefaultTimeout()
- Expect(play.ExitCode()).To(Equal(0))
+ Expect(play).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", ctrNameInKubePod})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring(vol1))
})
@@ -505,11 +506,11 @@ var _ = Describe("Podman generate kube", func() {
"-v", "/root:/volume2/",
"alpine", "top"})
session1.WaitWithDefaultTimeout()
- Expect(session1.ExitCode()).To(Equal(0))
+ Expect(session1).Should(Exit(0))
kube := podmanTest.Podman([]string{"generate", "kube", "mount-root-conflict"})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.Out.Contents(), pod)
@@ -528,24 +529,24 @@ var _ = Describe("Podman generate kube", func() {
session := podmanTest.Podman([]string{"run", "-d", "--pod", "new:test1", "--name", ctrName, "-v", vol + ":/volume/:z", "alpine", "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
outputFile := filepath.Join(podmanTest.RunRoot, "pod.yaml")
kube := podmanTest.Podman([]string{"generate", "kube", "test1", "-f", outputFile})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
rm := podmanTest.Podman([]string{"pod", "rm", "-f", "test1"})
rm.WaitWithDefaultTimeout()
- Expect(rm.ExitCode()).To(Equal(0))
+ Expect(rm).Should(Exit(0))
play := podmanTest.Podman([]string{"play", "kube", outputFile})
play.WaitWithDefaultTimeout()
- Expect(play.ExitCode()).To(Equal(0))
+ Expect(play).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", ctrNameInKubePod})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring(vol))
})
@@ -553,95 +554,95 @@ var _ = Describe("Podman generate kube", func() {
podName := "test"
podSession := podmanTest.Podman([]string{"pod", "create", "--name", podName, "--share", "pid"})
podSession.WaitWithDefaultTimeout()
- Expect(podSession.ExitCode()).To(Equal(0))
+ Expect(podSession).Should(Exit(0))
session := podmanTest.Podman([]string{"create", "--pod", podName, "--name", "test1", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
outputFile := filepath.Join(podmanTest.RunRoot, "pod.yaml")
kube := podmanTest.Podman([]string{"generate", "kube", podName, "-f", outputFile})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
rm := podmanTest.Podman([]string{"pod", "rm", "-f", podName})
rm.WaitWithDefaultTimeout()
- Expect(rm.ExitCode()).To(Equal(0))
+ Expect(rm).Should(Exit(0))
play := podmanTest.Podman([]string{"play", "kube", outputFile})
play.WaitWithDefaultTimeout()
- Expect(play.ExitCode()).To(Equal(0))
+ Expect(play).Should(Exit(0))
inspect := podmanTest.Podman([]string{"pod", "inspect", podName})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring(`"pid"`))
})
It("podman generate kube with pods and containers", func() {
pod1 := podmanTest.Podman([]string{"run", "-dt", "--pod", "new:pod1", ALPINE, "top"})
pod1.WaitWithDefaultTimeout()
- Expect(pod1.ExitCode()).To(Equal(0))
+ Expect(pod1).Should(Exit(0))
pod2 := podmanTest.Podman([]string{"run", "-dt", "--name", "top", ALPINE, "top"})
pod2.WaitWithDefaultTimeout()
- Expect(pod2.ExitCode()).To(Equal(0))
+ Expect(pod2).Should(Exit(0))
kube := podmanTest.Podman([]string{"generate", "kube", "pod1", "top"})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
})
It("podman generate kube with containers in a pod should fail", func() {
pod1 := podmanTest.Podman([]string{"pod", "create", "--name", "pod1"})
pod1.WaitWithDefaultTimeout()
- Expect(pod1.ExitCode()).To(Equal(0))
+ Expect(pod1).Should(Exit(0))
con := podmanTest.Podman([]string{"run", "-dt", "--pod", "pod1", "--name", "top", ALPINE, "top"})
con.WaitWithDefaultTimeout()
- Expect(con.ExitCode()).To(Equal(0))
+ Expect(con).Should(Exit(0))
kube := podmanTest.Podman([]string{"generate", "kube", "top"})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).ToNot(Equal(0))
+ Expect(kube).To(ExitWithError())
})
It("podman generate kube with multiple containers", func() {
con1 := podmanTest.Podman([]string{"run", "-dt", "--name", "con1", ALPINE, "top"})
con1.WaitWithDefaultTimeout()
- Expect(con1.ExitCode()).To(Equal(0))
+ Expect(con1).Should(Exit(0))
con2 := podmanTest.Podman([]string{"run", "-dt", "--name", "con2", ALPINE, "top"})
con2.WaitWithDefaultTimeout()
- Expect(con2.ExitCode()).To(Equal(0))
+ Expect(con2).Should(Exit(0))
kube := podmanTest.Podman([]string{"generate", "kube", "con1", "con2"})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
})
It("podman generate kube with containers in pods should fail", func() {
pod1 := podmanTest.Podman([]string{"run", "-dt", "--pod", "new:pod1", "--name", "top1", ALPINE, "top"})
pod1.WaitWithDefaultTimeout()
- Expect(pod1.ExitCode()).To(Equal(0))
+ Expect(pod1).Should(Exit(0))
pod2 := podmanTest.Podman([]string{"run", "-dt", "--pod", "new:pod2", "--name", "top2", ALPINE, "top"})
pod2.WaitWithDefaultTimeout()
- Expect(pod2.ExitCode()).To(Equal(0))
+ Expect(pod2).Should(Exit(0))
kube := podmanTest.Podman([]string{"generate", "kube", "top1", "top2"})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).ToNot(Equal(0))
+ Expect(kube).To(ExitWithError())
})
It("podman generate kube on a container with dns options", func() {
top := podmanTest.Podman([]string{"run", "-dt", "--name", "top", "--dns", "8.8.8.8", "--dns-search", "foobar.com", "--dns-opt", "color:blue", ALPINE, "top"})
top.WaitWithDefaultTimeout()
- Expect(top.ExitCode()).To(BeZero())
+ Expect(top).Should(Exit(0))
kube := podmanTest.Podman([]string{"generate", "kube", "top"})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.Out.Contents(), pod)
@@ -657,15 +658,15 @@ var _ = Describe("Podman generate kube", func() {
It("podman generate kube multiple container dns servers and options are cumulative", func() {
top1 := podmanTest.Podman([]string{"run", "-dt", "--name", "top1", "--dns", "8.8.8.8", "--dns-search", "foobar.com", ALPINE, "top"})
top1.WaitWithDefaultTimeout()
- Expect(top1.ExitCode()).To(BeZero())
+ Expect(top1).Should(Exit(0))
top2 := podmanTest.Podman([]string{"run", "-dt", "--name", "top2", "--dns", "8.7.7.7", "--dns-search", "homer.com", ALPINE, "top"})
top2.WaitWithDefaultTimeout()
- Expect(top2.ExitCode()).To(BeZero())
+ Expect(top2).Should(Exit(0))
kube := podmanTest.Podman([]string{"generate", "kube", "top1", "top2"})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.Out.Contents(), pod)
@@ -680,11 +681,11 @@ var _ = Describe("Podman generate kube", func() {
It("podman generate kube on a pod with dns options", func() {
top := podmanTest.Podman([]string{"run", "--pod", "new:pod1", "-dt", "--name", "top", "--dns", "8.8.8.8", "--dns-search", "foobar.com", "--dns-opt", "color:blue", ALPINE, "top"})
top.WaitWithDefaultTimeout()
- Expect(top.ExitCode()).To(BeZero())
+ Expect(top).Should(Exit(0))
kube := podmanTest.Podman([]string{"generate", "kube", "pod1"})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.Out.Contents(), pod)
@@ -700,11 +701,11 @@ var _ = Describe("Podman generate kube", func() {
It("podman generate kube - set entrypoint as command", func() {
session := podmanTest.Podman([]string{"create", "--pod", "new:testpod", "--entrypoint", "/bin/sleep", ALPINE, "10s"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
kube := podmanTest.Podman([]string{"generate", "kube", "testpod"})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
// Now make sure that the container's command is set to the
// entrypoint and it's arguments to "10s".
@@ -733,15 +734,15 @@ ENTRYPOINT /bin/sleep`
image := "generatekube:test"
session := podmanTest.Podman([]string{"build", "--pull-never", "-f", containerfilePath, "-t", image})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"create", "--pod", "new:testpod", image, "10s"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
kube := podmanTest.Podman([]string{"generate", "kube", "testpod"})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
// Now make sure that the container's command is set to the
// entrypoint and it's arguments to "10s".
@@ -759,11 +760,11 @@ ENTRYPOINT /bin/sleep`
It("podman generate kube - --privileged container", func() {
session := podmanTest.Podman([]string{"create", "--pod", "new:testpod", "--privileged", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
kube := podmanTest.Podman([]string{"generate", "kube", "testpod"})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
// Now make sure that the capabilities aren't set.
pod := new(v1.Pod)
@@ -779,16 +780,16 @@ ENTRYPOINT /bin/sleep`
kube = podmanTest.Podman([]string{"generate", "kube", "testpod", "-f", kubeFile})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
// Remove the pod so play can recreate it.
kube = podmanTest.Podman([]string{"pod", "rm", "-f", "testpod"})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
kube = podmanTest.Podman([]string{"play", "kube", kubeFile})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
})
It("podman generate kube based on user in container", func() {
@@ -806,15 +807,15 @@ USER test1`
image := "generatekube:test"
session := podmanTest.Podman([]string{"build", "--pull-never", "-f", containerfilePath, "-t", image})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"create", "--pod", "new:testpod", image, "test1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
kube := podmanTest.Podman([]string{"generate", "kube", "testpod"})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
pod := new(v1.Pod)
err = yaml.Unmarshal(kube.Out.Contents(), pod)
@@ -827,11 +828,11 @@ USER test1`
session := podmanTest.Podman([]string{"volume", "create", vol})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
kube := podmanTest.Podman([]string{"generate", "kube", vol})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
pvc := new(v1.PersistentVolumeClaim)
err := yaml.Unmarshal(kube.Out.Contents(), pvc)
@@ -849,11 +850,11 @@ USER test1`
session := podmanTest.Podman([]string{"volume", "create", "--opt", "device=" + volDevice, "--opt", "type=" + volType, "--opt", "o=" + volOpts, vol})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
kube := podmanTest.Podman([]string{"generate", "kube", vol})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
pvc := new(v1.PersistentVolumeClaim)
err := yaml.Unmarshal(kube.Out.Contents(), pvc)
@@ -877,11 +878,11 @@ USER test1`
It("podman generate kube on container with auto update labels", func() {
top := podmanTest.Podman([]string{"run", "-dt", "--name", "top", "--label", "io.containers.autoupdate=local", ALPINE, "top"})
top.WaitWithDefaultTimeout()
- Expect(top.ExitCode()).To(Equal(0))
+ Expect(top).Should(Exit(0))
kube := podmanTest.Podman([]string{"generate", "kube", "top"})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.Out.Contents(), pod)
@@ -895,19 +896,19 @@ USER test1`
It("podman generate kube on pod with auto update labels in all containers", func() {
pod1 := podmanTest.Podman([]string{"pod", "create", "--name", "pod1"})
pod1.WaitWithDefaultTimeout()
- Expect(pod1.ExitCode()).To(Equal(0))
+ Expect(pod1).Should(Exit(0))
top1 := podmanTest.Podman([]string{"run", "-dt", "--name", "top1", "--pod", "pod1", "--label", "io.containers.autoupdate=registry", "--label", "io.containers.autoupdate.authfile=/some/authfile.json", ALPINE, "top"})
top1.WaitWithDefaultTimeout()
- Expect(top1.ExitCode()).To(Equal(0))
+ Expect(top1).Should(Exit(0))
top2 := podmanTest.Podman([]string{"run", "-dt", "--name", "top2", "--pod", "pod1", "--label", "io.containers.autoupdate=registry", "--label", "io.containers.autoupdate.authfile=/some/authfile.json", ALPINE, "top"})
top2.WaitWithDefaultTimeout()
- Expect(top2.ExitCode()).To(Equal(0))
+ Expect(top2).Should(Exit(0))
kube := podmanTest.Podman([]string{"generate", "kube", "pod1"})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.Out.Contents(), pod)
diff --git a/test/e2e/generate_systemd_test.go b/test/e2e/generate_systemd_test.go
index e03d6899e..121f09a11 100644
--- a/test/e2e/generate_systemd_test.go
+++ b/test/e2e/generate_systemd_test.go
@@ -7,6 +7,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman generate systemd", func() {
@@ -54,7 +55,7 @@ var _ = Describe("Podman generate systemd", func() {
It("podman generate systemd bad restart-policy value", func() {
session := podmanTest.Podman([]string{"create", "--name", "foobar", "alpine", "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"generate", "systemd", "--restart-policy", "bogus", "foobar"})
session.WaitWithDefaultTimeout()
@@ -65,11 +66,11 @@ var _ = Describe("Podman generate systemd", func() {
It("podman generate systemd with --no-header=true", func() {
session := podmanTest.Podman([]string{"create", "--name", "foobar", "alpine", "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"generate", "systemd", "foobar", "--no-header=true"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).NotTo(ContainSubstring("autogenerated by"))
})
@@ -77,11 +78,11 @@ var _ = Describe("Podman generate systemd", func() {
It("podman generate systemd with --no-header", func() {
session := podmanTest.Podman([]string{"create", "--name", "foobar", "alpine", "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"generate", "systemd", "foobar", "--no-header"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).NotTo(ContainSubstring("autogenerated by"))
})
@@ -89,11 +90,11 @@ var _ = Describe("Podman generate systemd", func() {
It("podman generate systemd with --no-header=false", func() {
session := podmanTest.Podman([]string{"create", "--name", "foobar", "alpine", "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"generate", "systemd", "foobar", "--no-header=false"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("autogenerated by"))
})
@@ -101,11 +102,11 @@ var _ = Describe("Podman generate systemd", func() {
It("podman generate systemd good timeout value", func() {
session := podmanTest.Podman([]string{"create", "--name", "foobar", "alpine", "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"generate", "systemd", "--time", "1234", "foobar"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("TimeoutStopSec=1294"))
Expect(session.OutputToString()).To(ContainSubstring(" stop -t 1234 "))
})
@@ -113,11 +114,11 @@ var _ = Describe("Podman generate systemd", func() {
It("podman generate systemd", func() {
n := podmanTest.Podman([]string{"run", "--name", "nginx", "-dt", nginx})
n.WaitWithDefaultTimeout()
- Expect(n.ExitCode()).To(Equal(0))
+ Expect(n).Should(Exit(0))
session := podmanTest.Podman([]string{"generate", "systemd", "nginx"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// The podman commands in the unit should not contain the root flags
Expect(session.OutputToString()).ToNot(ContainSubstring(" --runroot"))
@@ -126,11 +127,11 @@ var _ = Describe("Podman generate systemd", func() {
It("podman generate systemd --files --name", func() {
n := podmanTest.Podman([]string{"run", "--name", "nginx", "-dt", nginx})
n.WaitWithDefaultTimeout()
- Expect(n.ExitCode()).To(Equal(0))
+ Expect(n).Should(Exit(0))
session := podmanTest.Podman([]string{"generate", "systemd", "--files", "--name", "nginx"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
for _, file := range session.OutputToStringArray() {
os.Remove(file)
@@ -141,30 +142,30 @@ var _ = Describe("Podman generate systemd", func() {
It("podman generate systemd with timeout", func() {
n := podmanTest.Podman([]string{"run", "--name", "nginx", "-dt", nginx})
n.WaitWithDefaultTimeout()
- Expect(n.ExitCode()).To(Equal(0))
+ Expect(n).Should(Exit(0))
session := podmanTest.Podman([]string{"generate", "systemd", "--time", "5", "nginx"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("podman stop -t 5"))
})
It("podman generate systemd pod --name", func() {
n := podmanTest.Podman([]string{"pod", "create", "--name", "foo"})
n.WaitWithDefaultTimeout()
- Expect(n.ExitCode()).To(Equal(0))
+ Expect(n).Should(Exit(0))
n = podmanTest.Podman([]string{"create", "--pod", "foo", "--name", "foo-1", "alpine", "top"})
n.WaitWithDefaultTimeout()
- Expect(n.ExitCode()).To(Equal(0))
+ Expect(n).Should(Exit(0))
n = podmanTest.Podman([]string{"create", "--pod", "foo", "--name", "foo-2", "alpine", "top"})
n.WaitWithDefaultTimeout()
- Expect(n.ExitCode()).To(Equal(0))
+ Expect(n).Should(Exit(0))
session := podmanTest.Podman([]string{"generate", "systemd", "--time", "42", "--name", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Grepping the output (in addition to unit tests)
Expect(session.OutputToString()).To(ContainSubstring("# pod-foo.service"))
@@ -185,15 +186,15 @@ var _ = Describe("Podman generate systemd", func() {
It("podman generate systemd pod --name --files", func() {
n := podmanTest.Podman([]string{"pod", "create", "--name", "foo"})
n.WaitWithDefaultTimeout()
- Expect(n.ExitCode()).To(Equal(0))
+ Expect(n).Should(Exit(0))
n = podmanTest.Podman([]string{"create", "--pod", "foo", "--name", "foo-1", "alpine", "top"})
n.WaitWithDefaultTimeout()
- Expect(n.ExitCode()).To(Equal(0))
+ Expect(n).Should(Exit(0))
session := podmanTest.Podman([]string{"generate", "systemd", "--name", "--files", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
for _, file := range session.OutputToStringArray() {
os.Remove(file)
@@ -206,11 +207,11 @@ var _ = Describe("Podman generate systemd", func() {
It("podman generate systemd --new --name foo", func() {
n := podmanTest.Podman([]string{"create", "--name", "foo", "alpine", "top"})
n.WaitWithDefaultTimeout()
- Expect(n.ExitCode()).To(Equal(0))
+ Expect(n).Should(Exit(0))
session := podmanTest.Podman([]string{"generate", "systemd", "-t", "42", "--name", "--new", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Grepping the output (in addition to unit tests)
Expect(session.OutputToString()).To(ContainSubstring("# container-foo.service"))
@@ -224,11 +225,11 @@ var _ = Describe("Podman generate systemd", func() {
It("podman generate systemd --new --name=foo", func() {
n := podmanTest.Podman([]string{"create", "--name=foo", "alpine", "top"})
n.WaitWithDefaultTimeout()
- Expect(n.ExitCode()).To(Equal(0))
+ Expect(n).Should(Exit(0))
session := podmanTest.Podman([]string{"generate", "systemd", "-t", "42", "--name", "--new", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Grepping the output (in addition to unit tests)
Expect(session.OutputToString()).To(ContainSubstring("# container-foo.service"))
@@ -238,11 +239,11 @@ var _ = Describe("Podman generate systemd", func() {
It("podman generate systemd --new without explicit detaching param", func() {
n := podmanTest.Podman([]string{"create", "--name", "foo", "alpine", "top"})
n.WaitWithDefaultTimeout()
- Expect(n.ExitCode()).To(Equal(0))
+ Expect(n).Should(Exit(0))
session := podmanTest.Podman([]string{"generate", "systemd", "--time", "42", "--name", "--new", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Grepping the output (in addition to unit tests)
Expect(session.OutputToString()).To(ContainSubstring(" -d "))
@@ -251,11 +252,11 @@ var _ = Describe("Podman generate systemd", func() {
It("podman generate systemd --new with explicit detaching param in middle", func() {
n := podmanTest.Podman([]string{"create", "--name", "foo", "alpine", "top"})
n.WaitWithDefaultTimeout()
- Expect(n.ExitCode()).To(Equal(0))
+ Expect(n).Should(Exit(0))
session := podmanTest.Podman([]string{"generate", "systemd", "--time", "42", "--name", "--new", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Grepping the output (in addition to unit tests)
Expect(session.OutputToString()).To(ContainSubstring("--name foo alpine top"))
@@ -264,44 +265,44 @@ var _ = Describe("Podman generate systemd", func() {
It("podman generate systemd --new pod", func() {
n := podmanTest.Podman([]string{"pod", "create", "--name", "foo"})
n.WaitWithDefaultTimeout()
- Expect(n.ExitCode()).To(Equal(0))
+ Expect(n).Should(Exit(0))
session := podmanTest.Podman([]string{"generate", "systemd", "--time", "42", "--name", "--new", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(" pod create "))
})
It("podman generate systemd --new=false pod", func() {
n := podmanTest.Podman([]string{"pod", "create", "--name", "foo"})
n.WaitWithDefaultTimeout()
- Expect(n.ExitCode()).To(Equal(0))
+ Expect(n).Should(Exit(0))
session := podmanTest.Podman([]string{"generate", "systemd", "--time", "42", "--name", "--new=false", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).NotTo(ContainSubstring(" pod create "))
})
It("podman generate systemd --new=true pod", func() {
n := podmanTest.Podman([]string{"pod", "create", "--name", "foo"})
n.WaitWithDefaultTimeout()
- Expect(n.ExitCode()).To(Equal(0))
+ Expect(n).Should(Exit(0))
session := podmanTest.Podman([]string{"generate", "systemd", "--time", "42", "--name", "--new=true", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(" pod create "))
})
It("podman generate systemd --container-prefix con", func() {
n := podmanTest.Podman([]string{"create", "--name", "foo", "alpine", "top"})
n.WaitWithDefaultTimeout()
- Expect(n.ExitCode()).To(Equal(0))
+ Expect(n).Should(Exit(0))
session := podmanTest.Podman([]string{"generate", "systemd", "--name", "--container-prefix", "con", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Grepping the output (in addition to unit tests)
Expect(session.OutputToString()).To(ContainSubstring("# con-foo.service"))
@@ -311,11 +312,11 @@ var _ = Describe("Podman generate systemd", func() {
It("podman generate systemd --separator _", func() {
n := podmanTest.Podman([]string{"create", "--name", "foo", "alpine", "top"})
n.WaitWithDefaultTimeout()
- Expect(n.ExitCode()).To(Equal(0))
+ Expect(n).Should(Exit(0))
session := podmanTest.Podman([]string{"generate", "systemd", "--name", "--separator", "_", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Grepping the output (in addition to unit tests)
Expect(session.OutputToString()).To(ContainSubstring("# container_foo.service"))
@@ -324,19 +325,19 @@ var _ = Describe("Podman generate systemd", func() {
It("podman generate systemd pod --pod-prefix p", func() {
n := podmanTest.Podman([]string{"pod", "create", "--name", "foo"})
n.WaitWithDefaultTimeout()
- Expect(n.ExitCode()).To(Equal(0))
+ Expect(n).Should(Exit(0))
n = podmanTest.Podman([]string{"create", "--pod", "foo", "--name", "foo-1", "alpine", "top"})
n.WaitWithDefaultTimeout()
- Expect(n.ExitCode()).To(Equal(0))
+ Expect(n).Should(Exit(0))
n = podmanTest.Podman([]string{"create", "--pod", "foo", "--name", "foo-2", "alpine", "top"})
n.WaitWithDefaultTimeout()
- Expect(n.ExitCode()).To(Equal(0))
+ Expect(n).Should(Exit(0))
session := podmanTest.Podman([]string{"generate", "systemd", "--pod-prefix", "p", "--name", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Grepping the output (in addition to unit tests)
Expect(session.OutputToString()).To(ContainSubstring("# p-foo.service"))
@@ -348,19 +349,19 @@ var _ = Describe("Podman generate systemd", func() {
It("podman generate systemd pod --pod-prefix p --container-prefix con --separator _ change all prefixes/separator", func() {
n := podmanTest.Podman([]string{"pod", "create", "--name", "foo"})
n.WaitWithDefaultTimeout()
- Expect(n.ExitCode()).To(Equal(0))
+ Expect(n).Should(Exit(0))
n = podmanTest.Podman([]string{"create", "--pod", "foo", "--name", "foo-1", "alpine", "top"})
n.WaitWithDefaultTimeout()
- Expect(n.ExitCode()).To(Equal(0))
+ Expect(n).Should(Exit(0))
n = podmanTest.Podman([]string{"create", "--pod", "foo", "--name", "foo-2", "alpine", "top"})
n.WaitWithDefaultTimeout()
- Expect(n.ExitCode()).To(Equal(0))
+ Expect(n).Should(Exit(0))
session := podmanTest.Podman([]string{"generate", "systemd", "--container-prefix", "con", "--pod-prefix", "p", "--separator", "_", "--name", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Grepping the output (in addition to unit tests)
Expect(session.OutputToString()).To(ContainSubstring("# p_foo.service"))
@@ -378,19 +379,19 @@ var _ = Describe("Podman generate systemd", func() {
n := podmanTest.Podman([]string{"pod", "create", "--pod-id-file", tmpFile, "--name", "foo"})
n.WaitWithDefaultTimeout()
- Expect(n.ExitCode()).To(Equal(0))
+ Expect(n).Should(Exit(0))
n = podmanTest.Podman([]string{"create", "--pod", "foo", "--name", "foo-1", "alpine", "top"})
n.WaitWithDefaultTimeout()
- Expect(n.ExitCode()).To(Equal(0))
+ Expect(n).Should(Exit(0))
n = podmanTest.Podman([]string{"create", "--pod", "foo", "--name", "foo-2", "alpine", "top"})
n.WaitWithDefaultTimeout()
- Expect(n.ExitCode()).To(Equal(0))
+ Expect(n).Should(Exit(0))
session := podmanTest.Podman([]string{"generate", "systemd", "--new", "--name", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Grepping the output (in addition to unit tests)
Expect(session.OutputToString()).To(ContainSubstring("# pod-foo.service"))
@@ -405,11 +406,11 @@ var _ = Describe("Podman generate systemd", func() {
It("podman generate systemd --format json", func() {
n := podmanTest.Podman([]string{"create", "--name", "foo", ALPINE})
n.WaitWithDefaultTimeout()
- Expect(n.ExitCode()).To(Equal(0))
+ Expect(n).Should(Exit(0))
session := podmanTest.Podman([]string{"generate", "systemd", "--format", "json", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.IsJSONOutputValid()).To(BeTrue())
})
@@ -417,20 +418,20 @@ var _ = Describe("Podman generate systemd", func() {
// Regression test for #9034
session := podmanTest.Podman([]string{"create", "--name", "foo", "--log-driver=journald", "--log-opt=tag={{.Name}}", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"generate", "systemd", "--new", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(" --log-opt=tag={{.Name}} "))
session = podmanTest.Podman([]string{"pod", "create", "--name", "pod", "--label", "key={{someval}}"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"generate", "systemd", "--new", "pod"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(" --label key={{someval}}"))
})
})
diff --git a/test/e2e/healthcheck_run_test.go b/test/e2e/healthcheck_run_test.go
index ed7958323..28040ecfd 100644
--- a/test/e2e/healthcheck_run_test.go
+++ b/test/e2e/healthcheck_run_test.go
@@ -8,6 +8,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman healthcheck run", func() {
@@ -44,26 +45,26 @@ var _ = Describe("Podman healthcheck run", func() {
It("podman disable healthcheck with --no-healthcheck on valid container", func() {
session := podmanTest.Podman([]string{"run", "-dt", "--no-healthcheck", "--name", "hc", healthcheck})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
hc := podmanTest.Podman([]string{"healthcheck", "run", "hc"})
hc.WaitWithDefaultTimeout()
- Expect(hc.ExitCode()).To(Equal(125))
+ Expect(hc).Should(Exit(125))
})
It("podman disable healthcheck with --health-cmd=none on valid container", func() {
session := podmanTest.Podman([]string{"run", "-dt", "--health-cmd", "none", "--name", "hc", healthcheck})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
hc := podmanTest.Podman([]string{"healthcheck", "run", "hc"})
hc.WaitWithDefaultTimeout()
- Expect(hc.ExitCode()).To(Equal(125))
+ Expect(hc).Should(Exit(125))
})
It("podman healthcheck on valid container", func() {
Skip("Extremely consistent flake - re-enable on debugging")
session := podmanTest.Podman([]string{"run", "-dt", "--name", "hc", healthcheck})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
exitCode := 999
@@ -83,37 +84,37 @@ var _ = Describe("Podman healthcheck run", func() {
It("podman healthcheck that should fail", func() {
session := podmanTest.Podman([]string{"run", "-dt", "--name", "hc", "quay.io/libpod/badhealthcheck:latest"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
hc := podmanTest.Podman([]string{"healthcheck", "run", "hc"})
hc.WaitWithDefaultTimeout()
- Expect(hc.ExitCode()).To(Equal(1))
+ Expect(hc).Should(Exit(1))
})
It("podman healthcheck on stopped container", func() {
session := podmanTest.Podman([]string{"run", "-dt", "--name", "hc", healthcheck, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
hc := podmanTest.Podman([]string{"healthcheck", "run", "hc"})
hc.WaitWithDefaultTimeout()
- Expect(hc.ExitCode()).To(Equal(125))
+ Expect(hc).Should(Exit(125))
})
It("podman healthcheck on container without healthcheck", func() {
session := podmanTest.Podman([]string{"run", "-dt", "--name", "hc", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
hc := podmanTest.Podman([]string{"healthcheck", "run", "hc"})
hc.WaitWithDefaultTimeout()
- Expect(hc.ExitCode()).To(Equal(125))
+ Expect(hc).Should(Exit(125))
})
It("podman healthcheck should be starting", func() {
session := podmanTest.Podman([]string{"run", "-dt", "--name", "hc", "--health-retries", "2", "--health-cmd", "ls /foo || exit 1", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
inspect := podmanTest.InspectContainer("hc")
Expect(inspect[0].State.Healthcheck.Status).To(Equal("starting"))
})
@@ -121,19 +122,19 @@ var _ = Describe("Podman healthcheck run", func() {
It("podman healthcheck failed checks in start-period should not change status", func() {
session := podmanTest.Podman([]string{"run", "-dt", "--name", "hc", "--health-start-period", "2m", "--health-retries", "2", "--health-cmd", "ls /foo || exit 1", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
hc := podmanTest.Podman([]string{"healthcheck", "run", "hc"})
hc.WaitWithDefaultTimeout()
- Expect(hc.ExitCode()).To(Equal(1))
+ Expect(hc).Should(Exit(1))
hc = podmanTest.Podman([]string{"healthcheck", "run", "hc"})
hc.WaitWithDefaultTimeout()
- Expect(hc.ExitCode()).To(Equal(1))
+ Expect(hc).Should(Exit(1))
hc = podmanTest.Podman([]string{"healthcheck", "run", "hc"})
hc.WaitWithDefaultTimeout()
- Expect(hc.ExitCode()).To(Equal(1))
+ Expect(hc).Should(Exit(1))
inspect := podmanTest.InspectContainer("hc")
Expect(inspect[0].State.Healthcheck.Status).To(Equal("starting"))
@@ -142,18 +143,18 @@ var _ = Describe("Podman healthcheck run", func() {
It("podman healthcheck failed checks must reach retries before unhealthy ", func() {
session := podmanTest.Podman([]string{"run", "-dt", "--name", "hc", "--health-retries", "2", "--health-cmd", "ls /foo || exit 1", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
hc := podmanTest.Podman([]string{"healthcheck", "run", "hc"})
hc.WaitWithDefaultTimeout()
- Expect(hc.ExitCode()).To(Equal(1))
+ Expect(hc).Should(Exit(1))
inspect := podmanTest.InspectContainer("hc")
Expect(inspect[0].State.Healthcheck.Status).To(Equal("starting"))
hc = podmanTest.Podman([]string{"healthcheck", "run", "hc"})
hc.WaitWithDefaultTimeout()
- Expect(hc.ExitCode()).To(Equal(1))
+ Expect(hc).Should(Exit(1))
inspect = podmanTest.InspectContainer("hc")
Expect(inspect[0].State.Healthcheck.Status).To(Equal("unhealthy"))
@@ -163,11 +164,11 @@ var _ = Describe("Podman healthcheck run", func() {
It("podman healthcheck good check results in healthy even in start-period", func() {
session := podmanTest.Podman([]string{"run", "-dt", "--name", "hc", "--health-start-period", "2m", "--health-retries", "2", "--health-cmd", "ls || exit 1", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
hc := podmanTest.Podman([]string{"healthcheck", "run", "hc"})
hc.WaitWithDefaultTimeout()
- Expect(hc.ExitCode()).To(Equal(0))
+ Expect(hc).Should(Exit(0))
inspect := podmanTest.InspectContainer("hc")
Expect(inspect[0].State.Healthcheck.Status).To(Equal("healthy"))
@@ -176,29 +177,29 @@ var _ = Describe("Podman healthcheck run", func() {
It("podman healthcheck single healthy result changes failed to healthy", func() {
session := podmanTest.Podman([]string{"run", "-dt", "--name", "hc", "--health-retries", "2", "--health-cmd", "ls /foo || exit 1", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
hc := podmanTest.Podman([]string{"healthcheck", "run", "hc"})
hc.WaitWithDefaultTimeout()
- Expect(hc.ExitCode()).To(Equal(1))
+ Expect(hc).Should(Exit(1))
inspect := podmanTest.InspectContainer("hc")
Expect(inspect[0].State.Healthcheck.Status).To(Equal("starting"))
hc = podmanTest.Podman([]string{"healthcheck", "run", "hc"})
hc.WaitWithDefaultTimeout()
- Expect(hc.ExitCode()).To(Equal(1))
+ Expect(hc).Should(Exit(1))
inspect = podmanTest.InspectContainer("hc")
Expect(inspect[0].State.Healthcheck.Status).To(Equal("unhealthy"))
foo := podmanTest.Podman([]string{"exec", "hc", "touch", "/foo"})
foo.WaitWithDefaultTimeout()
- Expect(foo.ExitCode()).To(BeZero())
+ Expect(foo).Should(Exit(0))
hc = podmanTest.Podman([]string{"healthcheck", "run", "hc"})
hc.WaitWithDefaultTimeout()
- Expect(hc.ExitCode()).To(Equal(0))
+ Expect(hc).Should(Exit(0))
inspect = podmanTest.InspectContainer("hc")
Expect(inspect[0].State.Healthcheck.Status).To(Equal("healthy"))
diff --git a/test/e2e/history_test.go b/test/e2e/history_test.go
index e2cf62d9a..0f0f6d38a 100644
--- a/test/e2e/history_test.go
+++ b/test/e2e/history_test.go
@@ -6,6 +6,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman history", func() {
@@ -35,40 +36,40 @@ var _ = Describe("Podman history", func() {
It("podman history output flag", func() {
session := podmanTest.Podman([]string{"history", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 0))
})
It("podman history with GO template", func() {
session := podmanTest.Podman([]string{"history", "--format", "{{.ID}} {{.Created}}", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 0))
})
It("podman history with human flag", func() {
session := podmanTest.Podman([]string{"history", "--human=false", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 0))
})
It("podman history with quiet flag", func() {
session := podmanTest.Podman([]string{"history", "-qH", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 0))
})
It("podman history with no-trunc flag", func() {
session := podmanTest.Podman([]string{"history", "--no-trunc", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 0))
session = podmanTest.Podman([]string{"history", "--no-trunc", "--format", "{{.ID}}", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
lines := session.OutputToStringArray()
Expect(len(lines)).To(BeNumerically(">", 0))
// the image id must be 64 chars long
@@ -76,7 +77,7 @@ var _ = Describe("Podman history", func() {
session = podmanTest.Podman([]string{"history", "--no-trunc", "--format", "{{.CreatedBy}}", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
lines = session.OutputToStringArray()
Expect(len(lines)).To(BeNumerically(">", 0))
Expect(session.OutputToString()).ToNot(ContainSubstring("..."))
@@ -87,7 +88,7 @@ var _ = Describe("Podman history", func() {
It("podman history with json flag", func() {
session := podmanTest.Podman([]string{"history", "--format=json", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.IsJSONOutputValid()).To(BeTrue())
})
})
diff --git a/test/e2e/image_sign_test.go b/test/e2e/image_sign_test.go
index 704a78685..6b87c9edd 100644
--- a/test/e2e/image_sign_test.go
+++ b/test/e2e/image_sign_test.go
@@ -9,6 +9,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman image sign", func() {
@@ -55,7 +56,7 @@ var _ = Describe("Podman image sign", func() {
Expect(err).To(BeNil())
session := podmanTest.Podman([]string{"image", "sign", "--directory", sigDir, "--sign-by", "foo@bar.com", "docker://library/alpine"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
_, err = os.Stat(filepath.Join(sigDir, "library"))
Expect(err).To(BeNil())
})
@@ -69,7 +70,7 @@ var _ = Describe("Podman image sign", func() {
Expect(err).To(BeNil())
session := podmanTest.Podman([]string{"image", "sign", "--all", "--directory", sigDir, "--sign-by", "foo@bar.com", "docker://library/alpine"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
fInfos, err := ioutil.ReadDir(filepath.Join(sigDir, "library"))
Expect(err).To(BeNil())
Expect(len(fInfos) > 1).To(BeTrue())
diff --git a/test/e2e/import_test.go b/test/e2e/import_test.go
index 1f1b23bd0..519a7290c 100644
--- a/test/e2e/import_test.go
+++ b/test/e2e/import_test.go
@@ -7,6 +7,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman import", func() {
@@ -41,15 +42,15 @@ var _ = Describe("Podman import", func() {
export := podmanTest.Podman([]string{"export", "-o", outfile, cid})
export.WaitWithDefaultTimeout()
- Expect(export.ExitCode()).To(Equal(0))
+ Expect(export).Should(Exit(0))
importImage := podmanTest.Podman([]string{"import", outfile, "foobar.com/imported-image:latest"})
importImage.WaitWithDefaultTimeout()
- Expect(importImage.ExitCode()).To(Equal(0))
+ Expect(importImage).Should(Exit(0))
results := podmanTest.Podman([]string{"inspect", "--type", "image", "foobar.com/imported-image:latest"})
results.WaitWithDefaultTimeout()
- Expect(results.ExitCode()).To(Equal(0))
+ Expect(results).Should(Exit(0))
})
It("podman import without reference", func() {
@@ -59,16 +60,16 @@ var _ = Describe("Podman import", func() {
export := podmanTest.Podman([]string{"export", "-o", outfile, cid})
export.WaitWithDefaultTimeout()
- Expect(export.ExitCode()).To(Equal(0))
+ Expect(export).Should(Exit(0))
importImage := podmanTest.Podman([]string{"import", outfile})
importImage.WaitWithDefaultTimeout()
- Expect(importImage.ExitCode()).To(Equal(0))
+ Expect(importImage).Should(Exit(0))
// tag the image which proves it is in R/W storage
tag := podmanTest.Podman([]string{"tag", importImage.OutputToString(), "foo"})
tag.WaitWithDefaultTimeout()
- Expect(tag.ExitCode()).To(BeZero())
+ Expect(tag).Should(Exit(0))
})
It("podman import with message flag", func() {
@@ -78,15 +79,15 @@ var _ = Describe("Podman import", func() {
export := podmanTest.Podman([]string{"export", "-o", outfile, cid})
export.WaitWithDefaultTimeout()
- Expect(export.ExitCode()).To(Equal(0))
+ Expect(export).Should(Exit(0))
importImage := podmanTest.Podman([]string{"import", "--message", "importing container test message", outfile, "imported-image"})
importImage.WaitWithDefaultTimeout()
- Expect(importImage.ExitCode()).To(Equal(0))
+ Expect(importImage).Should(Exit(0))
results := podmanTest.Podman([]string{"history", "imported-image", "--format", "{{.Comment}}"})
results.WaitWithDefaultTimeout()
- Expect(results.ExitCode()).To(Equal(0))
+ Expect(results).Should(Exit(0))
Expect(results.LineInOutputStartsWith("importing container test message")).To(BeTrue())
})
@@ -97,15 +98,15 @@ var _ = Describe("Podman import", func() {
export := podmanTest.Podman([]string{"export", "-o", outfile, cid})
export.WaitWithDefaultTimeout()
- Expect(export.ExitCode()).To(Equal(0))
+ Expect(export).Should(Exit(0))
importImage := podmanTest.Podman([]string{"import", "--change", "CMD=/bin/bash", outfile, "imported-image"})
importImage.WaitWithDefaultTimeout()
- Expect(importImage.ExitCode()).To(Equal(0))
+ Expect(importImage).Should(Exit(0))
results := podmanTest.Podman([]string{"inspect", "imported-image"})
results.WaitWithDefaultTimeout()
- Expect(results.ExitCode()).To(Equal(0))
+ Expect(results).Should(Exit(0))
imageData := results.InspectImageJSON()
Expect(imageData[0].Config.Cmd[0]).To(Equal("/bin/sh"))
Expect(imageData[0].Config.Cmd[1]).To(Equal("-c"))
@@ -119,15 +120,15 @@ var _ = Describe("Podman import", func() {
export := podmanTest.Podman([]string{"export", "-o", outfile, cid})
export.WaitWithDefaultTimeout()
- Expect(export.ExitCode()).To(Equal(0))
+ Expect(export).Should(Exit(0))
importImage := podmanTest.Podman([]string{"import", "--change", "CMD /bin/sh", outfile, "imported-image"})
importImage.WaitWithDefaultTimeout()
- Expect(importImage.ExitCode()).To(Equal(0))
+ Expect(importImage).Should(Exit(0))
results := podmanTest.Podman([]string{"inspect", "imported-image"})
results.WaitWithDefaultTimeout()
- Expect(results.ExitCode()).To(Equal(0))
+ Expect(results).Should(Exit(0))
imageData := results.InspectImageJSON()
Expect(imageData[0].Config.Cmd[0]).To(Equal("/bin/sh"))
Expect(imageData[0].Config.Cmd[1]).To(Equal("-c"))
@@ -141,15 +142,15 @@ var _ = Describe("Podman import", func() {
export := podmanTest.Podman([]string{"export", "-o", outfile, cid})
export.WaitWithDefaultTimeout()
- Expect(export.ExitCode()).To(Equal(0))
+ Expect(export).Should(Exit(0))
importImage := podmanTest.Podman([]string{"import", "--change", "CMD [\"/bin/bash\"]", outfile, "imported-image"})
importImage.WaitWithDefaultTimeout()
- Expect(importImage.ExitCode()).To(Equal(0))
+ Expect(importImage).Should(Exit(0))
results := podmanTest.Podman([]string{"inspect", "imported-image"})
results.WaitWithDefaultTimeout()
- Expect(results.ExitCode()).To(Equal(0))
+ Expect(results).Should(Exit(0))
imageData := results.InspectImageJSON()
Expect(imageData[0].Config.Cmd[0]).To(Equal("/bin/bash"))
})
@@ -161,14 +162,14 @@ var _ = Describe("Podman import", func() {
export := podmanTest.Podman([]string{"export", "-o", outfile, cid})
export.WaitWithDefaultTimeout()
- Expect(export.ExitCode()).To(Equal(0))
+ Expect(export).Should(Exit(0))
importImage := podmanTest.Podman([]string{"import", "--signature-policy", "/no/such/file", outfile})
importImage.WaitWithDefaultTimeout()
- Expect(importImage.ExitCode()).To(Not(Equal(0)))
+ Expect(importImage).To(ExitWithError())
result := podmanTest.Podman([]string{"import", "--signature-policy", "/etc/containers/policy.json", outfile})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
})
})
diff --git a/test/e2e/info_test.go b/test/e2e/info_test.go
index 83d185be1..8ac538dd2 100644
--- a/test/e2e/info_test.go
+++ b/test/e2e/info_test.go
@@ -67,13 +67,13 @@ var _ = Describe("Podman Info", func() {
It("podman info --format GO template", func() {
session := podmanTest.Podman([]string{"info", "--format", "{{.Store.GraphRoot}}"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman info --format GO template", func() {
session := podmanTest.Podman([]string{"info", "--format", "{{.Registries}}"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("registry"))
})
@@ -113,13 +113,13 @@ var _ = Describe("Podman Info", func() {
It("podman info check RemoteSocket", func() {
session := podmanTest.Podman([]string{"info", "--format", "{{.Host.RemoteSocket.Path}}"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(MatchRegexp("/run/.*podman.*sock"))
if IsRemote() {
session = podmanTest.Podman([]string{"info", "--format", "{{.Host.RemoteSocket.Exists}}"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("true"))
}
})
diff --git a/test/e2e/init_test.go b/test/e2e/init_test.go
index d283e1f9a..788b67154 100644
--- a/test/e2e/init_test.go
+++ b/test/e2e/init_test.go
@@ -6,6 +6,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman init", func() {
@@ -35,26 +36,26 @@ var _ = Describe("Podman init", func() {
It("podman init bogus container", func() {
session := podmanTest.Podman([]string{"start", "123456"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
It("podman init with no arguments", func() {
session := podmanTest.Podman([]string{"start"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
It("podman init single container by ID", func() {
session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
init := podmanTest.Podman([]string{"init", cid})
init.WaitWithDefaultTimeout()
- Expect(init.ExitCode()).To(Equal(0))
+ Expect(init).Should(Exit(0))
result := podmanTest.Podman([]string{"inspect", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
conData := result.InspectContainerToJSON()
Expect(conData[0].State.Status).To(Equal("created"))
})
@@ -63,13 +64,13 @@ var _ = Describe("Podman init", func() {
name := "test1"
session := podmanTest.Podman([]string{"create", "--name", name, ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
init := podmanTest.Podman([]string{"init", name})
init.WaitWithDefaultTimeout()
- Expect(init.ExitCode()).To(Equal(0))
+ Expect(init).Should(Exit(0))
result := podmanTest.Podman([]string{"inspect", name})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
conData := result.InspectContainerToJSON()
Expect(conData[0].State.Status).To(Equal("created"))
})
@@ -78,13 +79,13 @@ var _ = Describe("Podman init", func() {
SkipIfRemote("--latest flag n/a")
session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
init := podmanTest.Podman([]string{"init", "--latest"})
init.WaitWithDefaultTimeout()
- Expect(init.ExitCode()).To(Equal(0))
+ Expect(init).Should(Exit(0))
result := podmanTest.Podman([]string{"inspect", "--latest"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
conData := result.InspectContainerToJSON()
Expect(conData[0].State.Status).To(Equal("created"))
})
@@ -92,29 +93,29 @@ var _ = Describe("Podman init", func() {
It("podman init all three containers, one running", func() {
session := podmanTest.Podman([]string{"create", "--name", "test1", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session2 := podmanTest.Podman([]string{"create", "--name", "test2", ALPINE, "ls"})
session2.WaitWithDefaultTimeout()
- Expect(session2.ExitCode()).To(Equal(0))
+ Expect(session2).Should(Exit(0))
session3 := podmanTest.Podman([]string{"run", "--name", "test3", "-d", ALPINE, "top"})
session3.WaitWithDefaultTimeout()
- Expect(session3.ExitCode()).To(Equal(0))
+ Expect(session3).Should(Exit(0))
init := podmanTest.Podman([]string{"init", "--all"})
init.WaitWithDefaultTimeout()
- Expect(init.ExitCode()).To(Equal(0))
+ Expect(init).Should(Exit(0))
result := podmanTest.Podman([]string{"inspect", "test1"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
conData := result.InspectContainerToJSON()
Expect(conData[0].State.Status).To(Equal("created"))
result2 := podmanTest.Podman([]string{"inspect", "test2"})
result2.WaitWithDefaultTimeout()
- Expect(result2.ExitCode()).To(Equal(0))
+ Expect(result2).Should(Exit(0))
conData2 := result2.InspectContainerToJSON()
Expect(conData2[0].State.Status).To(Equal("created"))
result3 := podmanTest.Podman([]string{"inspect", "test3"})
result3.WaitWithDefaultTimeout()
- Expect(result3.ExitCode()).To(Equal(0))
+ Expect(result3).Should(Exit(0))
conData3 := result3.InspectContainerToJSON()
Expect(conData3[0].State.Status).To(Equal("running"))
})
@@ -122,9 +123,9 @@ var _ = Describe("Podman init", func() {
It("podman init running container errors", func() {
session := podmanTest.Podman([]string{"run", "--name", "init_test", "-d", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
init := podmanTest.Podman([]string{"init", "init_test"})
init.WaitWithDefaultTimeout()
- Expect(init.ExitCode()).To(Equal(125))
+ Expect(init).Should(Exit(125))
})
})
diff --git a/test/e2e/inspect_test.go b/test/e2e/inspect_test.go
index ba018b5ad..89859e74f 100644
--- a/test/e2e/inspect_test.go
+++ b/test/e2e/inspect_test.go
@@ -38,7 +38,7 @@ var _ = Describe("Podman inspect", func() {
It("podman inspect alpine image", func() {
session := podmanTest.Podman([]string{"inspect", "--format=json", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.IsJSONOutputValid()).To(BeTrue())
imageData := session.InspectImageJSON()
Expect(imageData[0].RepoTags[0]).To(Equal("quay.io/libpod/alpine:latest"))
@@ -53,18 +53,18 @@ var _ = Describe("Podman inspect", func() {
It("podman inspect with GO format", func() {
session := podmanTest.Podman([]string{"inspect", "--format", "{{.ID}}", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"images", "-q", "--no-trunc", ALPINE})
result.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(strings.Contains(result.OutputToString(), session.OutputToString()))
})
It("podman inspect specified type", func() {
session := podmanTest.Podman([]string{"inspect", "--type", "image", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman inspect container with GO format for ConmonPidFile", func() {
@@ -73,7 +73,7 @@ var _ = Describe("Podman inspect", func() {
session = podmanTest.Podman([]string{"inspect", "--format", "{{.ConmonPidFile}}", "test1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman inspect container with size", func() {
@@ -82,7 +82,7 @@ var _ = Describe("Podman inspect", func() {
result := podmanTest.Podman([]string{"inspect", "--size", "sizetest"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
conData := result.InspectContainerToJSON()
Expect(conData[0].SizeRootFs).To(BeNumerically(">", 0))
Expect(*conData[0].SizeRw).To(BeNumerically(">=", 0))
@@ -95,7 +95,7 @@ var _ = Describe("Podman inspect", func() {
result := podmanTest.Podman([]string{"inspect", "--format={{.ID}}", cid, ALPINE})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).To(Equal(2))
})
@@ -106,12 +106,12 @@ var _ = Describe("Podman inspect", func() {
result := podmanTest.Podman([]string{"inspect", "--format={{.ImageID}}", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).To(Equal(1))
result = podmanTest.Podman([]string{"inspect", "--format={{.Image}}", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).To(Equal(1))
})
@@ -122,7 +122,7 @@ var _ = Describe("Podman inspect", func() {
result := podmanTest.Podman([]string{"inspect", "--format={{.Config.CreateCommand}}", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).To(Equal(1))
})
@@ -130,33 +130,33 @@ var _ = Describe("Podman inspect", func() {
SkipIfRemote("--latest flag n/a")
result := podmanTest.Podman([]string{"inspect", "-l", "1234foobar"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(125))
+ Expect(result).Should(Exit(125))
})
It("podman inspect with mount filters", func() {
ctrSession := podmanTest.Podman([]string{"create", "--name", "test", "-v", "/tmp:/test1", ALPINE, "top"})
ctrSession.WaitWithDefaultTimeout()
- Expect(ctrSession.ExitCode()).To(Equal(0))
+ Expect(ctrSession).Should(Exit(0))
inspectSource := podmanTest.Podman([]string{"inspect", "test", "--format", "{{(index .Mounts 0).Source}}"})
inspectSource.WaitWithDefaultTimeout()
- Expect(inspectSource.ExitCode()).To(Equal(0))
+ Expect(inspectSource).Should(Exit(0))
Expect(inspectSource.OutputToString()).To(Equal("/tmp"))
inspectSrc := podmanTest.Podman([]string{"inspect", "test", "--format", "{{(index .Mounts 0).Src}}"})
inspectSrc.WaitWithDefaultTimeout()
- Expect(inspectSrc.ExitCode()).To(Equal(0))
+ Expect(inspectSrc).Should(Exit(0))
Expect(inspectSrc.OutputToString()).To(Equal("/tmp"))
inspectDestination := podmanTest.Podman([]string{"inspect", "test", "--format", "{{(index .Mounts 0).Destination}}"})
inspectDestination.WaitWithDefaultTimeout()
- Expect(inspectDestination.ExitCode()).To(Equal(0))
+ Expect(inspectDestination).Should(Exit(0))
Expect(inspectDestination.OutputToString()).To(Equal("/test1"))
inspectDst := podmanTest.Podman([]string{"inspect", "test", "--format", "{{(index .Mounts 0).Dst}}"})
inspectDst.WaitWithDefaultTimeout()
- Expect(inspectDst.ExitCode()).To(Equal(0))
+ Expect(inspectDst).Should(Exit(0))
Expect(inspectDst.OutputToString()).To(Equal("/test1"))
})
@@ -175,23 +175,23 @@ var _ = Describe("Podman inspect", func() {
session := podmanTest.Podman([]string{"inspect", "--latest"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
})
It("podman [image,container] inspect on image", func() {
baseInspect := podmanTest.Podman([]string{"inspect", ALPINE})
baseInspect.WaitWithDefaultTimeout()
- Expect(baseInspect.ExitCode()).To(Equal(0))
+ Expect(baseInspect).Should(Exit(0))
baseJSON := baseInspect.InspectImageJSON()
Expect(len(baseJSON)).To(Equal(1))
ctrInspect := podmanTest.Podman([]string{"container", "inspect", ALPINE})
ctrInspect.WaitWithDefaultTimeout()
- Expect(ctrInspect.ExitCode()).To(Not(Equal(0)))
+ Expect(ctrInspect).To(ExitWithError())
imageInspect := podmanTest.Podman([]string{"image", "inspect", ALPINE})
imageInspect.WaitWithDefaultTimeout()
- Expect(imageInspect.ExitCode()).To(Equal(0))
+ Expect(imageInspect).Should(Exit(0))
imageJSON := imageInspect.InspectImageJSON()
Expect(len(imageJSON)).To(Equal(1))
@@ -202,23 +202,23 @@ var _ = Describe("Podman inspect", func() {
ctrName := "testCtr"
create := podmanTest.Podman([]string{"create", "--name", ctrName, ALPINE, "sh"})
create.WaitWithDefaultTimeout()
- Expect(create.ExitCode()).To(Equal(0))
+ Expect(create).Should(Exit(0))
baseInspect := podmanTest.Podman([]string{"inspect", ctrName})
baseInspect.WaitWithDefaultTimeout()
- Expect(baseInspect.ExitCode()).To(Equal(0))
+ Expect(baseInspect).Should(Exit(0))
baseJSON := baseInspect.InspectContainerToJSON()
Expect(len(baseJSON)).To(Equal(1))
ctrInspect := podmanTest.Podman([]string{"container", "inspect", ctrName})
ctrInspect.WaitWithDefaultTimeout()
- Expect(ctrInspect.ExitCode()).To(Equal(0))
+ Expect(ctrInspect).Should(Exit(0))
ctrJSON := ctrInspect.InspectContainerToJSON()
Expect(len(ctrJSON)).To(Equal(1))
imageInspect := podmanTest.Podman([]string{"image", "inspect", ctrName})
imageInspect.WaitWithDefaultTimeout()
- Expect(imageInspect.ExitCode()).To(Not(Equal(0)))
+ Expect(imageInspect).To(ExitWithError())
Expect(baseJSON[0].ID).To(Equal(ctrJSON[0].ID))
})
@@ -226,7 +226,7 @@ var _ = Describe("Podman inspect", func() {
It("podman inspect always produces a valid array", func() {
baseInspect := podmanTest.Podman([]string{"inspect", "doesNotExist"})
baseInspect.WaitWithDefaultTimeout()
- Expect(baseInspect.ExitCode()).To(Not(Equal(0)))
+ Expect(baseInspect).To(ExitWithError())
emptyJSON := baseInspect.InspectContainerToJSON()
Expect(len(emptyJSON)).To(Equal(0))
})
@@ -235,11 +235,11 @@ var _ = Describe("Podman inspect", func() {
ctrName := "testCtr"
create := podmanTest.Podman([]string{"create", "--name", ctrName, ALPINE, "sh"})
create.WaitWithDefaultTimeout()
- Expect(create.ExitCode()).To(Equal(0))
+ Expect(create).Should(Exit(0))
baseInspect := podmanTest.Podman([]string{"inspect", ctrName, "doesNotExist"})
baseInspect.WaitWithDefaultTimeout()
- Expect(baseInspect.ExitCode()).To(Not(Equal(0)))
+ Expect(baseInspect).To(ExitWithError())
baseJSON := baseInspect.InspectContainerToJSON()
Expect(len(baseJSON)).To(Equal(1))
Expect(baseJSON[0].Name).To(Equal(ctrName))
@@ -250,15 +250,15 @@ var _ = Describe("Podman inspect", func() {
ctrName := "testcontainer"
create := podmanTest.Podman([]string{"create", "--name", ctrName, ALPINE, "sh"})
create.WaitWithDefaultTimeout()
- Expect(create.ExitCode()).To(Equal(0))
+ Expect(create).Should(Exit(0))
tag := podmanTest.Podman([]string{"tag", ALPINE, ctrName + ":latest"})
tag.WaitWithDefaultTimeout()
- Expect(tag.ExitCode()).To(Equal(0))
+ Expect(tag).Should(Exit(0))
baseInspect := podmanTest.Podman([]string{"inspect", ctrName})
baseInspect.WaitWithDefaultTimeout()
- Expect(baseInspect.ExitCode()).To(Equal(0))
+ Expect(baseInspect).Should(Exit(0))
baseJSON := baseInspect.InspectContainerToJSON()
Expect(len(baseJSON)).To(Equal(1))
Expect(baseJSON[0].Name).To(Equal(ctrName))
@@ -278,11 +278,11 @@ var _ = Describe("Podman inspect", func() {
ALPINE, "sh"})
create.WaitWithDefaultTimeout()
- Expect(create.ExitCode()).To(Equal(0))
+ Expect(create).Should(Exit(0))
baseInspect := podmanTest.Podman([]string{"inspect", ctrName})
baseInspect.WaitWithDefaultTimeout()
- Expect(baseInspect.ExitCode()).To(Equal(0))
+ Expect(baseInspect).Should(Exit(0))
baseJSON := baseInspect.InspectContainerToJSON()
Expect(len(baseJSON)).To(Equal(1))
Expect(baseJSON[0].HostConfig.SecurityOpt).To(Equal([]string{"label=type:spc_t,label=level:s0", "seccomp=unconfined"}))
@@ -292,11 +292,11 @@ var _ = Describe("Podman inspect", func() {
podName := "testpod"
create := podmanTest.Podman([]string{"pod", "create", "--name", podName})
create.WaitWithDefaultTimeout()
- Expect(create.ExitCode()).To(Equal(0))
+ Expect(create).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", podName})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.IsJSONOutputValid()).To(BeTrue())
podData := inspect.InspectPodArrToJSON()
Expect(podData[0].Name).To(Equal(podName))
@@ -306,11 +306,11 @@ var _ = Describe("Podman inspect", func() {
podName := "testpod"
create := podmanTest.Podman([]string{"pod", "create", "--name", podName})
create.WaitWithDefaultTimeout()
- Expect(create.ExitCode()).To(Equal(0))
+ Expect(create).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", "--type", "pod", podName})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.IsJSONOutputValid()).To(BeTrue())
podData := inspect.InspectPodArrToJSON()
Expect(podData[0].Name).To(Equal(podName))
@@ -321,11 +321,11 @@ var _ = Describe("Podman inspect", func() {
podName := "testpod"
create := podmanTest.Podman([]string{"pod", "create", "--name", podName})
create.WaitWithDefaultTimeout()
- Expect(create.ExitCode()).To(Equal(0))
+ Expect(create).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", "--type", "pod", "--latest"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.IsJSONOutputValid()).To(BeTrue())
podData := inspect.InspectPodArrToJSON()
Expect(podData[0].Name).To(Equal(podName))
@@ -335,18 +335,18 @@ var _ = Describe("Podman inspect", func() {
podName := "testpod"
pod := podmanTest.Podman([]string{"pod", "create", "--name", podName})
pod.WaitWithDefaultTimeout()
- Expect(pod.ExitCode()).To(Equal(0))
+ Expect(pod).Should(Exit(0))
inspect1 := podmanTest.Podman([]string{"inspect", "--type", "pod", podName})
inspect1.WaitWithDefaultTimeout()
- Expect(inspect1.ExitCode()).To(Equal(0))
+ Expect(inspect1).Should(Exit(0))
Expect(inspect1.IsJSONOutputValid()).To(BeTrue())
podData := inspect1.InspectPodArrToJSON()
infra := podData[0].Containers[0].Name
inspect := podmanTest.Podman([]string{"inspect", "--latest"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.IsJSONOutputValid()).To(BeTrue())
containerData := inspect.InspectContainerToJSON()
Expect(containerData[0].Name).To(Equal(infra))
@@ -358,7 +358,7 @@ var _ = Describe("Podman inspect", func() {
session := podmanTest.Podman([]string{"inspect", name, "--format", "{{.cniVersion}}"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.LineInOutputContains("0.3.0")).To(BeTrue())
})
@@ -366,11 +366,11 @@ var _ = Describe("Podman inspect", func() {
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
session.WaitWithDefaultTimeout()
volName := session.OutputToString()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"inspect", volName})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.IsJSONOutputValid()).To(BeTrue())
})
@@ -378,18 +378,18 @@ var _ = Describe("Podman inspect", func() {
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
session.WaitWithDefaultTimeout()
volName := session.OutputToString()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"inspect", "--format", "{{.Name}}", volName})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal(volName))
})
It("podman inspect --type container on a pod should fail", func() {
podName := "testpod"
create := podmanTest.Podman([]string{"pod", "create", "--name", podName})
create.WaitWithDefaultTimeout()
- Expect(create.ExitCode()).To(Equal(0))
+ Expect(create).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", "--type", "container", podName})
inspect.WaitWithDefaultTimeout()
@@ -400,7 +400,7 @@ var _ = Describe("Podman inspect", func() {
ctrName := "testctr"
create := podmanTest.Podman([]string{"create", "--name", ctrName, ALPINE})
create.WaitWithDefaultTimeout()
- Expect(create.ExitCode()).To(Equal(0))
+ Expect(create).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", "--type", "network", ctrName})
inspect.WaitWithDefaultTimeout()
@@ -411,7 +411,7 @@ var _ = Describe("Podman inspect", func() {
ctrName := "testctr"
create := podmanTest.Podman([]string{"create", "--name", ctrName, ALPINE})
create.WaitWithDefaultTimeout()
- Expect(create.ExitCode()).To(Equal(0))
+ Expect(create).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", "--type", "pod", ctrName})
inspect.WaitWithDefaultTimeout()
@@ -422,7 +422,7 @@ var _ = Describe("Podman inspect", func() {
ctrName := "testctr"
create := podmanTest.Podman([]string{"create", "--name", ctrName, ALPINE})
create.WaitWithDefaultTimeout()
- Expect(create.ExitCode()).To(Equal(0))
+ Expect(create).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", "--type", "volume", ctrName})
inspect.WaitWithDefaultTimeout()
@@ -448,7 +448,7 @@ var _ = Describe("Podman inspect", func() {
ctrName := "testctr"
session := podmanTest.Podman([]string{"run", "-d", "--name", ctrName, ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
inspect := podmanTest.InspectContainer(ctrName)
Expect(len(inspect)).To(Equal(1))
@@ -460,7 +460,7 @@ var _ = Describe("Podman inspect", func() {
ctrName := "testctr"
session := podmanTest.Podman([]string{"create", "--name", ctrName, ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
inspect := podmanTest.InspectContainer(ctrName)
Expect(len(inspect)).To(Equal(1))
@@ -471,11 +471,11 @@ var _ = Describe("Podman inspect", func() {
ctrName := "testctr"
session := podmanTest.Podman([]string{"run", "-d", "--ulimit", "core=-1:-1", "--name", ctrName, ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", ctrName})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(BeZero())
+ Expect(inspect).Should(Exit(0))
data := inspect.InspectContainerToJSON()
ulimits := data[0].HostConfig.Ulimits
@@ -495,11 +495,11 @@ var _ = Describe("Podman inspect", func() {
ctrName := "testCtr"
session := podmanTest.Podman([]string{"run", "-d", "--cap-drop", "CAP_AUDIT_WRITE", "--cap-drop", "CAP_MKNOD", "--cap-drop", "CAP_NET_RAW", "--name", ctrName, ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", ctrName})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(BeZero())
+ Expect(inspect).Should(Exit(0))
data := inspect.InspectContainerToJSON()
Expect(len(data)).To(Equal(1))
@@ -516,6 +516,6 @@ var _ = Describe("Podman inspect", func() {
session = podmanTest.Podman([]string{"inspect", "--format", "{{.PidFile}}", "test1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
})
diff --git a/test/e2e/kill_test.go b/test/e2e/kill_test.go
index a9f21fa70..266146bd2 100644
--- a/test/e2e/kill_test.go
+++ b/test/e2e/kill_test.go
@@ -7,6 +7,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman kill", func() {
@@ -41,25 +42,25 @@ var _ = Describe("Podman kill", func() {
It("podman container kill a running container by id", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
result := podmanTest.Podman([]string{"container", "kill", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
It("podman container kill a running container by short id", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
result := podmanTest.Podman([]string{"container", "kill", cid[:5]})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(Equal(cid[:5]))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
@@ -67,55 +68,55 @@ var _ = Describe("Podman kill", func() {
It("podman kill a running container by id", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
result := podmanTest.Podman([]string{"kill", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
It("podman kill a running container by id with TERM", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
result := podmanTest.Podman([]string{"kill", "-s", "9", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
It("podman kill a running container by name", func() {
session := podmanTest.RunTopContainer("test1")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"kill", "-s", "9", "test1"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
It("podman kill a running container by id with a bogus signal", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
result := podmanTest.Podman([]string{"kill", "-s", "foobar", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(125))
+ Expect(result).Should(Exit(125))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
})
It("podman kill latest container", func() {
session := podmanTest.RunTopContainer("test1")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := "-l"
if IsRemote() {
@@ -123,7 +124,7 @@ var _ = Describe("Podman kill", func() {
}
result := podmanTest.Podman([]string{"kill", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
@@ -135,16 +136,16 @@ var _ = Describe("Podman kill", func() {
session := podmanTest.Podman([]string{"run", "-dt", "--cidfile", tmpFile, ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToStringArray()[0]
kill := podmanTest.Podman([]string{"kill", "--cidfile", tmpFile})
kill.WaitWithDefaultTimeout()
- Expect(kill.ExitCode()).To(BeZero())
+ Expect(kill).Should(Exit(0))
wait := podmanTest.Podman([]string{"wait", "--condition", "exited", cid})
wait.WaitWithDefaultTimeout()
- Expect(wait.ExitCode()).To(BeZero())
+ Expect(wait).Should(Exit(0))
})
It("podman kill multiple --cidfile", func() {
@@ -160,40 +161,40 @@ var _ = Describe("Podman kill", func() {
session := podmanTest.Podman([]string{"run", "-dt", "--cidfile", tmpFile1, ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid1 := session.OutputToStringArray()[0]
session2 := podmanTest.Podman([]string{"run", "-dt", "--cidfile", tmpFile2, ALPINE, "top"})
session2.WaitWithDefaultTimeout()
- Expect(session2.ExitCode()).To(Equal(0))
+ Expect(session2).Should(Exit(0))
cid2 := session2.OutputToStringArray()[0]
kill := podmanTest.Podman([]string{"kill", "--cidfile", tmpFile1, "--cidfile", tmpFile2})
kill.WaitWithDefaultTimeout()
- Expect(kill.ExitCode()).To(BeZero())
+ Expect(kill).Should(Exit(0))
wait := podmanTest.Podman([]string{"wait", "--condition", "exited", cid1})
wait.WaitWithDefaultTimeout()
- Expect(wait.ExitCode()).To(BeZero())
+ Expect(wait).Should(Exit(0))
wait = podmanTest.Podman([]string{"wait", "--condition", "exited", cid2})
wait.WaitWithDefaultTimeout()
- Expect(wait.ExitCode()).To(BeZero())
+ Expect(wait).Should(Exit(0))
})
It("podman stop --all", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
session = podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(2))
session = podmanTest.Podman([]string{"kill", "--all"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
})
diff --git a/test/e2e/load_test.go b/test/e2e/load_test.go
index 3bd75a8f2..a3ee1814a 100644
--- a/test/e2e/load_test.go
+++ b/test/e2e/load_test.go
@@ -8,6 +8,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman load", func() {
@@ -43,15 +44,15 @@ var _ = Describe("Podman load", func() {
save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE})
save.WaitWithDefaultTimeout()
- Expect(save.ExitCode()).To(Equal(0))
+ Expect(save).Should(Exit(0))
rmi := podmanTest.Podman([]string{"rmi", ALPINE})
rmi.WaitWithDefaultTimeout()
- Expect(rmi.ExitCode()).To(Equal(0))
+ Expect(rmi).Should(Exit(0))
result := podmanTest.Podman([]string{"load", "-i", outfile})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
})
It("podman load compressed tar file", func() {
@@ -59,19 +60,19 @@ var _ = Describe("Podman load", func() {
save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE})
save.WaitWithDefaultTimeout()
- Expect(save.ExitCode()).To(Equal(0))
+ Expect(save).Should(Exit(0))
compress := SystemExec("gzip", []string{outfile})
- Expect(compress.ExitCode()).To(Equal(0))
+ Expect(compress).Should(Exit(0))
outfile = outfile + ".gz"
rmi := podmanTest.Podman([]string{"rmi", ALPINE})
rmi.WaitWithDefaultTimeout()
- Expect(rmi.ExitCode()).To(Equal(0))
+ Expect(rmi).Should(Exit(0))
result := podmanTest.Podman([]string{"load", "-i", outfile})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
})
It("podman load oci-archive image", func() {
@@ -79,15 +80,15 @@ var _ = Describe("Podman load", func() {
save := podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-archive", ALPINE})
save.WaitWithDefaultTimeout()
- Expect(save.ExitCode()).To(Equal(0))
+ Expect(save).Should(Exit(0))
rmi := podmanTest.Podman([]string{"rmi", ALPINE})
rmi.WaitWithDefaultTimeout()
- Expect(rmi.ExitCode()).To(Equal(0))
+ Expect(rmi).Should(Exit(0))
result := podmanTest.Podman([]string{"load", "-i", outfile})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
})
It("podman load oci-archive with signature", func() {
@@ -95,15 +96,15 @@ var _ = Describe("Podman load", func() {
save := podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-archive", ALPINE})
save.WaitWithDefaultTimeout()
- Expect(save.ExitCode()).To(Equal(0))
+ Expect(save).Should(Exit(0))
rmi := podmanTest.Podman([]string{"rmi", ALPINE})
rmi.WaitWithDefaultTimeout()
- Expect(rmi.ExitCode()).To(Equal(0))
+ Expect(rmi).Should(Exit(0))
result := podmanTest.Podman([]string{"load", "--signature-policy", "/etc/containers/policy.json", "-i", outfile})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
})
It("podman load with quiet flag", func() {
@@ -111,15 +112,15 @@ var _ = Describe("Podman load", func() {
save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE})
save.WaitWithDefaultTimeout()
- Expect(save.ExitCode()).To(Equal(0))
+ Expect(save).Should(Exit(0))
rmi := podmanTest.Podman([]string{"rmi", ALPINE})
rmi.WaitWithDefaultTimeout()
- Expect(rmi.ExitCode()).To(Equal(0))
+ Expect(rmi).Should(Exit(0))
result := podmanTest.Podman([]string{"load", "-q", "-i", outfile})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
})
It("podman load directory", func() {
@@ -128,15 +129,15 @@ var _ = Describe("Podman load", func() {
save := podmanTest.Podman([]string{"save", "--format", "oci-dir", "-o", outdir, ALPINE})
save.WaitWithDefaultTimeout()
- Expect(save.ExitCode()).To(Equal(0))
+ Expect(save).Should(Exit(0))
rmi := podmanTest.Podman([]string{"rmi", ALPINE})
rmi.WaitWithDefaultTimeout()
- Expect(rmi.ExitCode()).To(Equal(0))
+ Expect(rmi).Should(Exit(0))
result := podmanTest.Podman([]string{"load", "-i", outdir})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
})
It("podman-remote load directory", func() {
@@ -148,7 +149,7 @@ var _ = Describe("Podman load", func() {
result := podmanTest.Podman([]string{"load", "-i", podmanTest.TempDir})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(125))
+ Expect(result).Should(Exit(125))
errMsg := fmt.Sprintf("remote client supports archives only but %q is a directory", podmanTest.TempDir)
found, _ := result.ErrorGrepString(errMsg)
@@ -170,45 +171,45 @@ var _ = Describe("Podman load", func() {
pull := podmanTest.Podman([]string{"pull", alpVersion})
pull.WaitWithDefaultTimeout()
- Expect(pull.ExitCode()).To(Equal(0))
+ Expect(pull).Should(Exit(0))
save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE, alpVersion})
save.WaitWithDefaultTimeout()
- Expect(save.ExitCode()).To(Equal(0))
+ Expect(save).Should(Exit(0))
rmi := podmanTest.Podman([]string{"rmi", ALPINE, alpVersion})
rmi.WaitWithDefaultTimeout()
- Expect(rmi.ExitCode()).To(Equal(0))
+ Expect(rmi).Should(Exit(0))
result := podmanTest.Podman([]string{"load", "-i", outfile})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", ALPINE})
inspect.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
inspect = podmanTest.Podman([]string{"inspect", alpVersion})
inspect.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
})
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))
+ Expect(setup).Should(Exit(0))
setup = podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-archive", "hello:world"})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
setup = podmanTest.Podman([]string{"rmi", "hello:world"})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
load := podmanTest.Podman([]string{"load", "-i", outfile})
load.WaitWithDefaultTimeout()
- Expect(load.ExitCode()).To(Equal(0))
+ Expect(load).Should(Exit(0))
result := podmanTest.Podman([]string{"images", "hello:world"})
result.WaitWithDefaultTimeout()
@@ -221,19 +222,19 @@ var _ = Describe("Podman load", func() {
setup := podmanTest.Podman([]string{"tag", ALPINE, "hello"})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
setup = podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-archive", "hello"})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
setup = podmanTest.Podman([]string{"rmi", "hello"})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
load := podmanTest.Podman([]string{"load", "-i", outfile})
load.WaitWithDefaultTimeout()
- Expect(load.ExitCode()).To(Equal(0))
+ Expect(load).Should(Exit(0))
result := podmanTest.Podman([]string{"images", "hello:latest"})
result.WaitWithDefaultTimeout()
@@ -247,19 +248,19 @@ var _ = Describe("Podman load", func() {
setup := podmanTest.Podman([]string{"tag", ALPINE, "hello:world"})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
setup = podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-dir", "hello:world"})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
setup = podmanTest.Podman([]string{"rmi", "hello:world"})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
load := podmanTest.Podman([]string{"load", "-i", outfile})
load.WaitWithDefaultTimeout()
- Expect(load.ExitCode()).To(Equal(0))
+ Expect(load).Should(Exit(0))
result := podmanTest.Podman([]string{"images", "load:latest"})
result.WaitWithDefaultTimeout()
@@ -272,23 +273,23 @@ var _ = Describe("Podman load", func() {
save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE})
save.WaitWithDefaultTimeout()
- Expect(save.ExitCode()).To(Equal(0))
+ Expect(save).Should(Exit(0))
session := SystemExec("xz", []string{outfile})
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
rmi := podmanTest.Podman([]string{"rmi", ALPINE})
rmi.WaitWithDefaultTimeout()
- Expect(rmi.ExitCode()).To(Equal(0))
+ Expect(rmi).Should(Exit(0))
result := podmanTest.Podman([]string{"load", "-i", outfile + ".xz"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
})
It("podman load multi-image archive", func() {
result := podmanTest.Podman([]string{"load", "-i", "./testdata/docker-two-images.tar.xz"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.LineInOutputContains("example.com/empty:latest")).To(BeTrue())
Expect(result.LineInOutputContains("example.com/empty/but:different")).To(BeTrue())
})
diff --git a/test/e2e/login_logout_test.go b/test/e2e/login_logout_test.go
index 6269bb92b..6088d991f 100644
--- a/test/e2e/login_logout_test.go
+++ b/test/e2e/login_logout_test.go
@@ -13,6 +13,7 @@ import (
. "github.com/onsi/ginkgo"
"github.com/onsi/ginkgo/config"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman login and logout", func() {
@@ -54,7 +55,7 @@ var _ = Describe("Podman login and logout", func() {
session := podmanTest.Podman([]string{"run", "--entrypoint", "htpasswd", "registry:2.6", "-Bbn", "podmantest", "test"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
f, _ := os.Create(filepath.Join(authPath, "htpasswd"))
defer f.Close()
@@ -83,7 +84,7 @@ var _ = Describe("Podman login and logout", func() {
"-v", strings.Join([]string{certPath, "/certs"}, ":"), "-e", "REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt",
"-e", "REGISTRY_HTTP_TLS_KEY=/certs/domain.key", "registry:2.6"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
if !WaitContainerReady(podmanTest, "registry", "listening on", 20, 1) {
Skip("Cannot start docker registry.")
@@ -99,15 +100,15 @@ var _ = Describe("Podman login and logout", func() {
It("podman login and logout", func() {
session := podmanTest.Podman([]string{"login", "-u", "podmantest", "-p", "test", server})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"push", ALPINE, testImg})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"logout", server})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"push", ALPINE, testImg})
session.WaitWithDefaultTimeout()
@@ -137,18 +138,18 @@ var _ = Describe("Podman login and logout", func() {
session := podmanTest.Podman([]string{"login", "-u", "podmantest", "-p", "test"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To((Equal(0)))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"logout"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman login and logout with flag --authfile", func() {
authFile := filepath.Join(podmanTest.TempDir, "auth.json")
session := podmanTest.Podman([]string{"login", "--username", "podmantest", "--password", "test", "--authfile", authFile, server})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
authInfo, _ := ioutil.ReadFile(authFile)
var info map[string]interface{}
@@ -158,20 +159,20 @@ var _ = Describe("Podman login and logout", func() {
// push should fail with nonexistent authfile
session = podmanTest.Podman([]string{"push", "--authfile", "/tmp/nonexistent", ALPINE, testImg})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
session = podmanTest.Podman([]string{"push", "--authfile", authFile, ALPINE, testImg})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--authfile", authFile, testImg})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// logout should fail with nonexistent authfile
session = podmanTest.Podman([]string{"logout", "--authfile", "/tmp/nonexistent", server})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
session = podmanTest.Podman([]string{"logout", "--authfile", authFile, server})
})
@@ -179,15 +180,15 @@ var _ = Describe("Podman login and logout", func() {
It("podman login and logout with --tls-verify", func() {
session := podmanTest.Podman([]string{"login", "--username", "podmantest", "--password", "test", "--tls-verify=false", server})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"push", ALPINE, testImg})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"logout", server})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman login and logout with --cert-dir", func() {
certDir := filepath.Join(podmanTest.TempDir, "certs")
@@ -198,15 +199,15 @@ var _ = Describe("Podman login and logout", func() {
session := podmanTest.Podman([]string{"login", "--username", "podmantest", "--password", "test", "--cert-dir", certDir, server})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"push", "--cert-dir", certDir, ALPINE, testImg})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"logout", server})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman login and logout with multi registry", func() {
certDir := filepath.Join(os.Getenv("HOME"), ".config/containers/certs.d", "localhost:9001")
@@ -225,7 +226,7 @@ var _ = Describe("Podman login and logout", func() {
"-v", strings.Join([]string{certPath, "/certs"}, ":"), "-e", "REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt",
"-e", "REGISTRY_HTTP_TLS_KEY=/certs/domain.key", "registry:2.6"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
if !WaitContainerReady(podmanTest, "registry1", "listening on", 20, 1) {
Skip("Cannot start docker registry.")
@@ -233,11 +234,11 @@ var _ = Describe("Podman login and logout", func() {
session = podmanTest.Podman([]string{"login", "--username", "podmantest", "--password", "test", server})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"push", ALPINE, testImg})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"push", ALPINE, "localhost:9001/test-alpine"})
session.WaitWithDefaultTimeout()
@@ -245,19 +246,19 @@ var _ = Describe("Podman login and logout", func() {
session = podmanTest.Podman([]string{"login", "--username", "podmantest", "--password", "test", "localhost:9001"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"push", ALPINE, testImg})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"push", ALPINE, "localhost:9001/test-alpine"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"logout", server})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"push", ALPINE, testImg})
session.WaitWithDefaultTimeout()
@@ -265,15 +266,15 @@ var _ = Describe("Podman login and logout", func() {
session = podmanTest.Podman([]string{"push", ALPINE, "localhost:9001/test-alpine"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"login", "--username", "podmantest", "--password", "test", "localhost:9001"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"logout", "-a"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"push", ALPINE, testImg})
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/logs_test.go b/test/e2e/logs_test.go
index b576fa072..507fab461 100644
--- a/test/e2e/logs_test.go
+++ b/test/e2e/logs_test.go
@@ -145,12 +145,12 @@ var _ = Describe("Podman logs", func() {
SkipIfRemote("FIXME: podman-remote logs does not support showing two containers at the same time")
log1 := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
log1.WaitWithDefaultTimeout()
- Expect(log1.ExitCode()).To(Equal(0))
+ Expect(log1).Should(Exit(0))
cid1 := log1.OutputToString()
log2 := podmanTest.Podman([]string{"run", "--log-driver", log, "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
log2.WaitWithDefaultTimeout()
- Expect(log2.ExitCode()).To(Equal(0))
+ Expect(log2).Should(Exit(0))
cid2 := log2.OutputToString()
results := podmanTest.Podman([]string{"logs", cid1, cid2})
diff --git a/test/e2e/manifest_test.go b/test/e2e/manifest_test.go
index b2dc4f734..95f90d4c1 100644
--- a/test/e2e/manifest_test.go
+++ b/test/e2e/manifest_test.go
@@ -47,13 +47,19 @@ var _ = Describe("Podman manifest", func() {
It("podman manifest create", func() {
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
+ })
+
+ It("podman manifest create", func() {
+ session := podmanTest.Podman([]string{"manifest", "create", "foo", imageList})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
})
It("podman manifest inspect", func() {
session := podmanTest.Podman([]string{"manifest", "inspect", BB})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"manifest", "inspect", "quay.io/libpod/busybox"})
session.WaitWithDefaultTimeout()
@@ -68,35 +74,35 @@ var _ = Describe("Podman manifest", func() {
It("podman manifest add", func() {
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"manifest", "add", "--arch=arm64", "foo", imageListInstance})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman manifest add one", func() {
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"manifest", "add", "--arch=arm64", "foo", imageListInstance})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"manifest", "inspect", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(imageListARM64InstanceDigest))
})
It("podman manifest add --all", func() {
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"manifest", "add", "--all", "foo", imageList})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"manifest", "inspect", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(imageListAMD64InstanceDigest))
Expect(session.OutputToString()).To(ContainSubstring(imageListARMInstanceDigest))
Expect(session.OutputToString()).To(ContainSubstring(imageListARM64InstanceDigest))
@@ -107,13 +113,13 @@ var _ = Describe("Podman manifest", func() {
It("podman manifest add --os", func() {
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"manifest", "add", "--os", "bar", "foo", imageList})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"manifest", "inspect", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(`"os": "bar"`))
})
@@ -121,36 +127,36 @@ var _ = Describe("Podman manifest", func() {
SkipIfRemote("Not supporting annotate on remote connections")
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"manifest", "add", "foo", imageListInstance})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"manifest", "annotate", "--arch", "bar", "foo", imageListARM64InstanceDigest})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"manifest", "inspect", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(`"architecture": "bar"`))
})
It("podman manifest remove", func() {
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"manifest", "add", "--all", "foo", imageList})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"manifest", "inspect", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(imageListARM64InstanceDigest))
session = podmanTest.Podman([]string{"manifest", "remove", "foo", imageListARM64InstanceDigest})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"manifest", "inspect", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(imageListAMD64InstanceDigest))
Expect(session.OutputToString()).To(ContainSubstring(imageListARMInstanceDigest))
Expect(session.OutputToString()).To(ContainSubstring(imageListPPC64LEInstanceDigest))
@@ -161,27 +167,27 @@ var _ = Describe("Podman manifest", func() {
It("podman manifest remove not-found", func() {
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"manifest", "add", "foo", imageList})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"manifest", "remove", "foo", "sha256:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
session = podmanTest.Podman([]string{"manifest", "rm", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman manifest push", func() {
SkipIfRemote("manifest push to dir not supported in remote mode")
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"manifest", "add", "--all", "foo", imageList})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
dest := filepath.Join(podmanTest.TempDir, "pushed")
err := os.MkdirAll(dest, os.ModePerm)
Expect(err).To(BeNil())
@@ -190,12 +196,12 @@ var _ = Describe("Podman manifest", func() {
}()
session = podmanTest.Podman([]string{"manifest", "push", "--all", "foo", "dir:" + dest})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
files, err := filepath.Glob(dest + string(os.PathSeparator) + "*")
Expect(err).To(BeNil())
check := SystemExec("sha256sum", files)
check.WaitWithDefaultTimeout()
- Expect(check.ExitCode()).To(Equal(0))
+ Expect(check).Should(Exit(0))
prefix := "sha256:"
Expect(check.OutputToString()).To(ContainSubstring(strings.TrimPrefix(imageListAMD64InstanceDigest, prefix)))
Expect(check.OutputToString()).To(ContainSubstring(strings.TrimPrefix(imageListARMInstanceDigest, prefix)))
@@ -208,10 +214,10 @@ var _ = Describe("Podman manifest", func() {
SkipIfRemote("manifest push to dir not supported in remote mode")
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"manifest", "add", "--all", "foo", imageList})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
dest := filepath.Join(podmanTest.TempDir, "pushed")
err := os.MkdirAll(dest, os.ModePerm)
Expect(err).To(BeNil())
@@ -220,12 +226,12 @@ var _ = Describe("Podman manifest", func() {
}()
session = podmanTest.Podman([]string{"push", "foo", "dir:" + dest})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
files, err := filepath.Glob(dest + string(os.PathSeparator) + "*")
Expect(err).To(BeNil())
check := SystemExec("sha256sum", files)
check.WaitWithDefaultTimeout()
- Expect(check.ExitCode()).To(Equal(0))
+ Expect(check).Should(Exit(0))
prefix := "sha256:"
Expect(check.OutputToString()).To(ContainSubstring(strings.TrimPrefix(imageListAMD64InstanceDigest, prefix)))
Expect(check.OutputToString()).To(ContainSubstring(strings.TrimPrefix(imageListARMInstanceDigest, prefix)))
@@ -238,10 +244,10 @@ var _ = Describe("Podman manifest", func() {
SkipIfRemote("remote does not support --rm")
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"manifest", "add", "foo", imageList})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
dest := filepath.Join(podmanTest.TempDir, "pushed")
err := os.MkdirAll(dest, os.ModePerm)
Expect(err).To(BeNil())
@@ -250,28 +256,28 @@ var _ = Describe("Podman manifest", func() {
}()
session = podmanTest.Podman([]string{"manifest", "push", "--purge", "foo", "dir:" + dest})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"manifest", "inspect", "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
session = podmanTest.Podman([]string{"manifest", "rm", "foo1", "foo2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
})
It("podman manifest exists", func() {
manifestList := "manifest-list"
session := podmanTest.Podman([]string{"manifest", "create", manifestList})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"manifest", "exists", manifestList})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"manifest", "exists", "no-manifest"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(1))
+ Expect(session).Should(Exit(1))
})
})
diff --git a/test/e2e/mount_rootless_test.go b/test/e2e/mount_rootless_test.go
index 502bdef4e..b66826b31 100644
--- a/test/e2e/mount_rootless_test.go
+++ b/test/e2e/mount_rootless_test.go
@@ -6,6 +6,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman mount", func() {
@@ -37,31 +38,31 @@ var _ = Describe("Podman mount", func() {
It("podman mount", func() {
setup := podmanTest.Podman([]string{"create", ALPINE, "ls"})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
cid := setup.OutputToString()
mount := podmanTest.Podman([]string{"mount", cid})
mount.WaitWithDefaultTimeout()
- Expect(mount.ExitCode()).ToNot(Equal(0))
+ Expect(mount).To(ExitWithError())
Expect(mount.ErrorToString()).To(ContainSubstring("podman unshare"))
})
It("podman unshare podman mount", func() {
setup := podmanTest.Podman([]string{"create", ALPINE, "ls"})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
cid := setup.OutputToString()
session := podmanTest.Podman([]string{"unshare", PODMAN_BINARY, "mount", cid})
session.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
})
It("podman image mount", func() {
podmanTest.AddImageToRWStore(ALPINE)
mount := podmanTest.Podman([]string{"image", "mount", ALPINE})
mount.WaitWithDefaultTimeout()
- Expect(mount.ExitCode()).ToNot(Equal(0))
+ Expect(mount).To(ExitWithError())
Expect(mount.ErrorToString()).To(ContainSubstring("podman unshare"))
})
@@ -69,10 +70,10 @@ var _ = Describe("Podman mount", func() {
podmanTest.AddImageToRWStore(ALPINE)
setup := podmanTest.Podman([]string{"pull", ALPINE})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
session := podmanTest.Podman([]string{"unshare", PODMAN_BINARY, "image", "mount", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
})
})
diff --git a/test/e2e/mount_test.go b/test/e2e/mount_test.go
index ee77f2984..141d1a386 100644
--- a/test/e2e/mount_test.go
+++ b/test/e2e/mount_test.go
@@ -6,6 +6,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman mount", func() {
@@ -37,175 +38,175 @@ var _ = Describe("Podman mount", func() {
It("podman mount", func() {
setup := podmanTest.Podman([]string{"create", ALPINE, "ls"})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
cid := setup.OutputToString()
mount := podmanTest.Podman([]string{"mount", cid})
mount.WaitWithDefaultTimeout()
- Expect(mount.ExitCode()).To(Equal(0))
+ Expect(mount).Should(Exit(0))
umount := podmanTest.Podman([]string{"umount", cid})
umount.WaitWithDefaultTimeout()
- Expect(umount.ExitCode()).To(Equal(0))
+ Expect(umount).Should(Exit(0))
})
It("podman container mount", func() {
setup := podmanTest.Podman([]string{"container", "create", ALPINE, "ls"})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
cid := setup.OutputToString()
mount := podmanTest.Podman([]string{"container", "mount", cid})
mount.WaitWithDefaultTimeout()
- Expect(mount.ExitCode()).To(Equal(0))
+ Expect(mount).Should(Exit(0))
umount := podmanTest.Podman([]string{"container", "umount", cid})
umount.WaitWithDefaultTimeout()
- Expect(umount.ExitCode()).To(Equal(0))
+ Expect(umount).Should(Exit(0))
})
It("podman mount with json format", func() {
setup := podmanTest.Podman([]string{"create", ALPINE, "ls"})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
cid := setup.OutputToString()
mount := podmanTest.Podman([]string{"mount", cid})
mount.WaitWithDefaultTimeout()
- Expect(mount.ExitCode()).To(Equal(0))
+ Expect(mount).Should(Exit(0))
j := podmanTest.Podman([]string{"mount", "--format=json"})
j.WaitWithDefaultTimeout()
- Expect(j.ExitCode()).To(Equal(0))
+ Expect(j).Should(Exit(0))
Expect(j.IsJSONOutputValid()).To(BeTrue())
j = podmanTest.Podman([]string{"mount", "--format='{{.foobar}}'"})
j.WaitWithDefaultTimeout()
- Expect(j.ExitCode()).ToNot(Equal(0))
+ Expect(j).To(ExitWithError())
Expect(j.ErrorToString()).To(ContainSubstring("unknown --format"))
umount := podmanTest.Podman([]string{"umount", cid})
umount.WaitWithDefaultTimeout()
- Expect(umount.ExitCode()).To(Equal(0))
+ Expect(umount).Should(Exit(0))
})
It("podman mount many", func() {
setup1 := podmanTest.Podman([]string{"create", ALPINE, "ls"})
setup1.WaitWithDefaultTimeout()
- Expect(setup1.ExitCode()).To(Equal(0))
+ Expect(setup1).Should(Exit(0))
cid1 := setup1.OutputToString()
setup2 := podmanTest.Podman([]string{"create", ALPINE, "ls"})
setup2.WaitWithDefaultTimeout()
- Expect(setup2.ExitCode()).To(Equal(0))
+ Expect(setup2).Should(Exit(0))
cid2 := setup2.OutputToString()
setup3 := podmanTest.Podman([]string{"create", ALPINE, "ls"})
setup3.WaitWithDefaultTimeout()
- Expect(setup3.ExitCode()).To(Equal(0))
+ Expect(setup3).Should(Exit(0))
cid3 := setup3.OutputToString()
mount1 := podmanTest.Podman([]string{"mount", cid1, cid2, cid3})
mount1.WaitWithDefaultTimeout()
- Expect(mount1.ExitCode()).To(Equal(0))
+ Expect(mount1).Should(Exit(0))
umount := podmanTest.Podman([]string{"umount", cid1, cid2, cid3})
umount.WaitWithDefaultTimeout()
- Expect(umount.ExitCode()).To(Equal(0))
+ Expect(umount).Should(Exit(0))
})
It("podman umount many", func() {
setup1 := podmanTest.Podman([]string{"create", ALPINE, "ls"})
setup1.WaitWithDefaultTimeout()
- Expect(setup1.ExitCode()).To(Equal(0))
+ Expect(setup1).Should(Exit(0))
cid1 := setup1.OutputToString()
setup2 := podmanTest.Podman([]string{"create", ALPINE, "ls"})
setup2.WaitWithDefaultTimeout()
- Expect(setup2.ExitCode()).To(Equal(0))
+ Expect(setup2).Should(Exit(0))
cid2 := setup2.OutputToString()
mount1 := podmanTest.Podman([]string{"mount", cid1})
mount1.WaitWithDefaultTimeout()
- Expect(mount1.ExitCode()).To(Equal(0))
+ Expect(mount1).Should(Exit(0))
mount2 := podmanTest.Podman([]string{"mount", cid2})
mount2.WaitWithDefaultTimeout()
- Expect(mount2.ExitCode()).To(Equal(0))
+ Expect(mount2).Should(Exit(0))
umount := podmanTest.Podman([]string{"umount", cid1, cid2})
umount.WaitWithDefaultTimeout()
- Expect(umount.ExitCode()).To(Equal(0))
+ Expect(umount).Should(Exit(0))
})
It("podman umount all", func() {
setup1 := podmanTest.Podman([]string{"create", ALPINE, "ls"})
setup1.WaitWithDefaultTimeout()
- Expect(setup1.ExitCode()).To(Equal(0))
+ Expect(setup1).Should(Exit(0))
cid1 := setup1.OutputToString()
setup2 := podmanTest.Podman([]string{"create", ALPINE, "ls"})
setup2.WaitWithDefaultTimeout()
- Expect(setup2.ExitCode()).To(Equal(0))
+ Expect(setup2).Should(Exit(0))
cid2 := setup2.OutputToString()
mount1 := podmanTest.Podman([]string{"mount", cid1})
mount1.WaitWithDefaultTimeout()
- Expect(mount1.ExitCode()).To(Equal(0))
+ Expect(mount1).Should(Exit(0))
mount2 := podmanTest.Podman([]string{"mount", cid2})
mount2.WaitWithDefaultTimeout()
- Expect(mount2.ExitCode()).To(Equal(0))
+ Expect(mount2).Should(Exit(0))
umount := podmanTest.Podman([]string{"umount", "--all"})
umount.WaitWithDefaultTimeout()
- Expect(umount.ExitCode()).To(Equal(0))
+ Expect(umount).Should(Exit(0))
})
It("podman list mounted container", func() {
setup := podmanTest.Podman([]string{"create", ALPINE, "ls"})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
cid := setup.OutputToString()
lmount := podmanTest.Podman([]string{"mount", "--notruncate"})
lmount.WaitWithDefaultTimeout()
- Expect(lmount.ExitCode()).To(Equal(0))
+ Expect(lmount).Should(Exit(0))
Expect(lmount.OutputToString()).To(Equal(""))
mount := podmanTest.Podman([]string{"mount", cid})
mount.WaitWithDefaultTimeout()
- Expect(mount.ExitCode()).To(Equal(0))
+ Expect(mount).Should(Exit(0))
lmount = podmanTest.Podman([]string{"mount", "--notruncate"})
lmount.WaitWithDefaultTimeout()
- Expect(lmount.ExitCode()).To(Equal(0))
+ Expect(lmount).Should(Exit(0))
Expect(lmount.OutputToString()).To(ContainSubstring(cid))
umount := podmanTest.Podman([]string{"umount", cid})
umount.WaitWithDefaultTimeout()
- Expect(umount.ExitCode()).To(Equal(0))
+ Expect(umount).Should(Exit(0))
})
It("podman list running container", func() {
setup := podmanTest.Podman([]string{"run", "-dt", ALPINE, "top"})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
cid := setup.OutputToString()
lmount := podmanTest.Podman([]string{"mount", "--notruncate"})
lmount.WaitWithDefaultTimeout()
- Expect(lmount.ExitCode()).To(Equal(0))
+ Expect(lmount).Should(Exit(0))
Expect(lmount.OutputToString()).To(ContainSubstring(cid))
stop := podmanTest.Podman([]string{"stop", cid})
stop.WaitWithDefaultTimeout()
- Expect(stop.ExitCode()).To(Equal(0))
+ Expect(stop).Should(Exit(0))
lmount = podmanTest.Podman([]string{"mount", "--notruncate"})
lmount.WaitWithDefaultTimeout()
- Expect(lmount.ExitCode()).To(Equal(0))
+ Expect(lmount).Should(Exit(0))
Expect(lmount.OutputToString()).To(Equal(""))
})
@@ -213,42 +214,42 @@ var _ = Describe("Podman mount", func() {
setup := podmanTest.Podman([]string{"create", ALPINE, "ls"})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
cid1 := setup.OutputToString()
setup = podmanTest.Podman([]string{"create", ALPINE, "ls"})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
cid2 := setup.OutputToString()
setup = podmanTest.Podman([]string{"create", ALPINE, "ls"})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
cid3 := setup.OutputToString()
lmount := podmanTest.Podman([]string{"mount", "--notruncate"})
lmount.WaitWithDefaultTimeout()
- Expect(lmount.ExitCode()).To(Equal(0))
+ Expect(lmount).Should(Exit(0))
Expect(lmount.OutputToString()).To(Equal(""))
mount := podmanTest.Podman([]string{"mount", cid1, cid3})
mount.WaitWithDefaultTimeout()
- Expect(mount.ExitCode()).To(Equal(0))
+ Expect(mount).Should(Exit(0))
lmount = podmanTest.Podman([]string{"mount", "--notruncate"})
lmount.WaitWithDefaultTimeout()
- Expect(lmount.ExitCode()).To(Equal(0))
+ Expect(lmount).Should(Exit(0))
Expect(lmount.OutputToString()).To(ContainSubstring(cid1))
Expect(lmount.OutputToString()).ToNot(ContainSubstring(cid2))
Expect(lmount.OutputToString()).To(ContainSubstring(cid3))
umount := podmanTest.Podman([]string{"umount", cid1, cid3})
umount.WaitWithDefaultTimeout()
- Expect(umount.ExitCode()).To(Equal(0))
+ Expect(umount).Should(Exit(0))
lmount = podmanTest.Podman([]string{"mount", "--notruncate"})
lmount.WaitWithDefaultTimeout()
- Expect(lmount.ExitCode()).To(Equal(0))
+ Expect(lmount).Should(Exit(0))
Expect(lmount.OutputToString()).To(Equal(""))
})
@@ -257,95 +258,95 @@ var _ = Describe("Podman mount", func() {
setup := podmanTest.Podman([]string{"create", ALPINE, "ls"})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
cid := setup.OutputToString()
lmount := podmanTest.Podman([]string{"mount", "--notruncate"})
lmount.WaitWithDefaultTimeout()
- Expect(lmount.ExitCode()).To(Equal(0))
+ Expect(lmount).Should(Exit(0))
Expect(lmount.OutputToString()).To(Equal(""))
mount := podmanTest.Podman([]string{"mount", cid})
mount.WaitWithDefaultTimeout()
- Expect(mount.ExitCode()).To(Equal(0))
+ Expect(mount).Should(Exit(0))
lmount = podmanTest.Podman([]string{"mount", "--notruncate"})
lmount.WaitWithDefaultTimeout()
- Expect(lmount.ExitCode()).To(Equal(0))
+ Expect(lmount).Should(Exit(0))
Expect(lmount.OutputToString()).To(ContainSubstring(cid))
umount := podmanTest.Podman([]string{"umount", cid})
umount.WaitWithDefaultTimeout()
- Expect(umount.ExitCode()).To(Equal(0))
+ Expect(umount).Should(Exit(0))
})
It("podman image mount", func() {
images := podmanTest.Podman([]string{"images"})
images.WaitWithDefaultTimeout()
- Expect(images.ExitCode()).To(Equal(0))
+ Expect(images).Should(Exit(0))
mount := podmanTest.Podman([]string{"image", "mount", ALPINE})
mount.WaitWithDefaultTimeout()
- Expect(mount.ExitCode()).To(Equal(0))
+ Expect(mount).Should(Exit(0))
umount := podmanTest.Podman([]string{"image", "umount", ALPINE})
umount.WaitWithDefaultTimeout()
- Expect(umount.ExitCode()).To(Equal(0))
+ Expect(umount).Should(Exit(0))
mount = podmanTest.Podman([]string{"image", "mount"})
mount.WaitWithDefaultTimeout()
- Expect(mount.ExitCode()).To(Equal(0))
+ Expect(mount).Should(Exit(0))
Expect(mount.OutputToString()).To(Equal(""))
// Mount multiple times
mount = podmanTest.Podman([]string{"image", "mount", ALPINE})
mount.WaitWithDefaultTimeout()
- Expect(mount.ExitCode()).To(Equal(0))
+ Expect(mount).Should(Exit(0))
mount = podmanTest.Podman([]string{"image", "mount", ALPINE})
mount.WaitWithDefaultTimeout()
- Expect(mount.ExitCode()).To(Equal(0))
+ Expect(mount).Should(Exit(0))
// Unmount once
mount = podmanTest.Podman([]string{"image", "mount", ALPINE})
mount.WaitWithDefaultTimeout()
- Expect(mount.ExitCode()).To(Equal(0))
+ Expect(mount).Should(Exit(0))
mount = podmanTest.Podman([]string{"image", "mount"})
mount.WaitWithDefaultTimeout()
- Expect(mount.ExitCode()).To(Equal(0))
+ Expect(mount).Should(Exit(0))
Expect(mount.OutputToString()).To(ContainSubstring(ALPINE))
mount = podmanTest.Podman([]string{"image", "umount", "--all"})
mount.WaitWithDefaultTimeout()
- Expect(mount.ExitCode()).To(Equal(0))
+ Expect(mount).Should(Exit(0))
})
It("podman mount with json format", func() {
podmanTest.AddImageToRWStore(fedoraMinimal)
mount := podmanTest.Podman([]string{"image", "mount", fedoraMinimal})
mount.WaitWithDefaultTimeout()
- Expect(mount.ExitCode()).To(Equal(0))
+ Expect(mount).Should(Exit(0))
j := podmanTest.Podman([]string{"image", "mount", "--format=json"})
j.WaitWithDefaultTimeout()
- Expect(j.ExitCode()).To(Equal(0))
+ Expect(j).Should(Exit(0))
Expect(j.IsJSONOutputValid()).To(BeTrue())
umount := podmanTest.Podman([]string{"image", "umount", fedoraMinimal})
umount.WaitWithDefaultTimeout()
- Expect(umount.ExitCode()).To(Equal(0))
+ Expect(umount).Should(Exit(0))
})
It("podman umount --all", func() {
podmanTest.AddImageToRWStore(fedoraMinimal)
mount := podmanTest.Podman([]string{"image", "mount", fedoraMinimal})
mount.WaitWithDefaultTimeout()
- Expect(mount.ExitCode()).To(Equal(0))
+ Expect(mount).Should(Exit(0))
umount := podmanTest.Podman([]string{"image", "umount", "--all"})
umount.WaitWithDefaultTimeout()
- Expect(umount.ExitCode()).To(Equal(0))
+ Expect(umount).Should(Exit(0))
Expect(len(umount.OutputToStringArray())).To(Equal(1))
})
@@ -356,66 +357,66 @@ var _ = Describe("Podman mount", func() {
mount1 := podmanTest.Podman([]string{"image", "mount", fedoraMinimal, ALPINE, "busybox"})
mount1.WaitWithDefaultTimeout()
- Expect(mount1.ExitCode()).To(Equal(0))
+ Expect(mount1).Should(Exit(0))
umount := podmanTest.Podman([]string{"image", "umount", fedoraMinimal, ALPINE})
umount.WaitWithDefaultTimeout()
- Expect(umount.ExitCode()).To(Equal(0))
+ Expect(umount).Should(Exit(0))
mount := podmanTest.Podman([]string{"image", "mount"})
mount.WaitWithDefaultTimeout()
- Expect(mount.ExitCode()).To(Equal(0))
+ Expect(mount).Should(Exit(0))
Expect(mount.OutputToString()).To(ContainSubstring("busybox"))
mount1 = podmanTest.Podman([]string{"image", "unmount", "busybox"})
mount1.WaitWithDefaultTimeout()
- Expect(mount1.ExitCode()).To(Equal(0))
+ Expect(mount1).Should(Exit(0))
mount = podmanTest.Podman([]string{"image", "mount"})
mount.WaitWithDefaultTimeout()
- Expect(mount.ExitCode()).To(Equal(0))
+ Expect(mount).Should(Exit(0))
Expect(mount.OutputToString()).To(Equal(""))
mount1 = podmanTest.Podman([]string{"image", "mount", fedoraMinimal, ALPINE, "busybox"})
mount1.WaitWithDefaultTimeout()
- Expect(mount1.ExitCode()).To(Equal(0))
+ Expect(mount1).Should(Exit(0))
mount = podmanTest.Podman([]string{"image", "mount"})
mount.WaitWithDefaultTimeout()
- Expect(mount.ExitCode()).To(Equal(0))
+ Expect(mount).Should(Exit(0))
Expect(mount.OutputToString()).To(ContainSubstring(fedoraMinimal))
Expect(mount.OutputToString()).To(ContainSubstring(ALPINE))
umount = podmanTest.Podman([]string{"image", "umount", "--all"})
umount.WaitWithDefaultTimeout()
- Expect(umount.ExitCode()).To(Equal(0))
+ Expect(umount).Should(Exit(0))
mount = podmanTest.Podman([]string{"image", "mount"})
mount.WaitWithDefaultTimeout()
- Expect(mount.ExitCode()).To(Equal(0))
+ Expect(mount).Should(Exit(0))
Expect(mount.OutputToString()).To(Equal(""))
umount = podmanTest.Podman([]string{"image", "umount", fedoraMinimal, ALPINE})
umount.WaitWithDefaultTimeout()
- Expect(umount.ExitCode()).To(Equal(0))
+ Expect(umount).Should(Exit(0))
mount1 = podmanTest.Podman([]string{"image", "mount", "--all"})
mount1.WaitWithDefaultTimeout()
- Expect(mount1.ExitCode()).To(Equal(0))
+ Expect(mount1).Should(Exit(0))
mount = podmanTest.Podman([]string{"image", "mount"})
mount.WaitWithDefaultTimeout()
- Expect(mount.ExitCode()).To(Equal(0))
+ Expect(mount).Should(Exit(0))
Expect(mount.OutputToString()).To(ContainSubstring(fedoraMinimal))
Expect(mount.OutputToString()).To(ContainSubstring(ALPINE))
umount = podmanTest.Podman([]string{"image", "umount", "--all"})
umount.WaitWithDefaultTimeout()
- Expect(umount.ExitCode()).To(Equal(0))
+ Expect(umount).Should(Exit(0))
mount = podmanTest.Podman([]string{"image", "mount"})
mount.WaitWithDefaultTimeout()
- Expect(mount.ExitCode()).To(Equal(0))
+ Expect(mount).Should(Exit(0))
Expect(mount.OutputToString()).To(Equal(""))
})
})
diff --git a/test/e2e/namespace_test.go b/test/e2e/namespace_test.go
index 0c451d6cd..43edee1a5 100644
--- a/test/e2e/namespace_test.go
+++ b/test/e2e/namespace_test.go
@@ -6,6 +6,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman namespaces", func() {
@@ -37,15 +38,15 @@ var _ = Describe("Podman namespaces", func() {
podman1.WaitWithDefaultTimeout()
if IsRemote() {
// --namespace flag not supported in podman remote
- Expect(podman1.ExitCode()).To(Equal(125))
+ Expect(podman1).Should(Exit(125))
Expect(podman1.ErrorToString()).To(ContainSubstring("unknown flag: --namespace"))
return
}
- Expect(podman1.ExitCode()).To(Equal(0))
+ Expect(podman1).Should(Exit(0))
podman2 := podmanTest.Podman([]string{"--namespace", "test2", "ps", "-aq"})
podman2.WaitWithDefaultTimeout()
- Expect(podman2.ExitCode()).To(Equal(0))
+ Expect(podman2).Should(Exit(0))
output := podman2.OutputToStringArray()
numCtrs := 0
for _, outputLine := range output {
diff --git a/test/e2e/network_connect_disconnect_test.go b/test/e2e/network_connect_disconnect_test.go
index c82aacbe4..b1f3607ab 100644
--- a/test/e2e/network_connect_disconnect_test.go
+++ b/test/e2e/network_connect_disconnect_test.go
@@ -7,6 +7,7 @@ import (
"github.com/containers/storage/pkg/stringid"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman network connect and disconnect", func() {
@@ -35,19 +36,19 @@ var _ = Describe("Podman network connect and disconnect", func() {
It("bad network name in disconnect should result in error", func() {
dis := podmanTest.Podman([]string{"network", "disconnect", "foobar", "test"})
dis.WaitWithDefaultTimeout()
- Expect(dis.ExitCode()).ToNot(BeZero())
+ Expect(dis).Should(ExitWithError())
})
It("bad container name in network disconnect should result in error", func() {
netName := "aliasTest" + stringid.GenerateNonCryptoID()
session := podmanTest.Podman([]string{"network", "create", netName})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
defer podmanTest.removeCNINetwork(netName)
dis := podmanTest.Podman([]string{"network", "disconnect", netName, "foobar"})
dis.WaitWithDefaultTimeout()
- Expect(dis.ExitCode()).ToNot(BeZero())
+ Expect(dis).Should(ExitWithError())
})
It("network disconnect with net mode slirp4netns should result in error", func() {
@@ -55,17 +56,17 @@ var _ = Describe("Podman network connect and disconnect", func() {
netName := "slirp" + stringid.GenerateNonCryptoID()
session := podmanTest.Podman([]string{"network", "create", netName})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
defer podmanTest.removeCNINetwork(netName)
session = podmanTest.Podman([]string{"create", "--name", "test", "--network", "slirp4netns", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
defer podmanTest.removeCNINetwork(netName)
con := podmanTest.Podman([]string{"network", "disconnect", netName, "test"})
con.WaitWithDefaultTimeout()
- Expect(con.ExitCode()).ToNot(BeZero())
+ Expect(con).Should(ExitWithError())
Expect(con.ErrorToString()).To(ContainSubstring(`"slirp4netns" is not supported: invalid network mode`))
})
@@ -73,47 +74,47 @@ var _ = Describe("Podman network connect and disconnect", func() {
netName := "aliasTest" + stringid.GenerateNonCryptoID()
session := podmanTest.Podman([]string{"network", "create", netName})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
defer podmanTest.removeCNINetwork(netName)
ctr := podmanTest.Podman([]string{"run", "-dt", "--name", "test", "--network", netName, ALPINE, "top"})
ctr.WaitWithDefaultTimeout()
- Expect(ctr.ExitCode()).To(BeZero())
+ Expect(ctr).Should(Exit(0))
exec := podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth0"})
exec.WaitWithDefaultTimeout()
- Expect(exec.ExitCode()).To(BeZero())
+ Expect(exec).Should(Exit(0))
dis := podmanTest.Podman([]string{"network", "disconnect", netName, "test"})
dis.WaitWithDefaultTimeout()
- Expect(dis.ExitCode()).To(BeZero())
+ Expect(dis).Should(Exit(0))
inspect := podmanTest.Podman([]string{"container", "inspect", "test", "--format", "{{len .NetworkSettings.Networks}}"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(BeZero())
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(Equal("0"))
exec = podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth0"})
exec.WaitWithDefaultTimeout()
- Expect(exec.ExitCode()).ToNot(BeZero())
+ Expect(exec).Should(ExitWithError())
})
It("bad network name in connect should result in error", func() {
dis := podmanTest.Podman([]string{"network", "connect", "foobar", "test"})
dis.WaitWithDefaultTimeout()
- Expect(dis.ExitCode()).ToNot(BeZero())
+ Expect(dis).Should(ExitWithError())
})
It("bad container name in network connect should result in error", func() {
netName := "aliasTest" + stringid.GenerateNonCryptoID()
session := podmanTest.Podman([]string{"network", "create", netName})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
defer podmanTest.removeCNINetwork(netName)
dis := podmanTest.Podman([]string{"network", "connect", netName, "foobar"})
dis.WaitWithDefaultTimeout()
- Expect(dis.ExitCode()).ToNot(BeZero())
+ Expect(dis).Should(ExitWithError())
})
It("network connect with net mode slirp4netns should result in error", func() {
@@ -121,17 +122,17 @@ var _ = Describe("Podman network connect and disconnect", func() {
netName := "slirp" + stringid.GenerateNonCryptoID()
session := podmanTest.Podman([]string{"network", "create", netName})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
defer podmanTest.removeCNINetwork(netName)
session = podmanTest.Podman([]string{"create", "--name", "test", "--network", "slirp4netns", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
defer podmanTest.removeCNINetwork(netName)
con := podmanTest.Podman([]string{"network", "connect", netName, "test"})
con.WaitWithDefaultTimeout()
- Expect(con.ExitCode()).ToNot(BeZero())
+ Expect(con).Should(ExitWithError())
Expect(con.ErrorToString()).To(ContainSubstring(`"slirp4netns" is not supported: invalid network mode`))
})
@@ -139,16 +140,16 @@ var _ = Describe("Podman network connect and disconnect", func() {
netName := "aliasTest" + stringid.GenerateNonCryptoID()
session := podmanTest.Podman([]string{"network", "create", netName})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
defer podmanTest.removeCNINetwork(netName)
ctr := podmanTest.Podman([]string{"create", "--name", "test", "--network", netName, ALPINE, "top"})
ctr.WaitWithDefaultTimeout()
- Expect(ctr.ExitCode()).To(BeZero())
+ Expect(ctr).Should(Exit(0))
con := podmanTest.Podman([]string{"network", "connect", netName, "test"})
con.WaitWithDefaultTimeout()
- Expect(con.ExitCode()).ToNot(BeZero())
+ Expect(con).Should(ExitWithError())
})
It("podman network connect", func() {
@@ -156,41 +157,41 @@ var _ = Describe("Podman network connect and disconnect", func() {
netName := "aliasTest" + stringid.GenerateNonCryptoID()
session := podmanTest.Podman([]string{"network", "create", netName})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
defer podmanTest.removeCNINetwork(netName)
ctr := podmanTest.Podman([]string{"run", "-dt", "--name", "test", "--network", netName, ALPINE, "top"})
ctr.WaitWithDefaultTimeout()
- Expect(ctr.ExitCode()).To(BeZero())
+ Expect(ctr).Should(Exit(0))
exec := podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth0"})
exec.WaitWithDefaultTimeout()
- Expect(exec.ExitCode()).To(BeZero())
+ Expect(exec).Should(Exit(0))
// Create a second network
newNetName := "aliasTest" + stringid.GenerateNonCryptoID()
session = podmanTest.Podman([]string{"network", "create", newNetName})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
defer podmanTest.removeCNINetwork(newNetName)
connect := podmanTest.Podman([]string{"network", "connect", newNetName, "test"})
connect.WaitWithDefaultTimeout()
- Expect(connect.ExitCode()).To(BeZero())
+ Expect(connect).Should(Exit(0))
inspect := podmanTest.Podman([]string{"container", "inspect", "test", "--format", "{{len .NetworkSettings.Networks}}"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(BeZero())
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(Equal("2"))
exec = podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth1"})
exec.WaitWithDefaultTimeout()
- Expect(exec.ExitCode()).To(BeZero())
+ Expect(exec).Should(Exit(0))
// make sure no logrus errors are shown https://github.com/containers/podman/issues/9602
rm := podmanTest.Podman([]string{"rm", "-f", "test"})
rm.WaitWithDefaultTimeout()
- Expect(rm.ExitCode()).To(BeZero())
+ Expect(rm).Should(Exit(0))
Expect(rm.ErrorToString()).To(Equal(""))
})
@@ -199,39 +200,39 @@ var _ = Describe("Podman network connect and disconnect", func() {
netName1 := "connect1" + stringid.GenerateNonCryptoID()
session := podmanTest.Podman([]string{"network", "create", netName1})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
defer podmanTest.removeCNINetwork(netName1)
netName2 := "connect2" + stringid.GenerateNonCryptoID()
session = podmanTest.Podman([]string{"network", "create", netName2})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
defer podmanTest.removeCNINetwork(netName2)
ctr := podmanTest.Podman([]string{"create", "--name", "test", "--network", netName1, ALPINE, "top"})
ctr.WaitWithDefaultTimeout()
- Expect(ctr.ExitCode()).To(BeZero())
+ Expect(ctr).Should(Exit(0))
dis := podmanTest.Podman([]string{"network", "connect", netName2, "test"})
dis.WaitWithDefaultTimeout()
- Expect(dis.ExitCode()).To(BeZero())
+ Expect(dis).Should(Exit(0))
inspect := podmanTest.Podman([]string{"container", "inspect", "test", "--format", "{{len .NetworkSettings.Networks}}"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(BeZero())
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(Equal("2"))
start := podmanTest.Podman([]string{"start", "test"})
start.WaitWithDefaultTimeout()
- Expect(start.ExitCode()).To(BeZero())
+ Expect(start).Should(Exit(0))
exec := podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth0"})
exec.WaitWithDefaultTimeout()
- Expect(exec.ExitCode()).To(BeZero())
+ Expect(exec).Should(Exit(0))
exec = podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth1"})
exec.WaitWithDefaultTimeout()
- Expect(exec.ExitCode()).To(BeZero())
+ Expect(exec).Should(Exit(0))
})
It("podman network connect and run with network ID", func() {
@@ -240,86 +241,86 @@ var _ = Describe("Podman network connect and disconnect", func() {
netName := "ID" + stringid.GenerateNonCryptoID()
session := podmanTest.Podman([]string{"network", "create", netName})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
defer podmanTest.removeCNINetwork(netName)
session = podmanTest.Podman([]string{"network", "ls", "--format", "{{.ID}}", "--filter", "name=" + netName})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
netID := session.OutputToString()
ctr := podmanTest.Podman([]string{"run", "-dt", "--name", "test", "--network", netID, ALPINE, "top"})
ctr.WaitWithDefaultTimeout()
- Expect(ctr.ExitCode()).To(BeZero())
+ Expect(ctr).Should(Exit(0))
exec := podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth0"})
exec.WaitWithDefaultTimeout()
- Expect(exec.ExitCode()).To(BeZero())
+ Expect(exec).Should(Exit(0))
// Create a second network
newNetName := "ID2" + stringid.GenerateNonCryptoID()
session = podmanTest.Podman([]string{"network", "create", newNetName})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
defer podmanTest.removeCNINetwork(newNetName)
session = podmanTest.Podman([]string{"network", "ls", "--format", "{{.ID}}", "--filter", "name=" + newNetName})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
newNetID := session.OutputToString()
connect := podmanTest.Podman([]string{"network", "connect", newNetID, "test"})
connect.WaitWithDefaultTimeout()
- Expect(connect.ExitCode()).To(BeZero())
+ Expect(connect).Should(Exit(0))
inspect := podmanTest.Podman([]string{"container", "inspect", "test", "--format", "{{.NetworkSettings.Networks}}"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(BeZero())
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring(netName))
Expect(inspect.OutputToString()).To(ContainSubstring(newNetName))
exec = podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth1"})
exec.WaitWithDefaultTimeout()
- Expect(exec.ExitCode()).To(BeZero())
+ Expect(exec).Should(Exit(0))
})
It("podman network disconnect when not running", func() {
netName1 := "aliasTest" + stringid.GenerateNonCryptoID()
session := podmanTest.Podman([]string{"network", "create", netName1})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
defer podmanTest.removeCNINetwork(netName1)
netName2 := "aliasTest" + stringid.GenerateNonCryptoID()
session2 := podmanTest.Podman([]string{"network", "create", netName2})
session2.WaitWithDefaultTimeout()
- Expect(session2.ExitCode()).To(BeZero())
+ Expect(session2).Should(Exit(0))
defer podmanTest.removeCNINetwork(netName2)
ctr := podmanTest.Podman([]string{"create", "--name", "test", "--network", netName1 + "," + netName2, ALPINE, "top"})
ctr.WaitWithDefaultTimeout()
- Expect(ctr.ExitCode()).To(BeZero())
+ Expect(ctr).Should(Exit(0))
dis := podmanTest.Podman([]string{"network", "disconnect", netName1, "test"})
dis.WaitWithDefaultTimeout()
- Expect(dis.ExitCode()).To(BeZero())
+ Expect(dis).Should(Exit(0))
inspect := podmanTest.Podman([]string{"container", "inspect", "test", "--format", "{{len .NetworkSettings.Networks}}"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(BeZero())
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(Equal("1"))
start := podmanTest.Podman([]string{"start", "test"})
start.WaitWithDefaultTimeout()
- Expect(start.ExitCode()).To(BeZero())
+ Expect(start).Should(Exit(0))
exec := podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth0"})
exec.WaitWithDefaultTimeout()
- Expect(exec.ExitCode()).To(BeZero())
+ Expect(exec).Should(Exit(0))
exec = podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth1"})
exec.WaitWithDefaultTimeout()
- Expect(exec.ExitCode()).ToNot(BeZero())
+ Expect(exec).Should(ExitWithError())
})
It("podman network disconnect and run with network ID", func() {
@@ -328,33 +329,33 @@ var _ = Describe("Podman network connect and disconnect", func() {
netName := "aliasTest" + stringid.GenerateNonCryptoID()
session := podmanTest.Podman([]string{"network", "create", netName})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
defer podmanTest.removeCNINetwork(netName)
session = podmanTest.Podman([]string{"network", "ls", "--format", "{{.ID}}", "--filter", "name=" + netName})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
netID := session.OutputToString()
ctr := podmanTest.Podman([]string{"run", "-dt", "--name", "test", "--network", netID, ALPINE, "top"})
ctr.WaitWithDefaultTimeout()
- Expect(ctr.ExitCode()).To(BeZero())
+ Expect(ctr).Should(Exit(0))
exec := podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth0"})
exec.WaitWithDefaultTimeout()
- Expect(exec.ExitCode()).To(BeZero())
+ Expect(exec).Should(Exit(0))
dis := podmanTest.Podman([]string{"network", "disconnect", netID, "test"})
dis.WaitWithDefaultTimeout()
- Expect(dis.ExitCode()).To(BeZero())
+ Expect(dis).Should(Exit(0))
inspect := podmanTest.Podman([]string{"container", "inspect", "test", "--format", "{{len .NetworkSettings.Networks}}"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(BeZero())
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(Equal("0"))
exec = podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth0"})
exec.WaitWithDefaultTimeout()
- Expect(exec.ExitCode()).ToNot(BeZero())
+ Expect(exec).Should(ExitWithError())
})
})
diff --git a/test/e2e/network_create_test.go b/test/e2e/network_create_test.go
index ef3be8e22..2bec88020 100644
--- a/test/e2e/network_create_test.go
+++ b/test/e2e/network_create_test.go
@@ -13,6 +13,7 @@ import (
"github.com/containers/storage/pkg/stringid"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
"github.com/pkg/errors"
)
@@ -89,7 +90,7 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman([]string{"network", "create"})
nc.WaitWithDefaultTimeout()
- Expect(nc.ExitCode()).To(BeZero())
+ Expect(nc).Should(Exit(0))
fileContent, err := ioutil.ReadFile(nc.OutputToString())
Expect(err).To(BeNil())
@@ -121,7 +122,7 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman([]string{"network", "create", netName})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(netName)
- Expect(nc.ExitCode()).To(BeZero())
+ Expect(nc).Should(Exit(0))
inspect := podmanTest.Podman([]string{"network", "inspect", netName})
inspect.WaitWithDefaultTimeout()
@@ -141,7 +142,7 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman([]string{"network", "create", "--subnet", "10.11.12.0/24", netName})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(netName)
- Expect(nc.ExitCode()).To(BeZero())
+ Expect(nc).Should(Exit(0))
// Inspect the network configuration
inspect := podmanTest.Podman([]string{"network", "inspect", netName})
@@ -184,7 +185,7 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman([]string{"network", "create", "--subnet", "fd00:1:2:3:4::/64", netName})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(netName)
- Expect(nc.ExitCode()).To(BeZero())
+ Expect(nc).Should(Exit(0))
// Inspect the network configuration
inspect := podmanTest.Podman([]string{"network", "inspect", netName})
@@ -225,7 +226,7 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman([]string{"network", "create", "--subnet", "fd00:4:3:2:1::/64", "--ipv6", netName})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(netName)
- Expect(nc.ExitCode()).To(BeZero())
+ Expect(nc).Should(Exit(0))
// Inspect the network configuration
inspect := podmanTest.Podman([]string{"network", "inspect", netName})
@@ -299,7 +300,7 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman([]string{"network", "create", netName})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(netName)
- Expect(nc.ExitCode()).To(BeZero())
+ Expect(nc).Should(Exit(0))
ncFail := podmanTest.Podman([]string{"network", "create", netName})
ncFail.WaitWithDefaultTimeout()
@@ -311,7 +312,7 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman([]string{"network", "create", "--subnet", "10.11.13.0/24", netName1})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(netName1)
- Expect(nc.ExitCode()).To(BeZero())
+ Expect(nc).Should(Exit(0))
netName2 := "sub2-" + stringid.GenerateNonCryptoID()
ncFail := podmanTest.Podman([]string{"network", "create", "--subnet", "10.11.13.0/24", netName2})
@@ -326,7 +327,7 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman([]string{"network", "create", "--subnet", "fd00:4:4:4:4::/64", "--ipv6", netName1})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(netName1)
- Expect(nc.ExitCode()).To(BeZero())
+ Expect(nc).Should(Exit(0))
netName2 := "subipv62-" + stringid.GenerateNonCryptoID()
ncFail := podmanTest.Podman([]string{"network", "create", "--subnet", "fd00:4:4:4:4::/64", "--ipv6", netName2})
@@ -346,11 +347,11 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman([]string{"network", "create", "--opt", "mtu=9000", net})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(net)
- Expect(nc.ExitCode()).To(BeZero())
+ Expect(nc).Should(Exit(0))
nc = podmanTest.Podman([]string{"network", "inspect", net})
nc.WaitWithDefaultTimeout()
- Expect(nc.ExitCode()).To(BeZero())
+ Expect(nc).Should(Exit(0))
Expect(nc.OutputToString()).To(ContainSubstring(`"mtu": 9000,`))
})
@@ -359,11 +360,11 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman([]string{"network", "create", "--opt", "vlan=9", net})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(net)
- Expect(nc.ExitCode()).To(BeZero())
+ Expect(nc).Should(Exit(0))
nc = podmanTest.Podman([]string{"network", "inspect", net})
nc.WaitWithDefaultTimeout()
- Expect(nc.ExitCode()).To(BeZero())
+ Expect(nc).Should(Exit(0))
Expect(nc.OutputToString()).To(ContainSubstring(`"vlan": 9`))
})
@@ -380,7 +381,7 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman([]string{"network", "create", "--internal", net})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(net)
- Expect(nc.ExitCode()).To(BeZero())
+ Expect(nc).Should(Exit(0))
// Not performing this check on remote tests because it is a logrus error which does
// not come back via stderr on the remote client.
if !IsRemote() {
@@ -388,7 +389,7 @@ var _ = Describe("Podman network create", func() {
}
nc = podmanTest.Podman([]string{"network", "inspect", net})
nc.WaitWithDefaultTimeout()
- Expect(nc.ExitCode()).To(BeZero())
+ Expect(nc).Should(Exit(0))
Expect(nc.OutputToString()).ToNot(ContainSubstring("dnsname"))
})
diff --git a/test/e2e/network_test.go b/test/e2e/network_test.go
index a7e61932e..1959ed555 100644
--- a/test/e2e/network_test.go
+++ b/test/e2e/network_test.go
@@ -11,6 +11,7 @@ import (
"github.com/containers/storage/pkg/stringid"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman network", func() {
@@ -42,7 +43,7 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.LineInOutputContains(name)).To(BeTrue())
})
@@ -52,7 +53,7 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "ls", "--quiet"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.LineInOutputContains(name)).To(BeTrue())
})
@@ -62,7 +63,7 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "ls", "--filter", "plugin=bridge"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.LineInOutputContains(name)).To(BeTrue())
})
@@ -72,7 +73,7 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "ls", "--filter", "plugin=bridge", "--filter", "name=" + name})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(name))
})
@@ -85,7 +86,7 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "ls", "--filter", "name=" + name1, "--filter", "name=" + name2})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(name1))
Expect(session.OutputToString()).To(ContainSubstring(name2))
})
@@ -97,23 +98,23 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "create", "--label", label1, net1})
session.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(net1)
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
net2 := "labelnet" + stringid.GenerateNonCryptoID()
session = podmanTest.Podman([]string{"network", "create", "--label", label1, "--label", label2, net2})
session.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(net2)
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"network", "ls", "--filter", "label=" + label1})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(net1))
Expect(session.OutputToString()).To(ContainSubstring(net2))
session = podmanTest.Podman([]string{"network", "ls", "--filter", "label=" + label1, "--filter", "label=" + label2})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).ToNot(ContainSubstring(net1))
Expect(session.OutputToString()).To(ContainSubstring(net2))
})
@@ -123,7 +124,7 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "create", net})
session.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(net)
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"network", "ls", "--filter", "namr=ab"})
session.WaitWithDefaultTimeout()
@@ -137,7 +138,7 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "ls", "--filter", "plugin=test"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.LineInOutputContains(name)).To(BeFalse())
})
@@ -148,45 +149,45 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "create", net})
session.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(net)
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
// Tests Default Table Output
session = podmanTest.Podman([]string{"network", "ls", "--filter", "id=" + netID})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
expectedTable := "NETWORK ID NAME VERSION PLUGINS"
Expect(session.OutputToString()).To(ContainSubstring(expectedTable))
session = podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}} {{.ID}}", "--filter", "id=" + netID})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(net + " " + netID[:12]))
session = podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}} {{.ID}}", "--filter", "id=" + netID[10:50], "--no-trunc"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(net + " " + netID))
session = podmanTest.Podman([]string{"network", "inspect", netID[:40]})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(net))
session = podmanTest.Podman([]string{"network", "inspect", netID[1:]})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).ToNot(BeZero())
+ Expect(session).Should(ExitWithError())
Expect(session.ErrorToString()).To(ContainSubstring("no such network"))
session = podmanTest.Podman([]string{"network", "rm", netID})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
})
rm_func := func(rm string) {
It(fmt.Sprintf("podman network %s no args", rm), func() {
session := podmanTest.Podman([]string{"network", rm})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).ToNot(BeZero())
+ Expect(session).Should(ExitWithError())
})
@@ -196,16 +197,16 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "ls", "--quiet"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.LineInOutputContains(name)).To(BeTrue())
rm := podmanTest.Podman([]string{"network", rm, name})
rm.WaitWithDefaultTimeout()
- Expect(rm.ExitCode()).To(BeZero())
+ Expect(rm).Should(Exit(0))
results := podmanTest.Podman([]string{"network", "ls", "--quiet"})
results.WaitWithDefaultTimeout()
- Expect(results.ExitCode()).To(Equal(0))
+ Expect(results).Should(Exit(0))
Expect(results.LineInOutputContains(name)).To(BeFalse())
})
}
@@ -216,7 +217,7 @@ var _ = Describe("Podman network", func() {
It("podman network inspect no args", func() {
session := podmanTest.Podman([]string{"network", "inspect"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).ToNot(BeZero())
+ Expect(session).Should(ExitWithError())
})
It("podman network inspect", func() {
@@ -230,7 +231,7 @@ var _ = Describe("Podman network", func() {
}
session := podmanTest.Podman(append([]string{"network", "inspect"}, expectedNetworks...))
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.IsJSONOutputValid()).To(BeTrue())
})
@@ -240,7 +241,7 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "inspect", name, "--format", "{{.cniVersion}}"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.LineInOutputContains("0.3.0")).To(BeTrue())
})
@@ -249,16 +250,16 @@ var _ = Describe("Podman network", func() {
network := podmanTest.Podman([]string{"network", "create", "--subnet", "10.50.50.0/24", netName})
network.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(netName)
- Expect(network.ExitCode()).To(BeZero())
+ Expect(network).Should(Exit(0))
ctrName := "testCtr"
container := podmanTest.Podman([]string{"run", "-dt", "--network", netName, "--name", ctrName, ALPINE, "top"})
container.WaitWithDefaultTimeout()
- Expect(container.ExitCode()).To(BeZero())
+ Expect(container).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", ctrName})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(BeZero())
+ Expect(inspect).Should(Exit(0))
conData := inspect.InspectContainerToJSON()
Expect(len(conData)).To(Equal(1))
Expect(len(conData[0].NetworkSettings.Networks)).To(Equal(1))
@@ -271,7 +272,7 @@ var _ = Describe("Podman network", func() {
// Necessary to ensure the CNI network is removed cleanly
rmAll := podmanTest.Podman([]string{"rm", "-f", ctrName})
rmAll.WaitWithDefaultTimeout()
- Expect(rmAll.ExitCode()).To(BeZero())
+ Expect(rmAll).Should(Exit(0))
})
It("podman inspect container two CNI networks (container not running)", func() {
@@ -279,22 +280,22 @@ var _ = Describe("Podman network", func() {
network1 := podmanTest.Podman([]string{"network", "create", netName1})
network1.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(netName1)
- Expect(network1.ExitCode()).To(BeZero())
+ Expect(network1).Should(Exit(0))
netName2 := "net2-" + stringid.GenerateNonCryptoID()
network2 := podmanTest.Podman([]string{"network", "create", netName2})
network2.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(netName2)
- Expect(network2.ExitCode()).To(BeZero())
+ Expect(network2).Should(Exit(0))
ctrName := "testCtr"
container := podmanTest.Podman([]string{"create", "--network", fmt.Sprintf("%s,%s", netName1, netName2), "--name", ctrName, ALPINE, "top"})
container.WaitWithDefaultTimeout()
- Expect(container.ExitCode()).To(BeZero())
+ Expect(container).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", ctrName})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(BeZero())
+ Expect(inspect).Should(Exit(0))
conData := inspect.InspectContainerToJSON()
Expect(len(conData)).To(Equal(1))
Expect(len(conData[0].NetworkSettings.Networks)).To(Equal(2))
@@ -308,7 +309,7 @@ var _ = Describe("Podman network", func() {
// Necessary to ensure the CNI network is removed cleanly
rmAll := podmanTest.Podman([]string{"rm", "-f", ctrName})
rmAll.WaitWithDefaultTimeout()
- Expect(rmAll.ExitCode()).To(BeZero())
+ Expect(rmAll).Should(Exit(0))
})
It("podman inspect container two CNI networks", func() {
@@ -316,22 +317,22 @@ var _ = Describe("Podman network", func() {
network1 := podmanTest.Podman([]string{"network", "create", "--subnet", "10.50.51.0/25", netName1})
network1.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(netName1)
- Expect(network1.ExitCode()).To(BeZero())
+ Expect(network1).Should(Exit(0))
netName2 := "net2-" + stringid.GenerateNonCryptoID()
network2 := podmanTest.Podman([]string{"network", "create", "--subnet", "10.50.51.128/26", netName2})
network2.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(netName2)
- Expect(network2.ExitCode()).To(BeZero())
+ Expect(network2).Should(Exit(0))
ctrName := "testCtr"
container := podmanTest.Podman([]string{"run", "-dt", "--network", fmt.Sprintf("%s,%s", netName1, netName2), "--name", ctrName, ALPINE, "top"})
container.WaitWithDefaultTimeout()
- Expect(container.ExitCode()).To(BeZero())
+ Expect(container).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", ctrName})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(BeZero())
+ Expect(inspect).Should(Exit(0))
conData := inspect.InspectContainerToJSON()
Expect(len(conData)).To(Equal(1))
Expect(len(conData[0].NetworkSettings.Networks)).To(Equal(2))
@@ -349,7 +350,7 @@ var _ = Describe("Podman network", func() {
// Necessary to ensure the CNI network is removed cleanly
rmAll := podmanTest.Podman([]string{"rm", "-f", ctrName})
rmAll.WaitWithDefaultTimeout()
- Expect(rmAll.ExitCode()).To(BeZero())
+ Expect(rmAll).Should(Exit(0))
})
It("podman network remove after disconnect when container initially created with the network", func() {
@@ -360,25 +361,25 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "create", network})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--name", container, "--network", network, "-d", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"network", "disconnect", network, container})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"network", "rm", network})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman network remove bogus", func() {
session := podmanTest.Podman([]string{"network", "rm", "bogus"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(1))
+ Expect(session).Should(Exit(1))
})
It("podman network remove --force with pod", func() {
@@ -386,34 +387,34 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "create", netName})
session.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(netName)
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pod", "create", "--network", netName})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
podID := session.OutputToString()
session = podmanTest.Podman([]string{"create", "--pod", podID, ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"network", "rm", netName})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(2))
+ Expect(session).Should(Exit(2))
session = podmanTest.Podman([]string{"network", "rm", "--force", netName})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
// check if pod is deleted
session = podmanTest.Podman([]string{"pod", "exists", podID})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(1))
+ Expect(session).Should(Exit(1))
// check if net is deleted
session = podmanTest.Podman([]string{"network", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Not(ContainSubstring(netName)))
})
@@ -422,17 +423,17 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "create", netName1})
session.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(netName1)
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
netName2 := "net2-" + stringid.GenerateNonCryptoID()
session = podmanTest.Podman([]string{"network", "create", netName2})
session.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(netName2)
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"network", "rm", netName1, netName2})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
lines := session.OutputToStringArray()
Expect(lines[0]).To(Equal(netName1))
Expect(lines[1]).To(Equal(netName2))
@@ -444,7 +445,7 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "create", netName})
session.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(netName)
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
interval := time.Duration(250 * time.Millisecond)
for i := 0; i < 6; i++ {
@@ -460,7 +461,7 @@ var _ = Describe("Podman network", func() {
top := podmanTest.Podman([]string{"run", "-dt", "--name=web", "--network=" + netName, "--network-alias=web1", "--network-alias=web2", nginx})
top.WaitWithDefaultTimeout()
- Expect(top.ExitCode()).To(BeZero())
+ Expect(top).Should(Exit(0))
interval = time.Duration(250 * time.Millisecond)
// Wait for the nginx service to be running
for i := 0; i < 6; i++ {
@@ -480,12 +481,12 @@ var _ = Describe("Podman network", func() {
// Test against the first alias
c2 := podmanTest.Podman([]string{"run", "--dns-search", "dns.podman", "--network=" + netName, nginx, "curl", "web1"})
c2.WaitWithDefaultTimeout()
- Expect(c2.ExitCode()).To(BeZero())
+ Expect(c2).Should(Exit(0))
// Test against the second alias
c3 := podmanTest.Podman([]string{"run", "--dns-search", "dns.podman", "--network=" + netName, nginx, "curl", "web2"})
c3.WaitWithDefaultTimeout()
- Expect(c3.ExitCode()).To(BeZero())
+ Expect(c3).Should(Exit(0))
})
It("podman network create/remove macvlan", func() {
@@ -493,11 +494,11 @@ var _ = Describe("Podman network", func() {
nc := podmanTest.Podman([]string{"network", "create", "--macvlan", "lo", net})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(net)
- Expect(nc.ExitCode()).To(Equal(0))
+ Expect(nc).Should(Exit(0))
nc = podmanTest.Podman([]string{"network", "rm", net})
nc.WaitWithDefaultTimeout()
- Expect(nc.ExitCode()).To(Equal(0))
+ Expect(nc).Should(Exit(0))
})
It("podman network create/remove macvlan as driver (-d) no device name", func() {
@@ -505,11 +506,11 @@ var _ = Describe("Podman network", func() {
nc := podmanTest.Podman([]string{"network", "create", "-d", "macvlan", net})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(net)
- Expect(nc.ExitCode()).To(Equal(0))
+ Expect(nc).Should(Exit(0))
inspect := podmanTest.Podman([]string{"network", "inspect", net})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(BeZero())
+ Expect(inspect).Should(Exit(0))
out, err := inspect.jq(".[0].plugins[0].master")
Expect(err).To(BeNil())
@@ -517,7 +518,7 @@ var _ = Describe("Podman network", func() {
nc = podmanTest.Podman([]string{"network", "rm", net})
nc.WaitWithDefaultTimeout()
- Expect(nc.ExitCode()).To(Equal(0))
+ Expect(nc).Should(Exit(0))
})
It("podman network create/remove macvlan as driver (-d) with device name", func() {
@@ -525,11 +526,11 @@ var _ = Describe("Podman network", func() {
nc := podmanTest.Podman([]string{"network", "create", "-d", "macvlan", "-o", "parent=lo", net})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(net)
- Expect(nc.ExitCode()).To(Equal(0))
+ Expect(nc).Should(Exit(0))
inspect := podmanTest.Podman([]string{"network", "inspect", net})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(BeZero())
+ Expect(inspect).Should(Exit(0))
out, err := inspect.jq(".[0].plugins[0].master")
Expect(err).To(BeNil())
@@ -541,7 +542,7 @@ var _ = Describe("Podman network", func() {
nc = podmanTest.Podman([]string{"network", "rm", net})
nc.WaitWithDefaultTimeout()
- Expect(nc.ExitCode()).To(Equal(0))
+ Expect(nc).Should(Exit(0))
})
It("podman network exists", func() {
@@ -549,15 +550,15 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "create", net})
session.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(net)
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"network", "exists", net})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"network", "exists", stringid.GenerateNonCryptoID()})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(1))
+ Expect(session).Should(Exit(1))
})
It("podman network create macvlan with network info and options", func() {
@@ -565,11 +566,11 @@ var _ = Describe("Podman network", func() {
nc := podmanTest.Podman([]string{"network", "create", "-d", "macvlan", "-o", "parent=lo", "-o", "mtu=1500", "--gateway", "192.168.1.254", "--subnet", "192.168.1.0/24", net})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(net)
- Expect(nc.ExitCode()).To(Equal(0))
+ Expect(nc).Should(Exit(0))
inspect := podmanTest.Podman([]string{"network", "inspect", net})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(BeZero())
+ Expect(inspect).Should(Exit(0))
mtu, err := inspect.jq(".[0].plugins[0].mtu")
Expect(err).To(BeNil())
@@ -601,7 +602,7 @@ var _ = Describe("Podman network", func() {
nc = podmanTest.Podman([]string{"network", "rm", net})
nc.WaitWithDefaultTimeout()
- Expect(nc.ExitCode()).To(Equal(0))
+ Expect(nc).Should(Exit(0))
})
It("podman network prune --filter", func() {
@@ -610,11 +611,11 @@ var _ = Describe("Podman network", func() {
nc := podmanTest.Podman([]string{"network", "create", net1})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(net1)
- Expect(nc.ExitCode()).To(Equal(0))
+ Expect(nc).Should(Exit(0))
list := podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}}"})
list.WaitWithDefaultTimeout()
- Expect(list.ExitCode()).To(BeZero())
+ Expect(list).Should(Exit(0))
Expect(StringInSlice(net1, list.OutputToStringArray())).To(BeTrue())
if !isRootless() {
@@ -624,11 +625,11 @@ var _ = Describe("Podman network", func() {
// -f needed only to skip y/n question
prune := podmanTest.Podman([]string{"network", "prune", "-f", "--filter", "until=50"})
prune.WaitWithDefaultTimeout()
- Expect(prune.ExitCode()).To(BeZero())
+ Expect(prune).Should(Exit(0))
listAgain := podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}}"})
listAgain.WaitWithDefaultTimeout()
- Expect(listAgain.ExitCode()).To(BeZero())
+ Expect(listAgain).Should(Exit(0))
Expect(StringInSlice(net1, listAgain.OutputToStringArray())).To(BeTrue())
if !isRootless() {
@@ -638,11 +639,11 @@ var _ = Describe("Podman network", func() {
// -f needed only to skip y/n question
prune = podmanTest.Podman([]string{"network", "prune", "-f", "--filter", "until=5000000000000"})
prune.WaitWithDefaultTimeout()
- Expect(prune.ExitCode()).To(BeZero())
+ Expect(prune).Should(Exit(0))
listAgain = podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}}"})
listAgain.WaitWithDefaultTimeout()
- Expect(listAgain.ExitCode()).To(BeZero())
+ Expect(listAgain).Should(Exit(0))
Expect(StringInSlice(net1, listAgain.OutputToStringArray())).To(BeFalse())
if !isRootless() {
@@ -662,16 +663,16 @@ var _ = Describe("Podman network", func() {
nc := podmanTest.Podman([]string{"network", "create", net1})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(net1)
- Expect(nc.ExitCode()).To(Equal(0))
+ Expect(nc).Should(Exit(0))
nc2 := podmanTest.Podman([]string{"network", "create", net2})
nc2.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(net2)
- Expect(nc2.ExitCode()).To(Equal(0))
+ Expect(nc2).Should(Exit(0))
list := podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}}"})
list.WaitWithDefaultTimeout()
- Expect(list.ExitCode()).To(BeZero())
+ Expect(list).Should(Exit(0))
Expect(StringInSlice(net1, list.OutputToStringArray())).To(BeTrue())
Expect(StringInSlice(net2, list.OutputToStringArray())).To(BeTrue())
@@ -681,15 +682,15 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"run", "-dt", "--net", net2, ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
prune := podmanTest.Podman([]string{"network", "prune", "-f"})
prune.WaitWithDefaultTimeout()
- Expect(prune.ExitCode()).To(BeZero())
+ Expect(prune).Should(Exit(0))
listAgain := podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}}"})
listAgain.WaitWithDefaultTimeout()
- Expect(listAgain.ExitCode()).To(BeZero())
+ Expect(listAgain).Should(Exit(0))
Expect(StringInSlice(net1, listAgain.OutputToStringArray())).To(BeFalse())
Expect(StringInSlice(net2, listAgain.OutputToStringArray())).To(BeTrue())
diff --git a/test/e2e/pause_test.go b/test/e2e/pause_test.go
index 01ad7c071..ea7a96428 100644
--- a/test/e2e/pause_test.go
+++ b/test/e2e/pause_test.go
@@ -10,6 +10,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman pause", func() {
@@ -69,7 +70,7 @@ var _ = Describe("Podman pause", func() {
It("podman pause a created container by id", func() {
session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
result := podmanTest.Podman([]string{"pause", cid})
@@ -83,12 +84,12 @@ var _ = Describe("Podman pause", func() {
It("podman pause a running container by id", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
result := podmanTest.Podman([]string{"pause", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(strings.ToLower(podmanTest.GetContainerStatus())).To(ContainSubstring(pausedState))
@@ -99,13 +100,13 @@ var _ = Describe("Podman pause", func() {
It("podman container pause a running container by id", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
result := podmanTest.Podman([]string{"container", "pause", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(strings.ToLower(podmanTest.GetContainerStatus())).To(ContainSubstring(pausedState))
@@ -116,13 +117,13 @@ var _ = Describe("Podman pause", func() {
It("podman unpause a running container by id", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
result := podmanTest.Podman([]string{"unpause", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(125))
+ Expect(result).Should(Exit(125))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
})
@@ -130,20 +131,20 @@ var _ = Describe("Podman pause", func() {
It("podman remove a paused container by id without force", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
result := podmanTest.Podman([]string{"pause", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(strings.ToLower(podmanTest.GetContainerStatus())).To(ContainSubstring(pausedState))
result = podmanTest.Podman([]string{"rm", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(2))
+ Expect(result).Should(Exit(2))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(strings.ToLower(podmanTest.GetContainerStatus())).To(ContainSubstring(pausedState))
@@ -152,56 +153,56 @@ var _ = Describe("Podman pause", func() {
It("podman remove a paused container by id with force", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
result := podmanTest.Podman([]string{"pause", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(strings.ToLower(podmanTest.GetContainerStatus())).To(ContainSubstring(pausedState))
result = podmanTest.Podman([]string{"rm", "--force", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
It("podman stop a paused container by id", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
result := podmanTest.Podman([]string{"pause", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(strings.ToLower(podmanTest.GetContainerStatus())).To(ContainSubstring(pausedState))
result = podmanTest.Podman([]string{"stop", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(125))
+ Expect(result).Should(Exit(125))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(strings.ToLower(podmanTest.GetContainerStatus())).To(ContainSubstring(pausedState))
result = podmanTest.Podman([]string{"unpause", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
result = podmanTest.Podman([]string{"rm", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(2))
+ Expect(result).Should(Exit(2))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
result = podmanTest.Podman([]string{"rm", "-f", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
@@ -209,12 +210,12 @@ var _ = Describe("Podman pause", func() {
It("podman pause a running container by name", func() {
session := podmanTest.RunTopContainer("test1")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"pause", "test1"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(strings.ToLower(podmanTest.GetContainerStatus())).To(Equal(pausedState))
@@ -225,23 +226,23 @@ var _ = Describe("Podman pause", func() {
It("podman pause a running container by id and another by name", func() {
session1 := podmanTest.RunTopContainer("test1")
session1.WaitWithDefaultTimeout()
- Expect(session1.ExitCode()).To(Equal(0))
+ Expect(session1).Should(Exit(0))
session2 := podmanTest.RunTopContainer("")
session2.WaitWithDefaultTimeout()
- Expect(session2.ExitCode()).To(Equal(0))
+ Expect(session2).Should(Exit(0))
cid2 := session2.OutputToString()
result := podmanTest.Podman([]string{"pause", cid2})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
result = podmanTest.Podman([]string{"pause", "test1"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
result = podmanTest.Podman([]string{"unpause", "test1"})
@@ -253,7 +254,7 @@ var _ = Describe("Podman pause", func() {
It("Pause all containers (no containers exist)", func() {
result := podmanTest.Podman([]string{"pause", "--all"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
@@ -261,7 +262,7 @@ var _ = Describe("Podman pause", func() {
It("Unpause all containers (no paused containers exist)", func() {
result := podmanTest.Podman([]string{"unpause", "--all"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
@@ -270,26 +271,26 @@ var _ = Describe("Podman pause", func() {
name := fmt.Sprintf("test%d", i)
run := podmanTest.Podman([]string{"run", "-dt", "--name", name, nginx})
run.WaitWithDefaultTimeout()
- Expect(run.ExitCode()).To(Equal(0))
+ Expect(run).Should(Exit(0))
}
running := podmanTest.Podman([]string{"ps", "-q"})
running.WaitWithDefaultTimeout()
- Expect(running.ExitCode()).To(Equal(0))
+ Expect(running).Should(Exit(0))
Expect(len(running.OutputToStringArray())).To(Equal(3))
pause := podmanTest.Podman([]string{"pause", "--all"})
pause.WaitWithDefaultTimeout()
- Expect(pause.ExitCode()).To(Equal(0))
+ Expect(pause).Should(Exit(0))
running = podmanTest.Podman([]string{"ps", "-q"})
running.WaitWithDefaultTimeout()
- Expect(running.ExitCode()).To(Equal(0))
+ Expect(running).Should(Exit(0))
Expect(len(running.OutputToStringArray())).To(Equal(0))
unpause := podmanTest.Podman([]string{"unpause", "--all"})
unpause.WaitWithDefaultTimeout()
- Expect(unpause.ExitCode()).To(Equal(0))
+ Expect(unpause).Should(Exit(0))
})
It("Unpause a bunch of running containers", func() {
@@ -297,20 +298,20 @@ var _ = Describe("Podman pause", func() {
name := fmt.Sprintf("test%d", i)
run := podmanTest.Podman([]string{"run", "-dt", "--name", name, nginx})
run.WaitWithDefaultTimeout()
- Expect(run.ExitCode()).To(Equal(0))
+ Expect(run).Should(Exit(0))
}
pause := podmanTest.Podman([]string{"pause", "--all"})
pause.WaitWithDefaultTimeout()
- Expect(pause.ExitCode()).To(Equal(0))
+ Expect(pause).Should(Exit(0))
unpause := podmanTest.Podman([]string{"unpause", "--all"})
unpause.WaitWithDefaultTimeout()
- Expect(unpause.ExitCode()).To(Equal(0))
+ Expect(unpause).Should(Exit(0))
running := podmanTest.Podman([]string{"ps", "-q"})
running.WaitWithDefaultTimeout()
- Expect(running.ExitCode()).To(Equal(0))
+ Expect(running).Should(Exit(0))
Expect(len(running.OutputToStringArray())).To(Equal(3))
})
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go
index 833991452..42bb0cb64 100644
--- a/test/e2e/play_kube_test.go
+++ b/test/e2e/play_kube_test.go
@@ -15,6 +15,7 @@ import (
"github.com/containers/storage/pkg/stringid"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
"github.com/opencontainers/selinux/go-selinux"
)
@@ -515,7 +516,7 @@ func createSecret(podmanTest *PodmanTestIntegration, name string, value []byte)
secret := podmanTest.Podman([]string{"secret", "create", name, secretFilePath})
secret.WaitWithDefaultTimeout()
- Expect(secret.ExitCode()).To(Equal(0))
+ Expect(secret).Should(Exit(0))
}
// ConfigMap describes the options a kube yaml can be configured at configmap level
@@ -1020,7 +1021,7 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Not(Equal(0)))
+ Expect(kube).To(ExitWithError())
})
@@ -1033,7 +1034,7 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", "label-pod-test", "--format", "'{{ .ProcessLabel }}'"})
inspect.WaitWithDefaultTimeout()
@@ -1049,7 +1050,7 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", "testpod1", "--format", "'{{ .SharedNamespaces }}'"})
inspect.WaitWithDefaultTimeout()
@@ -1066,7 +1067,7 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", "--authfile", "/tmp/nonexistent", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Not(Equal(0)))
+ Expect(kube).To(ExitWithError())
})
@@ -1077,16 +1078,16 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Cmd }}'"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
cmd := inspect.OutputToString()
inspect = podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Entrypoint }}'"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
ep := inspect.OutputToString()
// Use the defined command to override the image's command
@@ -1102,18 +1103,18 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
// this image's ENTRYPOINT is `/entrypoint.sh`
inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Entrypoint }}'"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring(`/entrypoint.sh`))
// and its COMMAND is `/etc/docker/registry/config.yml`
inspect = podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Cmd }}'"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring(`[/etc/docker/registry/config.yml]`))
})
@@ -1126,18 +1127,18 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
// Use the defined command to override the image's command, and don't set the args
// so the full command in result should not contains the image's command
inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Entrypoint }}'"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring(`echo hello`))
inspect = podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Cmd }}'"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
// an empty command is reported as '[]'
Expect(inspect.OutputToString()).To(ContainSubstring(`[]`))
})
@@ -1150,17 +1151,17 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
// this image's ENTRYPOINT is `/entrypoint.sh`
inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Entrypoint }}'"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring(`/entrypoint.sh`))
inspect = podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Cmd }}'"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring(`[echo hello]`))
})
@@ -1174,16 +1175,16 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Entrypoint }}'"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring(`echo`))
inspect = podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Cmd }}'"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring(`[hello]`))
})
@@ -1195,11 +1196,11 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
logs := podmanTest.Podman([]string{"logs", getCtrNameInPod(p)})
logs.WaitWithDefaultTimeout()
- Expect(logs.ExitCode()).To(Equal(0))
+ Expect(logs).Should(Exit(0))
Expect(logs.OutputToString()).To(ContainSubstring("hello world"))
})
@@ -1218,11 +1219,11 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "{{.HostConfig.RestartPolicy.Name}}"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(Equal(v[2]))
}
})
@@ -1240,11 +1241,11 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml, "--configmap", cmYamlPathname})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Env }}'"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring(`FOO=foo`))
})
@@ -1261,7 +1262,7 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml, "--configmap", cmYamlPathname})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Not(Equal(0)))
+ Expect(kube).To(ExitWithError())
})
It("podman play kube test required env value from missing configmap", func() {
@@ -1271,7 +1272,7 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Not(Equal(0)))
+ Expect(kube).To(ExitWithError())
})
It("podman play kube test optional env value from configmap with missing key", func() {
@@ -1287,11 +1288,11 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml, "--configmap", cmYamlPathname})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ range .Config.Env }}[{{ . }}]{{end}}'"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring(`[FOO=]`))
})
@@ -1302,11 +1303,11 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ range .Config.Env }}[{{ . }}]{{end}}'"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring(`[FOO=]`))
})
@@ -1323,11 +1324,11 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml, "--configmap", cmYamlPathname})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Env }}'"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring(`FOO1=foo1`))
Expect(inspect.OutputToString()).To(ContainSubstring(`FOO2=foo2`))
})
@@ -1339,7 +1340,7 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Not(Equal(0)))
+ Expect(kube).To(ExitWithError())
})
It("podman play kube test get all key-value pairs from optional configmap as envs", func() {
@@ -1349,7 +1350,7 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
})
It("podman play kube test env value from secret", func() {
@@ -1360,11 +1361,11 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Env }}'"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring(`FOO=foo`))
})
@@ -1375,7 +1376,7 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Not(Equal(0)))
+ Expect(kube).To(ExitWithError())
})
It("podman play kube test required env value from secret with missing key", func() {
@@ -1386,7 +1387,7 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Not(Equal(0)))
+ Expect(kube).To(ExitWithError())
})
It("podman play kube test optional env value from missing secret", func() {
@@ -1396,11 +1397,11 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ range .Config.Env }}[{{ . }}]{{end}}'"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring(`[FOO=]`))
})
@@ -1412,11 +1413,11 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ range .Config.Env }}[{{ . }}]{{end}}'"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring(`[FOO=]`))
})
@@ -1428,11 +1429,11 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Env }}'"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring(`FOO=foo`))
Expect(inspect.OutputToString()).To(ContainSubstring(`BAR=bar`))
})
@@ -1444,7 +1445,7 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Not(Equal(0)))
+ Expect(kube).To(ExitWithError())
})
It("podman play kube test get all key-value pairs from optional secret as envs", func() {
@@ -1454,7 +1455,7 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
})
It("podman play kube test hostname", func() {
@@ -1464,11 +1465,11 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "{{ .Config.Hostname }}"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(Equal(defaultPodName))
})
@@ -1480,11 +1481,11 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "{{ .Config.Hostname }}"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(Equal(hostname))
})
@@ -1503,11 +1504,11 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", pod.Name, "--format", "{{ .InfraConfig.HostAdd}}"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).
To(Equal("[test1.podman.io:192.168.1.2 test2.podman.io:192.168.1.2 test3.podman.io:192.168.1.3 test4.podman.io:192.168.1.3]"))
})
@@ -1522,11 +1523,11 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod)})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring(capAdd))
})
@@ -1540,11 +1541,11 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod)})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring(capDrop))
})
@@ -1556,11 +1557,11 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod)})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
})
It("podman play kube seccomp container level", func() {
@@ -1582,11 +1583,11 @@ var _ = Describe("Podman play kube", func() {
// CreateSeccompJson will put the profile into podmanTest.TempDir. Use --seccomp-profile-root to tell play kube where to look
kube := podmanTest.Podman([]string{"play", "kube", "--seccomp-profile-root", podmanTest.TempDir, kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
logs := podmanTest.Podman([]string{"logs", getCtrNameInPod(pod)})
logs.WaitWithDefaultTimeout()
- Expect(logs.ExitCode()).To(Equal(0))
+ Expect(logs).Should(Exit(0))
Expect(logs.ErrorToString()).To(ContainSubstring("Operation not permitted"))
})
@@ -1609,11 +1610,11 @@ var _ = Describe("Podman play kube", func() {
// CreateSeccompJson will put the profile into podmanTest.TempDir. Use --seccomp-profile-root to tell play kube where to look
kube := podmanTest.Podman([]string{"play", "kube", "--seccomp-profile-root", podmanTest.TempDir, kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
logs := podmanTest.Podman([]string{"logs", getCtrNameInPod(pod)})
logs.WaitWithDefaultTimeout()
- Expect(logs.ExitCode()).To(Equal(0))
+ Expect(logs).Should(Exit(0))
Expect(logs.ErrorToString()).To(ContainSubstring("Operation not permitted"))
})
@@ -1624,7 +1625,7 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(125))
+ Expect(kube).Should(Exit(125))
})
It("podman play kube with pull policy of missing", func() {
@@ -1634,7 +1635,7 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
})
It("podman play kube with pull always", func() {
@@ -1644,11 +1645,11 @@ var _ = Describe("Podman play kube", func() {
tag := podmanTest.Podman([]string{"tag", oldBB, BB})
tag.WaitWithDefaultTimeout()
- Expect(tag.ExitCode()).To(BeZero())
+ Expect(tag).Should(Exit(0))
rmi := podmanTest.Podman([]string{"rmi", oldBB})
rmi.WaitWithDefaultTimeout()
- Expect(rmi.ExitCode()).To(BeZero())
+ Expect(rmi).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", BB})
inspect.WaitWithDefaultTimeout()
@@ -1660,7 +1661,7 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
inspect = podmanTest.Podman([]string{"inspect", BB})
inspect.WaitWithDefaultTimeout()
@@ -1675,11 +1676,11 @@ var _ = Describe("Podman play kube", func() {
tag := podmanTest.Podman([]string{"tag", oldBB, BB})
tag.WaitWithDefaultTimeout()
- Expect(tag.ExitCode()).To(BeZero())
+ Expect(tag).Should(Exit(0))
rmi := podmanTest.Podman([]string{"rmi", oldBB})
rmi.WaitWithDefaultTimeout()
- Expect(rmi.ExitCode()).To(BeZero())
+ Expect(rmi).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", BB})
inspect.WaitWithDefaultTimeout()
@@ -1691,7 +1692,7 @@ var _ = Describe("Podman play kube", func() {
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
inspect = podmanTest.Podman([]string{"inspect", BB})
inspect.WaitWithDefaultTimeout()
@@ -1713,11 +1714,11 @@ spec:
pull := podmanTest.Podman([]string{"create", "--workdir", "/etc", "--name", "newBB", "--label", "key1=value1", "alpine"})
pull.WaitWithDefaultTimeout()
- Expect(pull.ExitCode()).To(BeZero())
+ Expect(pull).Should(Exit(0))
c := podmanTest.Podman([]string{"commit", "-c", "STOPSIGNAL=51", "newBB", "demo"})
c.WaitWithDefaultTimeout()
- Expect(c.ExitCode()).To(Equal(0))
+ Expect(c).Should(Exit(0))
conffile := filepath.Join(podmanTest.TempDir, "kube.yaml")
tempdir, err = CreateTempDirInTempDir()
@@ -1728,11 +1729,11 @@ spec:
kube := podmanTest.Podman([]string{"play", "kube", conffile})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", "demo_pod-demo_kube"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
ctr := inspect.InspectContainerToJSON()
Expect(ctr[0].Config.WorkingDir).To(ContainSubstring("/etc"))
@@ -1749,12 +1750,12 @@ spec:
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
podNames := getPodNamesInDeployment(deployment)
inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(&podNames[0]), "--format", "'{{ .Config.Entrypoint }}'"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
// yaml's command should override the image's Entrypoint
Expect(inspect.OutputToString()).To(ContainSubstring(strings.Join(defaultCtrCmd, " ")))
})
@@ -1768,13 +1769,13 @@ spec:
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
podNames := getPodNamesInDeployment(deployment)
for i = 0; i < numReplicas; i++ {
inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(&podNames[i]), "--format", "'{{ .Config.Entrypoint }}'"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring(strings.Join(defaultCtrCmd, " ")))
}
})
@@ -1790,7 +1791,7 @@ spec:
session := podmanTest.Podman([]string{"network", "create", "--subnet", "10.25.31.0/24", net})
session.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(net)
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
ips := []string{"10.25.31.5", "10.25.31.10", "10.25.31.15"}
playArgs := []string{"play", "kube", "--network", net}
@@ -1804,20 +1805,20 @@ spec:
kube := podmanTest.Podman(append(playArgs, kubeYaml))
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
podNames := getPodNamesInDeployment(deployment)
for i = 0; i < numReplicas; i++ {
inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(&podNames[i]), "--format", "{{ .NetworkSettings.Networks." + net + ".IPAddress }}"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(Equal(ips[i]))
}
for i = 0; i < numReplicas; i++ {
inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(&podNames[i]), "--format", "{{ .NetworkSettings.Networks." + net + ".MacAddress }}"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(Equal(macs[i]))
}
})
@@ -1833,11 +1834,11 @@ spec:
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
inspect := podmanTest.Podman([]string{"port", getCtrNameInPod(pod)})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(Equal("5000/tcp -> 127.0.0.100:5000"))
})
@@ -1850,7 +1851,7 @@ spec:
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).NotTo(Equal(0))
+ Expect(kube).To(ExitWithError())
Expect(kube.ErrorToString()).To(ContainSubstring(defaultVolName))
})
@@ -1866,7 +1867,7 @@ spec:
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
})
It("podman play kube test with nonexistent File HostPath type volume", func() {
@@ -1878,7 +1879,7 @@ spec:
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).NotTo(Equal(0))
+ Expect(kube).To(ExitWithError())
})
It("podman play kube test with File HostPath type volume", func() {
@@ -1893,7 +1894,7 @@ spec:
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
})
It("podman play kube test with FileOrCreate HostPath type volume", func() {
@@ -1905,7 +1906,7 @@ spec:
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
// the file should have been created
_, err = os.Stat(hostPathLocation)
@@ -1921,7 +1922,7 @@ spec:
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
// the file should have been created
st, err := os.Stat(hostPathLocation)
@@ -1941,7 +1942,7 @@ spec:
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).NotTo(Equal(0))
+ Expect(kube).To(ExitWithError())
})
It("podman play kube test with read only HostPath volume", func() {
@@ -1957,11 +1958,11 @@ spec:
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{.HostConfig.Binds}}'"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
correct := fmt.Sprintf("%s:%s:%s", hostPathLocation, hostPathLocation, "ro")
Expect(inspect.OutputToString()).To(ContainSubstring(correct))
@@ -1997,15 +1998,15 @@ VOLUME %s`, ALPINE, hostPathDir+"/")
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
result := podmanTest.Podman([]string{"exec", getCtrNameInPod(pod), "ls", hostPathDir + "/" + testfile})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod)})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
// If two volumes are specified and share the same destination,
// only one will be mounted. Host path volumes take precedence.
@@ -2025,11 +2026,11 @@ VOLUME %s`, ALPINE, hostPathDir+"/")
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "{{ (index .Mounts 0).Type }}:{{ (index .Mounts 0).Name }}"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
correct := fmt.Sprintf("volume:%s", volumeName)
Expect(inspect.OutputToString()).To(Equal(correct))
@@ -2048,13 +2049,13 @@ VOLUME %s`, ALPINE, hostPathDir+"/")
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
correctLabels := expectedLabelKey + ":" + expectedLabelValue
for _, pod := range getPodNamesInDeployment(deployment) {
inspect := podmanTest.Podman([]string{"pod", "inspect", pod.Name, "--format", "'{{ .Labels }}'"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring(correctLabels))
}
})
@@ -2087,7 +2088,7 @@ VOLUME %s`, ALPINE, hostPathDir+"/")
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
for _, pod := range getPodNamesInDeployment(deployment) {
inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(&pod), "--format", `
@@ -2096,7 +2097,7 @@ CpuQuota: {{ .HostConfig.CpuQuota }}
Memory: {{ .HostConfig.Memory }}
MemoryReservation: {{ .HostConfig.MemoryReservation }}`})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring(fmt.Sprintf("%s: %d", "CpuQuota", expectedCpuQuota)))
Expect(inspect.OutputToString()).To(ContainSubstring("MemoryReservation: " + expectedMemoryRequest))
Expect(inspect.OutputToString()).To(ContainSubstring("Memory: " + expectedMemoryLimit))
@@ -2118,7 +2119,7 @@ MemoryReservation: {{ .HostConfig.MemoryReservation }}`})
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(125))
+ Expect(kube).Should(Exit(125))
Expect(kube.ErrorToString()).To(ContainSubstring("invalid reference format"))
})
@@ -2129,11 +2130,11 @@ MemoryReservation: {{ .HostConfig.MemoryReservation }}`})
kube := podmanTest.Podman([]string{"play", "kube", "--log-driver", "journald", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .HostConfig.LogConfig.Type }}'"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring("journald"))
})
@@ -2144,11 +2145,11 @@ MemoryReservation: {{ .HostConfig.MemoryReservation }}`})
kube := podmanTest.Podman([]string{"play", "kube", "--start=false", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "{{ .State.Running }}"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(Equal("false"))
})
@@ -2163,11 +2164,11 @@ MemoryReservation: {{ .HostConfig.MemoryReservation }}`})
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", pod.Name, "--format", "{{ .InfraConfig.HostNetwork }}"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(Equal("true"))
})
@@ -2186,7 +2187,7 @@ MemoryReservation: {{ .HostConfig.MemoryReservation }}`})
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", volName, "--format", `
Name: {{ .Name }}
@@ -2194,7 +2195,7 @@ Device: {{ .Options.device }}
Type: {{ .Options.type }}
o: {{ .Options.o }}`})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring("Name: " + volName))
Expect(inspect.OutputToString()).To(ContainSubstring("Device: " + volDevice))
Expect(inspect.OutputToString()).To(ContainSubstring("Type: " + volType))
@@ -2250,21 +2251,21 @@ spec:
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
inspectVolume := podmanTest.Podman([]string{"inspect", volName, "--format", "'{{ .Name }}'"})
inspectVolume.WaitWithDefaultTimeout()
- Expect(inspectVolume.ExitCode()).To(Equal(0))
+ Expect(inspectVolume).Should(Exit(0))
Expect(inspectVolume.OutputToString()).To(ContainSubstring(volName))
inspectPod := podmanTest.Podman([]string{"inspect", podName + "-pod-0", "--format", "'{{ .State }}'"})
inspectPod.WaitWithDefaultTimeout()
- Expect(inspectPod.ExitCode()).To(Equal(0))
+ Expect(inspectPod).Should(Exit(0))
Expect(inspectPod.OutputToString()).To(ContainSubstring(`Running`))
inspectMounts := podmanTest.Podman([]string{"inspect", podName + "-pod-0-" + ctrName, "--format", "{{ (index .Mounts 0).Type }}:{{ (index .Mounts 0).Name }}"})
inspectMounts.WaitWithDefaultTimeout()
- Expect(inspectMounts.ExitCode()).To(Equal(0))
+ Expect(inspectMounts).Should(Exit(0))
correct := fmt.Sprintf("volume:%s", volName)
Expect(inspectMounts.OutputToString()).To(Equal(correct))
@@ -2322,12 +2323,12 @@ spec:
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
for _, n := range podNames {
inspect := podmanTest.Podman([]string{"inspect", n, "--format", "'{{ .State }}'"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring(`Running`))
}
})
@@ -2364,7 +2365,7 @@ invalid kube kind
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Not(Equal(0)))
+ Expect(kube).To(ExitWithError())
})
It("podman play kube with auto update annotations for all containers", func() {
@@ -2391,12 +2392,12 @@ invalid kube kind
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
for _, ctr := range []string{podName + "-" + ctr01Name, podName + "-" + ctr02Name} {
inspect := podmanTest.Podman([]string{"inspect", ctr, "--format", "'{{.Config.Labels}}'"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring(autoUpdateRegistry + ":" + autoUpdateRegistryValue))
Expect(inspect.OutputToString()).To(ContainSubstring(autoUpdateAuthfile + ":" + autoUpdateAuthfileValue))
@@ -2427,18 +2428,18 @@ invalid kube kind
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
- Expect(kube.ExitCode()).To(Equal(0))
+ Expect(kube).Should(Exit(0))
podName := getPodNamesInDeployment(deployment)[0].Name
inspect := podmanTest.Podman([]string{"inspect", podName + "-" + ctr01Name, "--format", "'{{.Config.Labels}}'"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring(autoUpdateRegistry + ":" + autoUpdateRegistryValue))
inspect = podmanTest.Podman([]string{"inspect", podName + "-" + ctr02Name, "--format", "'{{.Config.Labels}}'"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring(`map[]`))
})
})
diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go
index 3d0a87201..63f55fb88 100644
--- a/test/e2e/pod_create_test.go
+++ b/test/e2e/pod_create_test.go
@@ -14,6 +14,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman pod create", func() {
@@ -79,7 +80,7 @@ var _ = Describe("Podman pod create", func() {
name := "test"
session := podmanTest.Podman([]string{"create", "--name", name, ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
_, ec, _ := podmanTest.CreatePod(map[string][]string{"--name": {name}})
Expect(ec).To(Not(Equal(0)))
@@ -93,52 +94,52 @@ var _ = Describe("Podman pod create", func() {
name := "test"
session := podmanTest.Podman([]string{"pod", "create", "--name", name})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
pod := session.OutputToString()
webserver := podmanTest.Podman([]string{"run", "--pod", pod, "-dt", nginx})
webserver.WaitWithDefaultTimeout()
- Expect(webserver.ExitCode()).To(Equal(0))
+ Expect(webserver).Should(Exit(0))
check := SystemExec("nc", []string{"-z", "localhost", "80"})
- Expect(check.ExitCode()).To(Equal(1))
+ Expect(check).Should(Exit(1))
})
It("podman create pod with network portbindings", func() {
name := "test"
session := podmanTest.Podman([]string{"pod", "create", "--name", name, "-p", "8080:80"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
pod := session.OutputToString()
webserver := podmanTest.Podman([]string{"run", "--pod", pod, "-dt", nginx})
webserver.WaitWithDefaultTimeout()
- Expect(webserver.ExitCode()).To(Equal(0))
+ Expect(webserver).Should(Exit(0))
check := SystemExec("nc", []string{"-z", "localhost", "8080"})
- Expect(check.ExitCode()).To(Equal(0))
+ Expect(check).Should(Exit(0))
})
It("podman create pod with no infra but portbindings should fail", func() {
name := "test"
session := podmanTest.Podman([]string{"pod", "create", "--infra=false", "--name", name, "-p", "80:80"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
It("podman create pod with --no-hosts", func() {
name := "test"
podCreate := podmanTest.Podman([]string{"pod", "create", "--no-hosts", "--name", name})
podCreate.WaitWithDefaultTimeout()
- Expect(podCreate.ExitCode()).To(Equal(0))
+ Expect(podCreate).Should(Exit(0))
alpineResolvConf := podmanTest.Podman([]string{"run", "-ti", "--rm", "--no-hosts", ALPINE, "cat", "/etc/hosts"})
alpineResolvConf.WaitWithDefaultTimeout()
- Expect(alpineResolvConf.ExitCode()).To(Equal(0))
+ Expect(alpineResolvConf).Should(Exit(0))
podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "-ti", "--rm", ALPINE, "cat", "/etc/hosts"})
podResolvConf.WaitWithDefaultTimeout()
- Expect(podResolvConf.ExitCode()).To(Equal(0))
+ Expect(podResolvConf).Should(Exit(0))
Expect(podResolvConf.OutputToString()).To(Equal(alpineResolvConf.OutputToString()))
})
@@ -146,18 +147,18 @@ var _ = Describe("Podman pod create", func() {
name := "test"
podCreate := podmanTest.Podman([]string{"pod", "create", "--no-hosts", "--name", name, "--infra=false"})
podCreate.WaitWithDefaultTimeout()
- Expect(podCreate.ExitCode()).To(Equal(125))
+ Expect(podCreate).Should(Exit(125))
})
It("podman create pod with --add-host", func() {
name := "test"
podCreate := podmanTest.Podman([]string{"pod", "create", "--add-host", "test.example.com:12.34.56.78", "--name", name})
podCreate.WaitWithDefaultTimeout()
- Expect(podCreate.ExitCode()).To(Equal(0))
+ Expect(podCreate).Should(Exit(0))
podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "-ti", "--rm", ALPINE, "cat", "/etc/hosts"})
podResolvConf.WaitWithDefaultTimeout()
- Expect(podResolvConf.ExitCode()).To(Equal(0))
+ Expect(podResolvConf).Should(Exit(0))
Expect(strings.Contains(podResolvConf.OutputToString(), "12.34.56.78 test.example.com")).To(BeTrue())
})
@@ -165,7 +166,7 @@ var _ = Describe("Podman pod create", func() {
name := "test"
podCreate := podmanTest.Podman([]string{"pod", "create", "--add-host", "test.example.com:12.34.56.78", "--name", name, "--infra=false"})
podCreate.WaitWithDefaultTimeout()
- Expect(podCreate.ExitCode()).To(Equal(125))
+ Expect(podCreate).Should(Exit(125))
})
It("podman create pod with DNS server set", func() {
@@ -173,11 +174,11 @@ var _ = Describe("Podman pod create", func() {
server := "12.34.56.78"
podCreate := podmanTest.Podman([]string{"pod", "create", "--dns", server, "--name", name})
podCreate.WaitWithDefaultTimeout()
- Expect(podCreate.ExitCode()).To(Equal(0))
+ Expect(podCreate).Should(Exit(0))
podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "-ti", "--rm", ALPINE, "cat", "/etc/resolv.conf"})
podResolvConf.WaitWithDefaultTimeout()
- Expect(podResolvConf.ExitCode()).To(Equal(0))
+ Expect(podResolvConf).Should(Exit(0))
Expect(strings.Contains(podResolvConf.OutputToString(), fmt.Sprintf("nameserver %s", server))).To(BeTrue())
})
@@ -186,7 +187,7 @@ var _ = Describe("Podman pod create", func() {
server := "12.34.56.78"
podCreate := podmanTest.Podman([]string{"pod", "create", "--dns", server, "--name", name, "--infra=false"})
podCreate.WaitWithDefaultTimeout()
- Expect(podCreate.ExitCode()).To(Equal(125))
+ Expect(podCreate).Should(Exit(125))
})
It("podman create pod with DNS option set", func() {
@@ -194,11 +195,11 @@ var _ = Describe("Podman pod create", func() {
option := "attempts:5"
podCreate := podmanTest.Podman([]string{"pod", "create", "--dns-opt", option, "--name", name})
podCreate.WaitWithDefaultTimeout()
- Expect(podCreate.ExitCode()).To(Equal(0))
+ Expect(podCreate).Should(Exit(0))
podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "-ti", "--rm", ALPINE, "cat", "/etc/resolv.conf"})
podResolvConf.WaitWithDefaultTimeout()
- Expect(podResolvConf.ExitCode()).To(Equal(0))
+ Expect(podResolvConf).Should(Exit(0))
Expect(strings.Contains(podResolvConf.OutputToString(), fmt.Sprintf("options %s", option))).To(BeTrue())
})
@@ -207,7 +208,7 @@ var _ = Describe("Podman pod create", func() {
option := "attempts:5"
podCreate := podmanTest.Podman([]string{"pod", "create", "--dns-opt", option, "--name", name, "--infra=false"})
podCreate.WaitWithDefaultTimeout()
- Expect(podCreate.ExitCode()).To(Equal(125))
+ Expect(podCreate).Should(Exit(125))
})
It("podman create pod with DNS search domain set", func() {
@@ -215,11 +216,11 @@ var _ = Describe("Podman pod create", func() {
search := "example.com"
podCreate := podmanTest.Podman([]string{"pod", "create", "--dns-search", search, "--name", name})
podCreate.WaitWithDefaultTimeout()
- Expect(podCreate.ExitCode()).To(Equal(0))
+ Expect(podCreate).Should(Exit(0))
podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "-ti", "--rm", ALPINE, "cat", "/etc/resolv.conf"})
podResolvConf.WaitWithDefaultTimeout()
- Expect(podResolvConf.ExitCode()).To(Equal(0))
+ Expect(podResolvConf).Should(Exit(0))
Expect(strings.Contains(podResolvConf.OutputToString(), fmt.Sprintf("search %s", search))).To(BeTrue())
})
@@ -228,7 +229,7 @@ var _ = Describe("Podman pod create", func() {
search := "example.com"
podCreate := podmanTest.Podman([]string{"pod", "create", "--dns-search", search, "--name", name, "--infra=false"})
podCreate.WaitWithDefaultTimeout()
- Expect(podCreate.ExitCode()).To(Equal(125))
+ Expect(podCreate).Should(Exit(125))
})
It("podman create pod with IP address", func() {
@@ -238,12 +239,12 @@ var _ = Describe("Podman pod create", func() {
podCreate.WaitWithDefaultTimeout()
// Rootless should error without network
if rootless.IsRootless() {
- Expect(podCreate.ExitCode()).To(Equal(125))
+ Expect(podCreate).Should(Exit(125))
} else {
- Expect(podCreate.ExitCode()).To(Equal(0))
+ Expect(podCreate).Should(Exit(0))
podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "-ti", "--rm", ALPINE, "ip", "addr"})
podResolvConf.WaitWithDefaultTimeout()
- Expect(podResolvConf.ExitCode()).To(Equal(0))
+ Expect(podResolvConf).Should(Exit(0))
Expect(strings.Contains(podResolvConf.OutputToString(), ip)).To(BeTrue())
}
})
@@ -255,13 +256,13 @@ var _ = Describe("Podman pod create", func() {
ip := GetRandomIPAddress()
podCreate := podmanTest.Podman([]string{"pod", "create", "--ip", ip, "--name", podName})
podCreate.WaitWithDefaultTimeout()
- Expect(podCreate.ExitCode()).To(Equal(0))
+ Expect(podCreate).Should(Exit(0))
podCtr := podmanTest.Podman([]string{"run", "--name", ctrName, "--pod", podName, "-d", "-t", ALPINE, "top"})
podCtr.WaitWithDefaultTimeout()
- Expect(podCtr.ExitCode()).To(Equal(0))
+ Expect(podCtr).Should(Exit(0))
ctrInspect := podmanTest.Podman([]string{"inspect", ctrName})
ctrInspect.WaitWithDefaultTimeout()
- Expect(ctrInspect.ExitCode()).To(Equal(0))
+ Expect(ctrInspect).Should(Exit(0))
ctrJSON := ctrInspect.InspectContainerToJSON()
Expect(ctrJSON[0].NetworkSettings.IPAddress).To(Equal(ip))
})
@@ -271,7 +272,7 @@ var _ = Describe("Podman pod create", func() {
ip := GetRandomIPAddress()
podCreate := podmanTest.Podman([]string{"pod", "create", "--ip", ip, "--name", name, "--infra=false"})
podCreate.WaitWithDefaultTimeout()
- Expect(podCreate.ExitCode()).To(Equal(125))
+ Expect(podCreate).Should(Exit(125))
})
It("podman create pod with MAC address", func() {
@@ -281,12 +282,12 @@ var _ = Describe("Podman pod create", func() {
podCreate.WaitWithDefaultTimeout()
// Rootless should error
if rootless.IsRootless() {
- Expect(podCreate.ExitCode()).To(Equal(125))
+ Expect(podCreate).Should(Exit(125))
} else {
- Expect(podCreate.ExitCode()).To(Equal(0))
+ Expect(podCreate).Should(Exit(0))
podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "-ti", "--rm", ALPINE, "ip", "addr"})
podResolvConf.WaitWithDefaultTimeout()
- Expect(podResolvConf.ExitCode()).To(Equal(0))
+ Expect(podResolvConf).Should(Exit(0))
Expect(strings.Contains(podResolvConf.OutputToString(), mac)).To(BeTrue())
}
})
@@ -296,7 +297,7 @@ var _ = Describe("Podman pod create", func() {
mac := "92:d0:c6:0a:29:35"
podCreate := podmanTest.Podman([]string{"pod", "create", "--mac-address", mac, "--name", name, "--infra=false"})
podCreate.WaitWithDefaultTimeout()
- Expect(podCreate.ExitCode()).To(Equal(125))
+ Expect(podCreate).Should(Exit(125))
})
It("podman create pod and print id to external file", func() {
@@ -314,7 +315,7 @@ var _ = Describe("Podman pod create", func() {
session := podmanTest.Podman([]string{"pod", "create", "--name=abc", "--pod-id-file", targetFile})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
id, _ := ioutil.ReadFile(targetFile)
check := podmanTest.Podman([]string{"pod", "inspect", "abc"})
@@ -327,14 +328,14 @@ var _ = Describe("Podman pod create", func() {
// Make sure we error out with --name.
session := podmanTest.Podman([]string{"pod", "create", "--replace", ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
// Create and replace 5 times in a row the "same" pod.
podName := "testCtr"
for i := 0; i < 5; i++ {
session = podmanTest.Podman([]string{"pod", "create", "--replace", "--name", podName})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
}
})
@@ -342,22 +343,22 @@ var _ = Describe("Podman pod create", func() {
name := "test"
session := podmanTest.Podman([]string{"pod", "create", "--name", name})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
check := podmanTest.Podman([]string{"pod", "inspect", name})
check.WaitWithDefaultTimeout()
- Expect(check.ExitCode()).To(Equal(0))
+ Expect(check).Should(Exit(0))
data := check.InspectPodToJSON()
check1 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Config.Entrypoint}}", data.Containers[0].ID})
check1.WaitWithDefaultTimeout()
- Expect(check1.ExitCode()).To(Equal(0))
+ Expect(check1).Should(Exit(0))
Expect(check1.OutputToString()).To(Equal("/pause"))
// check the Path and Args
check2 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Path}}:{{.Args}}", data.Containers[0].ID})
check2.WaitWithDefaultTimeout()
- Expect(check2.ExitCode()).To(Equal(0))
+ Expect(check2).Should(Exit(0))
Expect(check2.OutputToString()).To(Equal("/pause:[/pause]"))
})
@@ -365,22 +366,22 @@ var _ = Describe("Podman pod create", func() {
name := "test"
session := podmanTest.Podman([]string{"pod", "create", "--infra-command", "/pause1", "--name", name})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
check := podmanTest.Podman([]string{"pod", "inspect", name})
check.WaitWithDefaultTimeout()
- Expect(check.ExitCode()).To(Equal(0))
+ Expect(check).Should(Exit(0))
data := check.InspectPodToJSON()
check1 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Config.Entrypoint}}", data.Containers[0].ID})
check1.WaitWithDefaultTimeout()
- Expect(check1.ExitCode()).To(Equal(0))
+ Expect(check1).Should(Exit(0))
Expect(check1.OutputToString()).To(Equal("/pause1"))
// check the Path and Args
check2 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Path}}:{{.Args}}", data.Containers[0].ID})
check2.WaitWithDefaultTimeout()
- Expect(check2.ExitCode()).To(Equal(0))
+ Expect(check2).Should(Exit(0))
Expect(check2.OutputToString()).To(Equal("/pause1:[/pause1]"))
})
@@ -392,22 +393,22 @@ entrypoint ["/fromimage"]
name := "test"
session := podmanTest.Podman([]string{"pod", "create", "--infra-image", "localhost/infra", "--name", name})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
check := podmanTest.Podman([]string{"pod", "inspect", name})
check.WaitWithDefaultTimeout()
- Expect(check.ExitCode()).To(Equal(0))
+ Expect(check).Should(Exit(0))
data := check.InspectPodToJSON()
check1 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Config.Entrypoint}}", data.Containers[0].ID})
check1.WaitWithDefaultTimeout()
- Expect(check1.ExitCode()).To(Equal(0))
+ Expect(check1).Should(Exit(0))
Expect(check1.OutputToString()).To(Equal("/fromimage"))
// check the Path and Args
check2 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Path}}:{{.Args}}", data.Containers[0].ID})
check2.WaitWithDefaultTimeout()
- Expect(check2.ExitCode()).To(Equal(0))
+ Expect(check2).Should(Exit(0))
Expect(check2.OutputToString()).To(Equal("/fromimage:[/fromimage]"))
})
@@ -419,22 +420,22 @@ entrypoint ["/fromimage"]
name := "test"
session := podmanTest.Podman([]string{"pod", "create", "--infra-image", "localhost/infra", "--infra-command", "/fromcommand", "--name", name})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
check := podmanTest.Podman([]string{"pod", "inspect", name})
check.WaitWithDefaultTimeout()
- Expect(check.ExitCode()).To(Equal(0))
+ Expect(check).Should(Exit(0))
data := check.InspectPodToJSON()
check1 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Config.Entrypoint}}", data.Containers[0].ID})
check1.WaitWithDefaultTimeout()
- Expect(check1.ExitCode()).To(Equal(0))
+ Expect(check1).Should(Exit(0))
Expect(check1.OutputToString()).To(Equal("/fromcommand"))
// check the Path and Args
check2 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Path}}:{{.Args}}", data.Containers[0].ID})
check2.WaitWithDefaultTimeout()
- Expect(check2.ExitCode()).To(Equal(0))
+ Expect(check2).Should(Exit(0))
Expect(check2.OutputToString()).To(Equal("/fromcommand:[/fromcommand]"))
})
@@ -442,11 +443,11 @@ entrypoint ["/fromimage"]
name := "test"
session := podmanTest.Podman([]string{"pod", "create", "--name", name, "--network", "slirp4netns:port_handler=slirp4netns", "-p", "8082:8000"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
check := podmanTest.Podman([]string{"pod", "inspect", "--format", "{{.InfraConfig.NetworkOptions.slirp4netns}}", name})
check.WaitWithDefaultTimeout()
- Expect(check.ExitCode()).To(Equal(0))
+ Expect(check).Should(Exit(0))
Expect(check.OutputToString()).To(Equal("[port_handler=slirp4netns]"))
})
@@ -454,41 +455,41 @@ entrypoint ["/fromimage"]
podName := "testpod"
create := podmanTest.Podman([]string{"pod", "create", "--name", podName})
create.WaitWithDefaultTimeout()
- Expect(create.ExitCode()).To(Equal(0))
+ Expect(create).Should(Exit(0))
status1 := podmanTest.Podman([]string{"pod", "inspect", "--format", "{{ .State }}", podName})
status1.WaitWithDefaultTimeout()
- Expect(status1.ExitCode()).To(Equal(0))
+ Expect(status1).Should(Exit(0))
Expect(strings.Contains(status1.OutputToString(), "Created")).To(BeTrue())
ctr1 := podmanTest.Podman([]string{"run", "--pod", podName, "-d", ALPINE, "top"})
ctr1.WaitWithDefaultTimeout()
- Expect(ctr1.ExitCode()).To(Equal(0))
+ Expect(ctr1).Should(Exit(0))
status2 := podmanTest.Podman([]string{"pod", "inspect", "--format", "{{ .State }}", podName})
status2.WaitWithDefaultTimeout()
- Expect(status2.ExitCode()).To(Equal(0))
+ Expect(status2).Should(Exit(0))
Expect(strings.Contains(status2.OutputToString(), "Running")).To(BeTrue())
ctr2 := podmanTest.Podman([]string{"create", "--pod", podName, ALPINE, "top"})
ctr2.WaitWithDefaultTimeout()
- Expect(ctr2.ExitCode()).To(Equal(0))
+ Expect(ctr2).Should(Exit(0))
status3 := podmanTest.Podman([]string{"pod", "inspect", "--format", "{{ .State }}", podName})
status3.WaitWithDefaultTimeout()
- Expect(status3.ExitCode()).To(Equal(0))
+ Expect(status3).Should(Exit(0))
Expect(strings.Contains(status3.OutputToString(), "Degraded")).To(BeTrue())
})
It("podman create with unsupported network options", func() {
podCreate := podmanTest.Podman([]string{"pod", "create", "--network", "container:doesnotmatter"})
podCreate.WaitWithDefaultTimeout()
- Expect(podCreate.ExitCode()).To(Equal(125))
+ Expect(podCreate).Should(Exit(125))
Expect(podCreate.ErrorToString()).To(ContainSubstring("pods presently do not support network mode container"))
podCreate = podmanTest.Podman([]string{"pod", "create", "--network", "ns:/does/not/matter"})
podCreate.WaitWithDefaultTimeout()
- Expect(podCreate.ExitCode()).To(Equal(125))
+ Expect(podCreate).Should(Exit(125))
Expect(podCreate.ErrorToString()).To(ContainSubstring("pods presently do not support network mode path"))
})
@@ -496,11 +497,11 @@ entrypoint ["/fromimage"]
podName := "testPod"
podCreate := podmanTest.Podman([]string{"pod", "create", "--network", "none", "--name", podName})
podCreate.WaitWithDefaultTimeout()
- Expect(podCreate.ExitCode()).To(Equal(0))
+ Expect(podCreate).Should(Exit(0))
session := podmanTest.Podman([]string{"run", "--pod", podName, ALPINE, "ip", "-o", "-4", "addr"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("inet 127.0.0.1/8 scope host lo"))
Expect(len(session.OutputToStringArray())).To(Equal(1))
})
@@ -515,7 +516,7 @@ ENTRYPOINT ["sleep","99999"]
create := podmanTest.Podman([]string{"pod", "create", "--infra-image", iid})
create.WaitWithDefaultTimeout()
- Expect(create.ExitCode()).To(BeZero())
+ Expect(create).Should(Exit(0))
})
It("podman pod create --cpus", func() {
@@ -525,15 +526,15 @@ ENTRYPOINT ["sleep","99999"]
numCPUStr := strconv.Itoa(int(numCPU))
podCreate := podmanTest.Podman([]string{"pod", "create", "--cpus", numCPUStr, "--name", podName})
podCreate.WaitWithDefaultTimeout()
- Expect(podCreate.ExitCode()).To(Equal(0))
+ Expect(podCreate).Should(Exit(0))
contCreate := podmanTest.Podman([]string{"container", "create", "--pod", podName, "alpine"})
contCreate.WaitWithDefaultTimeout()
- Expect(podCreate.ExitCode()).To(Equal(0))
+ Expect(podCreate).Should(Exit(0))
podInspect := podmanTest.Podman([]string{"pod", "inspect", podName})
podInspect.WaitWithDefaultTimeout()
- Expect(podInspect.ExitCode()).To(Equal(0))
+ Expect(podInspect).Should(Exit(0))
podJSON := podInspect.InspectPodToJSON()
Expect(podJSON.CPUPeriod).To(Equal(period))
Expect(podJSON.CPUQuota).To(Equal(quota))
@@ -547,15 +548,15 @@ ENTRYPOINT ["sleep","99999"]
in := "0-" + numCPUStr
podCreate := podmanTest.Podman([]string{"pod", "create", "--cpuset-cpus", in, "--name", podName})
podCreate.WaitWithDefaultTimeout()
- Expect(podCreate.ExitCode()).To(Equal(0))
+ Expect(podCreate).Should(Exit(0))
contCreate := podmanTest.Podman([]string{"container", "create", "--name", ctrName, "--pod", podName, "alpine"})
contCreate.WaitWithDefaultTimeout()
- Expect(podCreate.ExitCode()).To(Equal(0))
+ Expect(podCreate).Should(Exit(0))
podInspect := podmanTest.Podman([]string{"pod", "inspect", podName})
podInspect.WaitWithDefaultTimeout()
- Expect(podInspect.ExitCode()).To(Equal(0))
+ Expect(podInspect).Should(Exit(0))
podJSON := podInspect.InspectPodToJSON()
Expect(podJSON.CPUSetCPUs).To(Equal(in))
})
diff --git a/test/e2e/pod_infra_container_test.go b/test/e2e/pod_infra_container_test.go
index 09f0d4e33..3bd7f48ab 100644
--- a/test/e2e/pod_infra_container_test.go
+++ b/test/e2e/pod_infra_container_test.go
@@ -7,6 +7,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman pod create", func() {
@@ -36,7 +37,7 @@ var _ = Describe("Podman pod create", func() {
It("podman create infra container", func() {
session := podmanTest.Podman([]string{"pod", "create"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
podID := session.OutputToString()
check := podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc"})
@@ -53,54 +54,54 @@ var _ = Describe("Podman pod create", func() {
It("podman start infra container", func() {
session := podmanTest.Podman([]string{"pod", "create"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
podID := session.OutputToString()
session = podmanTest.Podman([]string{"pod", "start", podID})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
check := podmanTest.Podman([]string{"ps", "-qa", "--no-trunc", "--filter", "status=running"})
check.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(check.OutputToStringArray())).To(Equal(1))
})
It("podman start infra container different image", func() {
session := podmanTest.Podman([]string{"pod", "create", "--infra-image", BB})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
podID := session.OutputToString()
session = podmanTest.Podman([]string{"pod", "start", podID})
session.WaitWithDefaultTimeout()
// If we use the default entry point, we should exit with no error
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman infra container namespaces", func() {
session := podmanTest.Podman([]string{"pod", "create"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
podID := session.OutputToString()
session = podmanTest.Podman([]string{"pod", "start", podID})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.RunTopContainerInPod("", podID)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
check := podmanTest.Podman([]string{"ps", "-a", "--no-trunc", "--ns", "--format", "{{.Namespaces.IPC}} {{.Namespaces.NET}}"})
check.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(check.OutputToStringArray())).To(Equal(2))
Expect(check.OutputToStringArray()[0]).To(Equal(check.OutputToStringArray()[1]))
check = podmanTest.Podman([]string{"ps", "-a", "--no-trunc", "--ns", "--format", "{{.IPC}} {{.NET}}"})
check.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(check.OutputToStringArray())).To(Equal(2))
Expect(check.OutputToStringArray()[0]).To(Equal(check.OutputToStringArray()[1]))
})
@@ -108,20 +109,20 @@ var _ = Describe("Podman pod create", func() {
It("podman pod correctly sets up NetNS", func() {
session := podmanTest.Podman([]string{"pod", "create", "--share", "net"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
podID := session.OutputToString()
session = podmanTest.Podman([]string{"pod", "start", podID})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "-d", "--pod", podID, nginx})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--pod", podID, fedoraMinimal, "curl", "localhost:80"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", fedoraMinimal, "curl", "localhost"})
session.WaitWithDefaultTimeout()
@@ -131,43 +132,43 @@ var _ = Describe("Podman pod create", func() {
It("podman pod correctly sets up IPCNS", func() {
session := podmanTest.Podman([]string{"pod", "create", "--share", "ipc"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
podID := session.OutputToString()
session = podmanTest.Podman([]string{"pod", "start", podID})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--pod", podID, fedoraMinimal, "/bin/sh", "-c", "'touch /dev/shm/hi'"})
session.WaitWithDefaultTimeout()
if session.ExitCode() != 0 {
Skip("ShmDir not initialized, skipping...")
}
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--pod", podID, fedoraMinimal, "/bin/sh", "-c", "'ls /dev/shm'"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("hi"))
})
It("podman pod correctly sets up PIDNS", func() {
session := podmanTest.Podman([]string{"pod", "create", "--share", "pid", "--name", "test-pod"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
podID := session.OutputToString()
session = podmanTest.Podman([]string{"pod", "start", podID})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.RunTopContainerInPod("test-ctr", podID)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
check := podmanTest.Podman([]string{"top", "test-ctr", "pid"})
check.WaitWithDefaultTimeout()
- Expect(check.ExitCode()).To(Equal(0))
+ Expect(check).Should(Exit(0))
PIDs := check.OutputToStringArray()
Expect(len(PIDs)).To(Equal(3))
@@ -179,25 +180,25 @@ var _ = Describe("Podman pod create", func() {
It("podman pod doesn't share PIDNS if requested to not", func() {
session := podmanTest.Podman([]string{"pod", "create", "--share", "net", "--name", "test-pod"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
podID := session.OutputToString()
session = podmanTest.Podman([]string{"pod", "start", podID})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.RunTopContainerInPod("test-ctr", podID)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
check := podmanTest.Podman([]string{"top", "test-ctr", "pid"})
check.WaitWithDefaultTimeout()
- Expect(check.ExitCode()).To(Equal(0))
+ Expect(check).Should(Exit(0))
ctrTop := check.OutputToStringArray()
check = podmanTest.Podman([]string{"top", podID[:12] + "-infra", "pid"})
check.WaitWithDefaultTimeout()
- Expect(check.ExitCode()).To(Equal(0))
+ Expect(check).Should(Exit(0))
infraTop := check.OutputToStringArray()
ctrPID, _ := strconv.Atoi(ctrTop[1])
@@ -208,16 +209,16 @@ var _ = Describe("Podman pod create", func() {
It("podman pod container can override pod net NS", func() {
session := podmanTest.Podman([]string{"pod", "create", "--share", "net"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
podID := session.OutputToString()
session = podmanTest.Podman([]string{"pod", "start", podID})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "-d", "--pod", podID, nginx})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--pod", podID, "--network", "bridge", nginx, "curl", "localhost"})
session.WaitWithDefaultTimeout()
@@ -228,26 +229,26 @@ var _ = Describe("Podman pod create", func() {
SkipIfRootlessCgroupsV1("Not supported for rootless + CGroupsV1")
session := podmanTest.Podman([]string{"pod", "create", "--share", "pid"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
podID := session.OutputToString()
session = podmanTest.Podman([]string{"pod", "start", podID})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--pod", podID, "--pid", "host", "-d", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
check := podmanTest.Podman([]string{"ps", "-a", "--ns", "--format", "{{.Namespaces.PIDNS}}"})
check.WaitWithDefaultTimeout()
- Expect(check.ExitCode()).To(Equal(0))
+ Expect(check).Should(Exit(0))
outputArray := check.OutputToStringArray()
Expect(len(outputArray)).To(Equal(2))
check = podmanTest.Podman([]string{"ps", "-a", "--ns", "--format", "{{.PIDNS}}"})
check.WaitWithDefaultTimeout()
- Expect(check.ExitCode()).To(Equal(0))
+ Expect(check).Should(Exit(0))
outputArray = check.OutputToStringArray()
Expect(len(outputArray)).To(Equal(2))
@@ -259,20 +260,20 @@ var _ = Describe("Podman pod create", func() {
It("podman pod container can override pod not sharing pid", func() {
session := podmanTest.Podman([]string{"pod", "create", "--share", "net"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
podID := session.OutputToString()
session = podmanTest.Podman([]string{"pod", "start", podID})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--pod", podID, "--pid", "pod", "-d", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
check := podmanTest.Podman([]string{"ps", "-a", "--ns", "--format", "{{.PIDNS}}"})
check.WaitWithDefaultTimeout()
- Expect(check.ExitCode()).To(Equal(0))
+ Expect(check).Should(Exit(0))
outputArray := check.OutputToStringArray()
Expect(len(outputArray)).To(Equal(2))
@@ -284,20 +285,20 @@ var _ = Describe("Podman pod create", func() {
It("podman pod container can override pod ipc NS", func() {
session := podmanTest.Podman([]string{"pod", "create", "--share", "ipc"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
podID := session.OutputToString()
session = podmanTest.Podman([]string{"pod", "start", podID})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--pod", podID, "--ipc", "host", "-d", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
check := podmanTest.Podman([]string{"ps", "-a", "--ns", "--format", "{{.IPC}}"})
check.WaitWithDefaultTimeout()
- Expect(check.ExitCode()).To(Equal(0))
+ Expect(check).Should(Exit(0))
outputArray := check.OutputToStringArray()
Expect(len(outputArray)).To(Equal(2))
@@ -309,12 +310,12 @@ var _ = Describe("Podman pod create", func() {
It("podman pod infra container deletion", func() {
session := podmanTest.Podman([]string{"pod", "create", "--share", "ipc"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
podID := session.OutputToString()
session = podmanTest.Podman([]string{"ps", "-aq"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
infraID := session.OutputToString()
session = podmanTest.Podman([]string{"rm", infraID})
@@ -323,27 +324,27 @@ var _ = Describe("Podman pod create", func() {
session = podmanTest.Podman([]string{"pod", "rm", podID})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman run in pod starts infra", func() {
session := podmanTest.Podman([]string{"pod", "create"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
podID := session.OutputToString()
result := podmanTest.Podman([]string{"ps", "-aq"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
infraID := result.OutputToString()
result = podmanTest.Podman([]string{"run", "--pod", podID, "-d", ALPINE, "top"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
result = podmanTest.Podman([]string{"ps", "-aq"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).Should(BeNumerically(">", 0))
Expect(result.OutputToString()).To(ContainSubstring(infraID))
@@ -352,26 +353,26 @@ var _ = Describe("Podman pod create", func() {
It("podman start in pod starts infra", func() {
session := podmanTest.Podman([]string{"pod", "create"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
podID := session.OutputToString()
result := podmanTest.Podman([]string{"ps", "-aq"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
infraID := result.OutputToString()
result = podmanTest.Podman([]string{"create", "--pod", podID, ALPINE, "ls"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
ctrID := result.OutputToString()
result = podmanTest.Podman([]string{"start", ctrID})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
result = podmanTest.Podman([]string{"ps", "-aq"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).Should(BeNumerically(">", 0))
Expect(result.OutputToString()).To(ContainSubstring(infraID))
@@ -380,7 +381,7 @@ var _ = Describe("Podman pod create", func() {
It("podman run --add-host in pod", func() {
session := podmanTest.Podman([]string{"pod", "create"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
podID := session.OutputToString()
// verify we can add a host to the infra's /etc/hosts
@@ -388,31 +389,31 @@ var _ = Describe("Podman pod create", func() {
// permission denied error as of Fedora 33.
session = podmanTest.Podman([]string{"run", "--pod", podID, "--add-host", "foobar:127.0.0.1", ALPINE, "ping", "-c", "1", "foobar"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// verify we can see the other hosts of infra's /etc/hosts
session = podmanTest.Podman([]string{"run", "--pod", podID, ALPINE, "ping", "-c", "1", "foobar"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman run hostname is shared", func() {
session := podmanTest.Podman([]string{"pod", "create"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
podID := session.OutputToString()
// verify we can add a host to the infra's /etc/hosts
session = podmanTest.Podman([]string{"run", "--pod", podID, ALPINE, "hostname"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
hostname := session.OutputToString()
infraName := podID[:12] + "-infra"
// verify we can see the other hosts of infra's /etc/hosts
session = podmanTest.Podman([]string{"inspect", infraName})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(hostname))
})
})
diff --git a/test/e2e/pod_inspect_test.go b/test/e2e/pod_inspect_test.go
index 036b08570..6633b228c 100644
--- a/test/e2e/pod_inspect_test.go
+++ b/test/e2e/pod_inspect_test.go
@@ -8,6 +8,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman pod inspect", func() {
@@ -46,15 +47,15 @@ var _ = Describe("Podman pod inspect", func() {
session := podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
inspect := podmanTest.Podman([]string{"pod", "inspect", podid})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.IsJSONOutputValid()).To(BeTrue())
podData := inspect.InspectPodToJSON()
Expect(podData.ID).To(Equal(podid))
@@ -67,13 +68,13 @@ var _ = Describe("Podman pod inspect", func() {
// Create the pod.
session := podmanTest.Podman(createCommand)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Inspect the pod and make sure that the create command is
// exactly how we created the pod.
inspect := podmanTest.Podman([]string{"pod", "inspect", podName})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.IsJSONOutputValid()).To(BeTrue())
podData := inspect.InspectPodToJSON()
// Let's get the last len(createCommand) items in the command.
@@ -86,11 +87,11 @@ var _ = Describe("Podman pod inspect", func() {
podName := "testPod"
create := podmanTest.Podman([]string{"pod", "create", "--name", podName, "-p", "8080:80"})
create.WaitWithDefaultTimeout()
- Expect(create.ExitCode()).To(Equal(0))
+ Expect(create).Should(Exit(0))
inspectOut := podmanTest.Podman([]string{"pod", "inspect", podName})
inspectOut.WaitWithDefaultTimeout()
- Expect(inspectOut.ExitCode()).To(Equal(0))
+ Expect(inspectOut).Should(Exit(0))
inspectJSON := new(define.InspectPodData)
err := json.Unmarshal(inspectOut.Out.Contents(), inspectJSON)
@@ -106,15 +107,15 @@ var _ = Describe("Podman pod inspect", func() {
macAddr := "42:43:44:00:00:01"
create := podmanTest.Podman([]string{"pod", "create", "--name", podName, "--mac-address", macAddr})
create.WaitWithDefaultTimeout()
- Expect(create.ExitCode()).To(Equal(0))
+ Expect(create).Should(Exit(0))
create = podmanTest.Podman([]string{"run", "-d", "--pod", podName, ALPINE, "top"})
create.WaitWithDefaultTimeout()
- Expect(create.ExitCode()).To(Equal(0))
+ Expect(create).Should(Exit(0))
inspectOut := podmanTest.Podman([]string{"pod", "inspect", podName})
inspectOut.WaitWithDefaultTimeout()
- Expect(inspectOut.ExitCode()).To(Equal(0))
+ Expect(inspectOut).Should(Exit(0))
Expect(inspectOut.OutputToString()).To(ContainSubstring(macAddr))
})
diff --git a/test/e2e/pod_kill_test.go b/test/e2e/pod_kill_test.go
index 92dcad292..7ab62ec5d 100644
--- a/test/e2e/pod_kill_test.go
+++ b/test/e2e/pod_kill_test.go
@@ -7,6 +7,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman pod kill", func() {
@@ -45,15 +46,15 @@ var _ = Describe("Podman pod kill", func() {
session := podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"pod", "kill", podid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
@@ -63,11 +64,11 @@ var _ = Describe("Podman pod kill", func() {
session := podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"pod", "kill", "-s", "9", podid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
@@ -77,11 +78,11 @@ var _ = Describe("Podman pod kill", func() {
session := podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"pod", "kill", "test1"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
@@ -91,11 +92,11 @@ var _ = Describe("Podman pod kill", func() {
session := podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"pod", "kill", "-s", "bogus", "test1"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(125))
+ Expect(result).Should(Exit(125))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
})
@@ -105,24 +106,24 @@ var _ = Describe("Podman pod kill", func() {
session := podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
_, ec, podid2 := podmanTest.CreatePod(nil)
Expect(ec).To(Equal(0))
session = podmanTest.RunTopContainerInPod("", podid2)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.RunTopContainerInPod("", podid2)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
if !IsRemote() {
podid2 = "-l"
}
result := podmanTest.Podman([]string{"pod", "kill", podid2})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
})
@@ -133,23 +134,23 @@ var _ = Describe("Podman pod kill", func() {
session := podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
_, ec, podid2 := podmanTest.CreatePod(nil)
Expect(ec).To(Equal(0))
session = podmanTest.RunTopContainerInPod("", podid2)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"pod", "kill", "-a"})
result.WaitWithDefaultTimeout()
fmt.Println(result.OutputToString(), result.ErrorToString())
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
})
diff --git a/test/e2e/pod_pause_test.go b/test/e2e/pod_pause_test.go
index da3b106fa..7c092ba8e 100644
--- a/test/e2e/pod_pause_test.go
+++ b/test/e2e/pod_pause_test.go
@@ -6,6 +6,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman pod pause", func() {
@@ -53,7 +54,7 @@ var _ = Describe("Podman pod pause", func() {
result := podmanTest.Podman([]string{"pod", "pause", podid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
})
It("podman pod pause a running pod by id", func() {
@@ -62,12 +63,12 @@ var _ = Describe("Podman pod pause", func() {
session := podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"pod", "pause", podid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring(pausedState))
@@ -83,12 +84,12 @@ var _ = Describe("Podman pod pause", func() {
session := podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"pod", "unpause", podid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
})
@@ -98,17 +99,17 @@ var _ = Describe("Podman pod pause", func() {
session := podmanTest.RunTopContainerInPod("", "test1")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"pod", "pause", "test1"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.GetContainerStatus()).To(Equal(pausedState))
result = podmanTest.Podman([]string{"pod", "unpause", "test1"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
})
})
diff --git a/test/e2e/pod_pod_namespaces_test.go b/test/e2e/pod_pod_namespaces_test.go
index ce93db63c..9e9b9b2d3 100644
--- a/test/e2e/pod_pod_namespaces_test.go
+++ b/test/e2e/pod_pod_namespaces_test.go
@@ -7,6 +7,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman pod create", func() {
@@ -36,20 +37,20 @@ var _ = Describe("Podman pod create", func() {
It("podman pod container share Namespaces", func() {
session := podmanTest.Podman([]string{"pod", "create"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
podID := session.OutputToString()
session = podmanTest.Podman([]string{"pod", "start", podID})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--pod", podID, "-d", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
check := podmanTest.Podman([]string{"ps", "-a", "--ns", "--format", "{{.Namespaces.IPC}} {{.Namespaces.UTS}} {{.Namespaces.NET}}"})
check.WaitWithDefaultTimeout()
- Expect(check.ExitCode()).To(Equal(0))
+ Expect(check).Should(Exit(0))
outputArray := check.OutputToStringArray()
Expect(len(outputArray)).To(Equal(2))
@@ -63,39 +64,39 @@ var _ = Describe("Podman pod create", func() {
It("podman pod container share ipc && /dev/shm ", func() {
session := podmanTest.Podman([]string{"pod", "create"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
podID := session.OutputToString()
session = podmanTest.Podman([]string{"pod", "start", podID})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--rm", "--pod", podID, ALPINE, "touch", "/dev/shm/test"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--rm", "--pod", podID, ALPINE, "ls", "/dev/shm/test"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman pod container dontshare PIDNS", func() {
session := podmanTest.Podman([]string{"pod", "create"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
podID := session.OutputToString()
session = podmanTest.Podman([]string{"pod", "start", podID})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--pod", podID, "-d", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
check := podmanTest.Podman([]string{"ps", "-a", "--ns", "--format", "{{.Namespaces.PIDNS}}"})
check.WaitWithDefaultTimeout()
- Expect(check.ExitCode()).To(Equal(0))
+ Expect(check).Should(Exit(0))
outputArray := check.OutputToStringArray()
Expect(len(outputArray)).To(Equal(2))
diff --git a/test/e2e/pod_prune_test.go b/test/e2e/pod_prune_test.go
index 2def95308..6273fcec3 100644
--- a/test/e2e/pod_prune_test.go
+++ b/test/e2e/pod_prune_test.go
@@ -6,6 +6,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman pod prune", func() {
@@ -38,7 +39,7 @@ var _ = Describe("Podman pod prune", func() {
result := podmanTest.Podman([]string{"pod", "prune", "--force"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
})
It("podman pod prune doesn't remove a pod with a running container", func() {
@@ -47,11 +48,11 @@ var _ = Describe("Podman pod prune", func() {
ec2 := podmanTest.RunTopContainerInPod("", podid)
ec2.WaitWithDefaultTimeout()
- Expect(ec2.ExitCode()).To(Equal(0))
+ Expect(ec2).Should(Exit(0))
result := podmanTest.Podman([]string{"pod", "prune", "-f"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To((Equal(0)))
+ Expect(result).Should(Exit(0))
result = podmanTest.Podman([]string{"ps", "-qa"})
result.WaitWithDefaultTimeout()
@@ -67,7 +68,7 @@ var _ = Describe("Podman pod prune", func() {
result := podmanTest.Podman([]string{"pod", "prune", "-f"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
result = podmanTest.Podman([]string{"ps", "-qa"})
result.WaitWithDefaultTimeout()
diff --git a/test/e2e/pod_ps_test.go b/test/e2e/pod_ps_test.go
index c5c0827bc..c27539d6f 100644
--- a/test/e2e/pod_ps_test.go
+++ b/test/e2e/pod_ps_test.go
@@ -39,7 +39,7 @@ var _ = Describe("Podman ps", func() {
It("podman pod ps no pods", func() {
session := podmanTest.Podman([]string{"pod", "ps"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman pod ps default", func() {
@@ -48,11 +48,11 @@ var _ = Describe("Podman ps", func() {
session := podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"pod", "ps"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).Should(BeNumerically(">", 0))
})
@@ -79,7 +79,7 @@ var _ = Describe("Podman ps", func() {
result := podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).Should(BeNumerically(">", 0))
Expect(podid).To(Equal(result.OutputToStringArray()[0]))
})
@@ -94,7 +94,7 @@ var _ = Describe("Podman ps", func() {
result := podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc", "--latest"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(ContainSubstring(podid2))
Expect(result.OutputToString()).To(Not(ContainSubstring(podid1)))
})
@@ -105,7 +105,7 @@ var _ = Describe("Podman ps", func() {
result := podmanTest.Podman([]string{"pod", "ps", "--filter", fmt.Sprintf("id=%s", podid)})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
})
It("podman pod ps filter name regexp", func() {
@@ -116,14 +116,14 @@ var _ = Describe("Podman ps", func() {
result := podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc", "--filter", "name=mypod"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
output := result.OutputToStringArray()
Expect(len(output)).To(Equal(2))
result = podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc", "--filter", "name=mypod$"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
output = result.OutputToStringArray()
Expect(len(output)).To(Equal(1))
@@ -150,7 +150,7 @@ var _ = Describe("Podman ps", func() {
session := podmanTest.Podman([]string{"pod", "ps", "--sort=name", "--format", "{{.Name}}"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
sortedArr := session.OutputToStringArray()
@@ -164,14 +164,14 @@ var _ = Describe("Podman ps", func() {
session := podmanTest.RunTopContainerInPod("test1", podid)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
_, ec, _ = podmanTest.RunLsContainerInPod("test2", podid)
Expect(ec).To(Equal(0))
session = podmanTest.Podman([]string{"pod", "ps", "--format={{.ContainerNames}}", "--ctr-names"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("test1"))
Expect(session.OutputToString()).To(ContainSubstring("test2"))
})
@@ -182,7 +182,7 @@ var _ = Describe("Podman ps", func() {
session := podmanTest.RunTopContainerInPod("test1", podid1)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
_, ec2, podid2 := podmanTest.CreatePod(nil)
Expect(ec2).To(Equal(0))
@@ -192,25 +192,25 @@ var _ = Describe("Podman ps", func() {
session = podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc", "--filter", "ctr-names=test1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(podid1))
Expect(session.OutputToString()).To(Not(ContainSubstring(podid2)))
session = podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc", "--filter", "ctr-names=test", "--filter", "ctr-status=running"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(podid1))
Expect(session.OutputToString()).To(Not(ContainSubstring(podid2)))
session = podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc", "--filter", fmt.Sprintf("ctr-ids=%s", cid)})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(podid2))
Expect(session.OutputToString()).To(Not(ContainSubstring(podid1)))
session = podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc", "--filter", "ctr-ids=" + cid[:40], "--filter", "ctr-ids=" + cid + "$"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(podid2))
Expect(session.OutputToString()).To(Not(ContainSubstring(podid1)))
@@ -219,42 +219,42 @@ var _ = Describe("Podman ps", func() {
session = podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc", "--filter", "ctr-number=1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(podid1))
Expect(session.OutputToString()).To(ContainSubstring(podid2))
Expect(session.OutputToString()).To(Not(ContainSubstring(podid3)))
session = podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc", "--filter", "ctr-number=1", "--filter", "ctr-number=0"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(podid1))
Expect(session.OutputToString()).To(ContainSubstring(podid2))
Expect(session.OutputToString()).To(ContainSubstring(podid3))
session = podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc", "--filter", "ctr-status=running"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(podid1))
Expect(session.OutputToString()).To(Not(ContainSubstring(podid2)))
Expect(session.OutputToString()).To(Not(ContainSubstring(podid3)))
session = podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc", "--filter", "ctr-status=exited"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(podid2))
Expect(session.OutputToString()).To(Not(ContainSubstring(podid1)))
Expect(session.OutputToString()).To(Not(ContainSubstring(podid3)))
session = podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc", "--filter", "ctr-status=exited", "--filter", "ctr-status=running"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(podid1))
Expect(session.OutputToString()).To(ContainSubstring(podid2))
Expect(session.OutputToString()).To(Not(ContainSubstring(podid3)))
session = podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc", "--filter", "ctr-status=created"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(BeEmpty())
})
@@ -282,22 +282,22 @@ var _ = Describe("Podman ps", func() {
net := stringid.GenerateNonCryptoID()
session := podmanTest.Podman([]string{"network", "create", net})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
defer podmanTest.removeCNINetwork(net)
session = podmanTest.Podman([]string{"pod", "create", "--network", net})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
podWithNet := session.OutputToString()
session = podmanTest.Podman([]string{"pod", "create"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
podWithoutNet := session.OutputToString()
session = podmanTest.Podman([]string{"pod", "ps", "--no-trunc", "--filter", "network=" + net})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(podWithNet))
Expect(session.OutputToString()).To(Not(ContainSubstring(podWithoutNet)))
})
@@ -305,11 +305,11 @@ var _ = Describe("Podman ps", func() {
It("podman pod ps --format networks", func() {
session := podmanTest.Podman([]string{"pod", "create"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pod", "ps", "--format", "{{ .Networks }}"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
if isRootless() {
// rootless container don't have a network by default
Expect(session.OutputToString()).To(Equal(""))
@@ -321,22 +321,22 @@ var _ = Describe("Podman ps", func() {
net1 := stringid.GenerateNonCryptoID()
session = podmanTest.Podman([]string{"network", "create", net1})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
defer podmanTest.removeCNINetwork(net1)
net2 := stringid.GenerateNonCryptoID()
session = podmanTest.Podman([]string{"network", "create", net2})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
defer podmanTest.removeCNINetwork(net2)
session = podmanTest.Podman([]string{"pod", "create", "--network", net1 + "," + net2})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
pid := session.OutputToString()
session = podmanTest.Podman([]string{"pod", "ps", "--format", "{{ .Networks }}", "--filter", "id=" + pid})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
// the output is not deterministic so check both possible orders
Expect(session.OutputToString()).To(Or(Equal(net1+","+net2), Equal(net2+","+net1)))
})
@@ -344,11 +344,11 @@ var _ = Describe("Podman ps", func() {
It("pod no infra should ps", func() {
session := podmanTest.Podman([]string{"pod", "create", "--infra=false"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
ps := podmanTest.Podman([]string{"pod", "ps"})
ps.WaitWithDefaultTimeout()
- Expect(ps.ExitCode()).To(Equal(0))
+ Expect(ps).Should(Exit(0))
infra := podmanTest.Podman([]string{"pod", "ps", "--format", "{{.InfraId}}"})
infra.WaitWithDefaultTimeout()
@@ -367,7 +367,15 @@ var _ = Describe("Podman ps", func() {
session := podmanTest.Podman([]string{"pod", "ps", "--format", "{{.Labels}}"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("value1"))
})
+
+ It("podman pod ps headers", func() {
+ session := podmanTest.Podman([]string{"pod", "ps", "--ctr-ids", "--ctr-names", "--ctr-status", "--ns"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ Expect(session.OutputToString()).To(MatchRegexp(`^POD ID\s+NAME\s+STATUS\s+CREATED\s+INFRA ID\s+IDS\s+NAMES\s+STATUS\s+CGROUP\s+NAMESPACES$`))
+ })
+
})
diff --git a/test/e2e/pod_restart_test.go b/test/e2e/pod_restart_test.go
index 006421b93..448c110ce 100644
--- a/test/e2e/pod_restart_test.go
+++ b/test/e2e/pod_restart_test.go
@@ -6,6 +6,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman pod restart", func() {
@@ -35,7 +36,7 @@ var _ = Describe("Podman pod restart", func() {
It("podman pod restart bogus pod", func() {
session := podmanTest.Podman([]string{"pod", "restart", "123"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
It("podman pod restart single empty pod", func() {
@@ -44,7 +45,7 @@ var _ = Describe("Podman pod restart", func() {
session := podmanTest.Podman([]string{"pod", "restart", podid})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
It("podman pod restart single pod by name", func() {
@@ -53,14 +54,14 @@ var _ = Describe("Podman pod restart", func() {
session := podmanTest.RunTopContainerInPod("test1", "foobar99")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
startTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1"})
startTime.WaitWithDefaultTimeout()
session = podmanTest.Podman([]string{"pod", "restart", "foobar99"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
restartTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1"})
restartTime.WaitWithDefaultTimeout()
@@ -73,29 +74,29 @@ var _ = Describe("Podman pod restart", func() {
session := podmanTest.RunTopContainerInPod("test1", "foobar99")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
_, ec, _ = podmanTest.CreatePod(map[string][]string{"--name": {"foobar100"}})
Expect(ec).To(Equal(0))
session = podmanTest.RunTopContainerInPod("test2", "foobar100")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.RunTopContainerInPod("test3", "foobar100")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.RunTopContainerInPod("test4", "foobar100")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
startTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1", "test2", "test3", "test4"})
startTime.WaitWithDefaultTimeout()
session = podmanTest.Podman([]string{"pod", "restart", "foobar99", "foobar100"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
restartTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1", "test2", "test3", "test4"})
restartTime.WaitWithDefaultTimeout()
@@ -111,21 +112,21 @@ var _ = Describe("Podman pod restart", func() {
session := podmanTest.RunTopContainerInPod("test1", "foobar99")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
_, ec, _ = podmanTest.CreatePod(map[string][]string{"--name": {"foobar100"}})
Expect(ec).To(Equal(0))
session = podmanTest.RunTopContainerInPod("test2", "foobar100")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
startTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1", "test2"})
startTime.WaitWithDefaultTimeout()
session = podmanTest.Podman([]string{"pod", "restart", "-a"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
restartTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1", "test2"})
restartTime.WaitWithDefaultTimeout()
@@ -139,14 +140,14 @@ var _ = Describe("Podman pod restart", func() {
session := podmanTest.RunTopContainerInPod("test1", "foobar99")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
_, ec, _ = podmanTest.CreatePod(map[string][]string{"--name": {"foobar100"}})
Expect(ec).To(Equal(0))
session = podmanTest.RunTopContainerInPod("test2", "foobar100")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
startTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1", "test2"})
startTime.WaitWithDefaultTimeout()
@@ -157,7 +158,7 @@ var _ = Describe("Podman pod restart", func() {
}
session = podmanTest.Podman([]string{"pod", "restart", podid})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
restartTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1", "test2"})
restartTime.WaitWithDefaultTimeout()
@@ -171,10 +172,10 @@ var _ = Describe("Podman pod restart", func() {
session := podmanTest.RunTopContainerInPod("", "foobar99")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pod", "restart", podid1, "doesnotexist"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
})
diff --git a/test/e2e/pod_rm_test.go b/test/e2e/pod_rm_test.go
index 6d710f020..c5d91d679 100644
--- a/test/e2e/pod_rm_test.go
+++ b/test/e2e/pod_rm_test.go
@@ -10,6 +10,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman pod rm", func() {
@@ -42,7 +43,7 @@ var _ = Describe("Podman pod rm", func() {
result := podmanTest.Podman([]string{"pod", "rm", podid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
// Also check that we don't leak cgroups
err := filepath.Walk("/sys/fs/cgroup", func(path string, info os.FileInfo, err error) error {
@@ -73,11 +74,11 @@ var _ = Describe("Podman pod rm", func() {
}
result := podmanTest.Podman([]string{"pod", "rm", latest})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
result = podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(ContainSubstring(podid))
Expect(result.OutputToString()).To(Not(ContainSubstring(podid2)))
})
@@ -91,7 +92,7 @@ var _ = Describe("Podman pod rm", func() {
result := podmanTest.Podman([]string{"pod", "rm", podid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
result = podmanTest.Podman([]string{"ps", "-qa"})
result.WaitWithDefaultTimeout()
@@ -104,11 +105,11 @@ var _ = Describe("Podman pod rm", func() {
session := podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"pod", "rm", "-f", podid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
result = podmanTest.Podman([]string{"ps", "-q"})
result.WaitWithDefaultTimeout()
@@ -126,7 +127,7 @@ var _ = Describe("Podman pod rm", func() {
session := podmanTest.RunTopContainerInPod("", podid1)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
podmanTest.WaitForContainer()
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
fmt.Printf("Started container running in one pod")
@@ -165,22 +166,22 @@ var _ = Describe("Podman pod rm", func() {
session := podmanTest.RunTopContainerInPod("", podid1)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"create", "--pod", podid1, ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
_, ec, _ = podmanTest.RunLsContainerInPod("", podid2)
Expect(ec).To(Equal(0))
session = podmanTest.RunTopContainerInPod("", podid2)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"pod", "rm", "-fa"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
result = podmanTest.Podman([]string{"ps", "-q"})
result.WaitWithDefaultTimeout()
@@ -195,7 +196,7 @@ var _ = Describe("Podman pod rm", func() {
It("podman rm bogus pod", func() {
session := podmanTest.Podman([]string{"pod", "rm", "bogus"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(1))
+ Expect(session).Should(Exit(1))
})
It("podman rm bogus pod and a running pod", func() {
@@ -204,15 +205,15 @@ var _ = Describe("Podman pod rm", func() {
session := podmanTest.RunTopContainerInPod("test1", podid1)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pod", "rm", "bogus", "test1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(1))
+ Expect(session).Should(Exit(1))
session = podmanTest.Podman([]string{"pod", "rm", "test1", "bogus"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(1))
+ Expect(session).Should(Exit(1))
})
It("podman rm --ignore bogus pod and a running pod", func() {
@@ -222,15 +223,15 @@ var _ = Describe("Podman pod rm", func() {
session := podmanTest.RunTopContainerInPod("test1", podid1)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pod", "rm", "--force", "--ignore", "bogus", "test1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pod", "rm", "--ignore", "test1", "bogus"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman pod start/remove single pod via --pod-id-file", func() {
@@ -244,21 +245,21 @@ var _ = Describe("Podman pod rm", func() {
// Create a pod with --pod-id-file.
session := podmanTest.Podman([]string{"pod", "create", "--name", podName, "--pod-id-file", tmpFile})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Create container inside the pod.
session = podmanTest.Podman([]string{"create", "--pod", podName, ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pod", "start", "--pod-id-file", tmpFile})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(2)) // infra+top
session = podmanTest.Podman([]string{"pod", "rm", "--pod-id-file", tmpFile, "--force"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
@@ -274,12 +275,12 @@ var _ = Describe("Podman pod rm", func() {
// Create a pod with --pod-id-file.
session := podmanTest.Podman([]string{"pod", "create", "--name", podName, "--pod-id-file", tmpFile})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Create container inside the pod.
session = podmanTest.Podman([]string{"create", "--pod", podName, ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Append the id files along with the command.
podIDFiles = append(podIDFiles, "--pod-id-file")
@@ -290,14 +291,14 @@ var _ = Describe("Podman pod rm", func() {
cmd = append(cmd, podIDFiles...)
session := podmanTest.Podman(cmd)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(20)) // 10*(infra+top)
cmd = []string{"pod", "rm", "--force"}
cmd = append(cmd, podIDFiles...)
session = podmanTest.Podman(cmd)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
})
diff --git a/test/e2e/pod_start_test.go b/test/e2e/pod_start_test.go
index 5838f3310..93c200389 100644
--- a/test/e2e/pod_start_test.go
+++ b/test/e2e/pod_start_test.go
@@ -40,7 +40,7 @@ var _ = Describe("Podman pod start", func() {
It("podman pod start bogus pod", func() {
session := podmanTest.Podman([]string{"pod", "start", "123"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
It("podman pod start single empty pod", func() {
@@ -49,7 +49,7 @@ var _ = Describe("Podman pod start", func() {
session := podmanTest.Podman([]string{"pod", "start", podid})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
It("podman pod start single pod by name", func() {
@@ -58,11 +58,11 @@ var _ = Describe("Podman pod start", func() {
session := podmanTest.Podman([]string{"create", "--pod", "foobar99", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pod", "start", "foobar99"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman pod start multiple pods", func() {
@@ -71,18 +71,18 @@ var _ = Describe("Podman pod start", func() {
session := podmanTest.Podman([]string{"create", "--pod", "foobar99", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
_, ec2, podid2 := podmanTest.CreatePod(map[string][]string{"--name": {"foobar100"}})
Expect(ec2).To(Equal(0))
session = podmanTest.Podman([]string{"create", "--pod", "foobar100", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pod", "start", podid1, podid2})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(2))
})
@@ -122,18 +122,18 @@ var _ = Describe("Podman pod start", func() {
session := podmanTest.Podman([]string{"create", "--pod", "foobar99", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
_, ec, _ = podmanTest.CreatePod(map[string][]string{"--name": {"foobar100"}})
Expect(ec).To(Equal(0))
session = podmanTest.Podman([]string{"create", "--pod", "foobar100", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pod", "start", "--all"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(2))
})
@@ -143,14 +143,14 @@ var _ = Describe("Podman pod start", func() {
session := podmanTest.Podman([]string{"create", "--pod", "foobar99", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
_, ec, _ = podmanTest.CreatePod(map[string][]string{"--name": {"foobar100"}})
Expect(ec).To(Equal(0))
session = podmanTest.Podman([]string{"create", "--pod", "foobar100", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
podid := "--latest"
if IsRemote() {
@@ -158,7 +158,7 @@ var _ = Describe("Podman pod start", func() {
}
session = podmanTest.Podman([]string{"pod", "start", podid})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
})
@@ -168,11 +168,11 @@ var _ = Describe("Podman pod start", func() {
session := podmanTest.Podman([]string{"create", "--pod", "foobar99", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pod", "start", podid, "doesnotexist"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
It("podman pod start single pod via --pod-id-file", func() {
@@ -186,16 +186,16 @@ var _ = Describe("Podman pod start", func() {
// Create a pod with --pod-id-file.
session := podmanTest.Podman([]string{"pod", "create", "--name", podName, "--pod-id-file", tmpFile})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Create container inside the pod.
session = podmanTest.Podman([]string{"create", "--pod", podName, ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pod", "start", "--pod-id-file", tmpFile})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(2)) // infra+top
})
@@ -211,12 +211,12 @@ var _ = Describe("Podman pod start", func() {
// Create a pod with --pod-id-file.
session := podmanTest.Podman([]string{"pod", "create", "--name", podName, "--pod-id-file", tmpFile})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Create container inside the pod.
session = podmanTest.Podman([]string{"create", "--pod", podName, ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Append the id files along with the command.
podIDFiles = append(podIDFiles, "--pod-id-file")
@@ -227,7 +227,7 @@ var _ = Describe("Podman pod start", func() {
cmd = append(cmd, podIDFiles...)
session := podmanTest.Podman(cmd)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(20)) // 10*(infra+top)
})
@@ -241,11 +241,11 @@ var _ = Describe("Podman pod start", func() {
// Create a pod with --infra-conmon-pid.
session := podmanTest.Podman([]string{"pod", "create", "--name", podName, "--infra-conmon-pidfile", tmpFile})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pod", "start", podName})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1)) // infra
readFirstLine := func(path string) string {
diff --git a/test/e2e/pod_stats_test.go b/test/e2e/pod_stats_test.go
index 2064cdc9f..46043b16d 100644
--- a/test/e2e/pod_stats_test.go
+++ b/test/e2e/pod_stats_test.go
@@ -40,13 +40,13 @@ var _ = Describe("Podman pod stats", func() {
It("podman stats should run with no pods", func() {
session := podmanTest.Podman([]string{"pod", "stats", "--no-stream"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman stats with a bogus pod", func() {
session := podmanTest.Podman([]string{"pod", "stats", "foobar"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
It("podman stats on a specific running pod", func() {
@@ -55,15 +55,15 @@ var _ = Describe("Podman pod stats", func() {
session := podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
stats := podmanTest.Podman([]string{"pod", "stats", "--no-stream", podid})
stats.WaitWithDefaultTimeout()
- Expect(stats.ExitCode()).To(Equal(0))
+ Expect(stats).Should(Exit(0))
})
It("podman stats on a specific running pod with shortID", func() {
@@ -72,15 +72,15 @@ var _ = Describe("Podman pod stats", func() {
session := podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
stats := podmanTest.Podman([]string{"pod", "stats", "--no-stream", podid[:5]})
stats.WaitWithDefaultTimeout()
- Expect(stats.ExitCode()).To(Equal(0))
+ Expect(stats).Should(Exit(0))
})
It("podman stats on a specific running pod with name", func() {
@@ -89,15 +89,15 @@ var _ = Describe("Podman pod stats", func() {
session := podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
stats := podmanTest.Podman([]string{"pod", "stats", "--no-stream", "test"})
stats.WaitWithDefaultTimeout()
- Expect(stats.ExitCode()).To(Equal(0))
+ Expect(stats).Should(Exit(0))
})
It("podman stats on running pods", func() {
@@ -106,15 +106,15 @@ var _ = Describe("Podman pod stats", func() {
session := podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
stats := podmanTest.Podman([]string{"pod", "stats", "--no-stream"})
stats.WaitWithDefaultTimeout()
- Expect(stats.ExitCode()).To(Equal(0))
+ Expect(stats).Should(Exit(0))
})
It("podman stats on all pods", func() {
@@ -123,15 +123,15 @@ var _ = Describe("Podman pod stats", func() {
session := podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
stats := podmanTest.Podman([]string{"pod", "stats", "--no-stream", "-a"})
stats.WaitWithDefaultTimeout()
- Expect(stats.ExitCode()).To(Equal(0))
+ Expect(stats).Should(Exit(0))
})
It("podman stats with json output", func() {
@@ -140,15 +140,15 @@ var _ = Describe("Podman pod stats", func() {
session := podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
stats := podmanTest.Podman([]string{"pod", "stats", "--format", "json", "--no-stream", "-a"})
stats.WaitWithDefaultTimeout()
- Expect(stats.ExitCode()).To(Equal(0))
+ Expect(stats).Should(Exit(0))
Expect(stats.IsJSONOutputValid()).To(BeTrue())
})
It("podman stats with GO template", func() {
@@ -157,7 +157,7 @@ var _ = Describe("Podman pod stats", func() {
session := podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
stats := podmanTest.Podman([]string{"pod", "stats", "-a", "--no-reset", "--no-stream", "--format", "table {{.CID}} {{.Pod}} {{.Mem}} {{.MemUsage}} {{.CPU}} {{.NetIO}} {{.BlockIO}} {{.PIDS}} {{.Pod}}"})
stats.WaitWithDefaultTimeout()
Expect(stats).To(Exit(0))
@@ -169,7 +169,7 @@ var _ = Describe("Podman pod stats", func() {
session := podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
stats := podmanTest.Podman([]string{"pod", "stats", "-a", "--no-reset", "--no-stream", "--format", "\"table {{.ID}} \""})
stats.WaitWithDefaultTimeout()
Expect(stats).To(ExitWithError())
@@ -180,15 +180,15 @@ var _ = Describe("Podman pod stats", func() {
podName := "testPod"
podCreate := podmanTest.Podman([]string{"pod", "create", "--net=host", "--name", podName})
podCreate.WaitWithDefaultTimeout()
- Expect(podCreate.ExitCode()).To(Equal(0))
+ Expect(podCreate).Should(Exit(0))
ctrRun := podmanTest.Podman([]string{"run", "-d", "--pod", podName, ALPINE, "top"})
ctrRun.WaitWithDefaultTimeout()
- Expect(ctrRun.ExitCode()).To(Equal(0))
+ Expect(ctrRun).Should(Exit(0))
stats := podmanTest.Podman([]string{"pod", "stats", "--format", "json", "--no-stream", podName})
stats.WaitWithDefaultTimeout()
- Expect(stats.ExitCode()).To(Equal(0))
+ Expect(stats).Should(Exit(0))
Expect(stats.IsJSONOutputValid()).To(BeTrue())
})
})
diff --git a/test/e2e/pod_stop_test.go b/test/e2e/pod_stop_test.go
index 45e2f86a6..27ac7d965 100644
--- a/test/e2e/pod_stop_test.go
+++ b/test/e2e/pod_stop_test.go
@@ -7,6 +7,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman pod stop", func() {
@@ -36,14 +37,14 @@ var _ = Describe("Podman pod stop", func() {
It("podman pod stop bogus pod", func() {
session := podmanTest.Podman([]string{"pod", "stop", "123"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
It("podman pod stop --ignore bogus pod", func() {
session := podmanTest.Podman([]string{"pod", "stop", "--ignore", "123"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman stop bogus pod and a running pod", func() {
@@ -52,11 +53,11 @@ var _ = Describe("Podman pod stop", func() {
session := podmanTest.RunTopContainerInPod("test1", podid1)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pod", "stop", "bogus", "test1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
It("podman stop --ignore bogus pod and a running pod", func() {
@@ -66,15 +67,15 @@ var _ = Describe("Podman pod stop", func() {
session := podmanTest.RunTopContainerInPod("test1", podid1)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pod", "stop", "--ignore", "bogus", "test1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pod", "stop", "--ignore", "test1", "bogus"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman pod stop single empty pod", func() {
@@ -83,7 +84,7 @@ var _ = Describe("Podman pod stop", func() {
session := podmanTest.Podman([]string{"pod", "stop", podid})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman pod stop single pod by name", func() {
@@ -92,11 +93,11 @@ var _ = Describe("Podman pod stop", func() {
session := podmanTest.RunTopContainerInPod("", "foobar99")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pod", "stop", "foobar99"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
@@ -106,18 +107,18 @@ var _ = Describe("Podman pod stop", func() {
session := podmanTest.RunTopContainerInPod("", "foobar99")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
_, ec2, podid2 := podmanTest.CreatePod(map[string][]string{"--name": {"foobar100"}})
Expect(ec2).To(Equal(0))
session = podmanTest.RunTopContainerInPod("", "foobar100")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pod", "stop", podid1, podid2})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
@@ -127,18 +128,18 @@ var _ = Describe("Podman pod stop", func() {
session := podmanTest.RunTopContainerInPod("", "foobar99")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
_, ec, _ = podmanTest.CreatePod(map[string][]string{"--name": {"foobar100"}})
Expect(ec).To(Equal(0))
session = podmanTest.RunTopContainerInPod("", "foobar100")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pod", "stop", "--all"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
@@ -148,14 +149,14 @@ var _ = Describe("Podman pod stop", func() {
session := podmanTest.RunTopContainerInPod("", "foobar99")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
_, ec, _ = podmanTest.CreatePod(map[string][]string{"--name": {"foobar100"}})
Expect(ec).To(Equal(0))
session = podmanTest.RunTopContainerInPod("", "foobar100")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
podid := "--latest"
if IsRemote() {
@@ -163,7 +164,7 @@ var _ = Describe("Podman pod stop", func() {
}
session = podmanTest.Podman([]string{"pod", "stop", podid})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
})
@@ -173,11 +174,11 @@ var _ = Describe("Podman pod stop", func() {
session := podmanTest.RunTopContainerInPod("", "foobar99")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pod", "stop", podid1, "doesnotexist"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
It("podman pod start/stop single pod via --pod-id-file", func() {
@@ -191,21 +192,21 @@ var _ = Describe("Podman pod stop", func() {
// Create a pod with --pod-id-file.
session := podmanTest.Podman([]string{"pod", "create", "--name", podName, "--pod-id-file", tmpFile})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Create container inside the pod.
session = podmanTest.Podman([]string{"create", "--pod", podName, ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pod", "start", "--pod-id-file", tmpFile})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(2)) // infra+top
session = podmanTest.Podman([]string{"pod", "stop", "--pod-id-file", tmpFile})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
@@ -221,12 +222,12 @@ var _ = Describe("Podman pod stop", func() {
// Create a pod with --pod-id-file.
session := podmanTest.Podman([]string{"pod", "create", "--name", podName, "--pod-id-file", tmpFile})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Create container inside the pod.
session = podmanTest.Podman([]string{"create", "--pod", podName, ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Append the id files along with the command.
podIDFiles = append(podIDFiles, "--pod-id-file")
@@ -237,14 +238,14 @@ var _ = Describe("Podman pod stop", func() {
cmd = append(cmd, podIDFiles...)
session := podmanTest.Podman(cmd)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(20)) // 10*(infra+top)
cmd = []string{"pod", "stop"}
cmd = append(cmd, podIDFiles...)
session = podmanTest.Podman(cmd)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
})
diff --git a/test/e2e/pod_top_test.go b/test/e2e/pod_top_test.go
index 9d9c138c4..253d4adf5 100644
--- a/test/e2e/pod_top_test.go
+++ b/test/e2e/pod_top_test.go
@@ -8,6 +8,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman top", func() {
@@ -37,13 +38,13 @@ var _ = Describe("Podman top", func() {
It("podman pod top without pod name or id", func() {
result := podmanTest.Podman([]string{"pod", "top"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(125))
+ Expect(result).Should(Exit(125))
})
It("podman pod top on bogus pod", func() {
result := podmanTest.Podman([]string{"pod", "top", "1234"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(125))
+ Expect(result).Should(Exit(125))
})
It("podman pod top on non-running pod", func() {
@@ -52,7 +53,7 @@ var _ = Describe("Podman top", func() {
result := podmanTest.Podman([]string{"top", podid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(125))
+ Expect(result).Should(Exit(125))
})
It("podman pod top on pod", func() {
@@ -61,14 +62,14 @@ var _ = Describe("Podman top", func() {
session := podmanTest.Podman([]string{"run", "-d", "--pod", podid, ALPINE, "top", "-d", "2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
if !IsRemote() {
podid = "-l"
}
result := podmanTest.Podman([]string{"pod", "top", podid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).To(BeNumerically(">", 1))
})
@@ -78,11 +79,11 @@ var _ = Describe("Podman top", func() {
session := podmanTest.Podman([]string{"run", "-d", "--pod", podid, ALPINE, "top", "-d", "2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"pod", "top", podid, "pid", "%C", "args"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).To(BeNumerically(">", 1))
})
@@ -92,7 +93,7 @@ var _ = Describe("Podman top", func() {
session := podmanTest.Podman([]string{"run", "-d", "--pod", podid, ALPINE, "top", "-d", "2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// We need to pass -eo to force executing ps in the Alpine container.
// Alpines stripped down ps(1) is accepting any kind of weird input in
@@ -100,7 +101,7 @@ var _ = Describe("Podman top", func() {
// the wrong input and still print the -ef output instead.
result := podmanTest.Podman([]string{"pod", "top", podid, "-eo", "invalid"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(125))
+ Expect(result).Should(Exit(125))
})
It("podman pod top on pod with containers in same pid namespace", func() {
@@ -109,16 +110,16 @@ var _ = Describe("Podman top", func() {
session := podmanTest.Podman([]string{"run", "-d", "--pod", podid, ALPINE, "top", "-d", "2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
session = podmanTest.Podman([]string{"run", "-d", "--pod", podid, "--pid", fmt.Sprintf("container:%s", cid), ALPINE, "top", "-d", "2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"pod", "top", podid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).To(Equal(3))
})
@@ -128,11 +129,11 @@ var _ = Describe("Podman top", func() {
session := podmanTest.Podman([]string{"run", "-d", "--pod", podid, ALPINE, "top", "-d", "2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "-d", "--pod", podid, ALPINE, "top", "-d", "2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
for i := 0; i < 10; i++ {
fmt.Println("Waiting for containers to be running .... ")
@@ -143,7 +144,7 @@ var _ = Describe("Podman top", func() {
}
result := podmanTest.Podman([]string{"pod", "top", podid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).To(Equal(3))
})
})
diff --git a/test/e2e/port_test.go b/test/e2e/port_test.go
index e9bbc2adc..e5c7576ae 100644
--- a/test/e2e/port_test.go
+++ b/test/e2e/port_test.go
@@ -8,6 +8,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman port", func() {
@@ -48,7 +49,7 @@ var _ = Describe("Podman port", func() {
It("podman port -l nginx", func() {
session, cid := podmanTest.RunNginxWithHealthCheck("test1")
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
if err := podmanTest.RunHealthCheck(cid); err != nil {
Fail(err.Error())
@@ -59,14 +60,14 @@ var _ = Describe("Podman port", func() {
}
result := podmanTest.Podman([]string{"port", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
port := strings.Split(result.OutputToStringArray()[0], ":")[1]
Expect(result.LineInOutputStartsWith(fmt.Sprintf("80/tcp -> 0.0.0.0:%s", port))).To(BeTrue())
})
It("podman container port -l nginx", func() {
session, cid := podmanTest.RunNginxWithHealthCheck("")
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
if err := podmanTest.RunHealthCheck(cid); err != nil {
Fail(err.Error())
@@ -77,14 +78,14 @@ var _ = Describe("Podman port", func() {
}
result := podmanTest.Podman([]string{"container", "port", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
port := strings.Split(result.OutputToStringArray()[0], ":")[1]
Expect(result.LineInOutputStartsWith(fmt.Sprintf("80/tcp -> 0.0.0.0:%s", port))).To(BeTrue())
})
It("podman port -l port nginx", func() {
session, cid := podmanTest.RunNginxWithHealthCheck("")
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
if err := podmanTest.RunHealthCheck(cid); err != nil {
Fail(err.Error())
@@ -95,14 +96,14 @@ var _ = Describe("Podman port", func() {
}
result := podmanTest.Podman([]string{"port", cid, "80"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
port := strings.Split(result.OutputToStringArray()[0], ":")[1]
Expect(result.LineInOutputStartsWith(fmt.Sprintf("0.0.0.0:%s", port))).To(BeTrue())
})
It("podman port -a nginx", func() {
session, cid := podmanTest.RunNginxWithHealthCheck("")
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
if err := podmanTest.RunHealthCheck(cid); err != nil {
Fail(err.Error())
@@ -110,12 +111,12 @@ var _ = Describe("Podman port", func() {
result := podmanTest.Podman([]string{"port", "-a"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
})
It("podman port nginx by name", func() {
session, cid := podmanTest.RunNginxWithHealthCheck("portcheck")
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
if err := podmanTest.RunHealthCheck(cid); err != nil {
Fail(err.Error())
@@ -123,7 +124,7 @@ var _ = Describe("Podman port", func() {
result := podmanTest.Podman([]string{"port", "portcheck"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
result.LineInOutputStartsWith("80/tcp -> 0.0.0.0:")
})
@@ -136,18 +137,18 @@ var _ = Describe("Podman port", func() {
setup := podmanTest.Podman([]string{"run", "--name", "test", "-dt", "-p", "5000:5000", "-p", "5001:5001", ALPINE, "top"})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(BeZero())
+ Expect(setup).Should(Exit(0))
// Check that the first port was honored
result1 := podmanTest.Podman([]string{"port", "test", "5000"})
result1.WaitWithDefaultTimeout()
- Expect(result1.ExitCode()).To(BeZero())
+ Expect(result1).Should(Exit(0))
Expect(result1.LineInOutputStartsWith("0.0.0.0:5000")).To(BeTrue())
// Check that the second port was honored
result2 := podmanTest.Podman([]string{"port", "test", "5001"})
result2.WaitWithDefaultTimeout()
- Expect(result2.ExitCode()).To(BeZero())
+ Expect(result2).Should(Exit(0))
Expect(result2.LineInOutputStartsWith("0.0.0.0:5001")).To(BeTrue())
})
})
diff --git a/test/e2e/prune_test.go b/test/e2e/prune_test.go
index 419748adb..68ccd0a94 100644
--- a/test/e2e/prune_test.go
+++ b/test/e2e/prune_test.go
@@ -7,6 +7,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var pruneImage = fmt.Sprintf(`
@@ -42,20 +43,20 @@ var _ = Describe("Podman prune", func() {
It("podman container prune containers", func() {
top := podmanTest.RunTopContainer("")
top.WaitWithDefaultTimeout()
- Expect(top.ExitCode()).To(Equal(0))
+ Expect(top).Should(Exit(0))
top = podmanTest.RunTopContainer("")
top.WaitWithDefaultTimeout()
- Expect(top.ExitCode()).To(Equal(0))
+ Expect(top).Should(Exit(0))
cid := top.OutputToString()
stop := podmanTest.Podman([]string{"stop", cid})
stop.WaitWithDefaultTimeout()
- Expect(stop.ExitCode()).To(Equal(0))
+ Expect(stop).Should(Exit(0))
prune := podmanTest.Podman([]string{"container", "prune", "-f"})
prune.WaitWithDefaultTimeout()
- Expect(prune.ExitCode()).To(Equal(0))
+ Expect(prune).Should(Exit(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
})
@@ -63,11 +64,11 @@ var _ = Describe("Podman prune", func() {
It("podman container prune after create containers", func() {
create := podmanTest.Podman([]string{"create", "--name", "test", BB})
create.WaitWithDefaultTimeout()
- Expect(create.ExitCode()).To(Equal(0))
+ Expect(create).Should(Exit(0))
prune := podmanTest.Podman([]string{"container", "prune", "-f"})
prune.WaitWithDefaultTimeout()
- Expect(prune.ExitCode()).To(Equal(0))
+ Expect(prune).Should(Exit(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
})
@@ -75,15 +76,15 @@ var _ = Describe("Podman prune", func() {
It("podman container prune after create & init containers", func() {
create := podmanTest.Podman([]string{"create", "--name", "test", BB})
create.WaitWithDefaultTimeout()
- Expect(create.ExitCode()).To(Equal(0))
+ Expect(create).Should(Exit(0))
init := podmanTest.Podman([]string{"init", "test"})
init.WaitWithDefaultTimeout()
- Expect(init.ExitCode()).To(Equal(0))
+ Expect(init).Should(Exit(0))
prune := podmanTest.Podman([]string{"container", "prune", "-f"})
prune.WaitWithDefaultTimeout()
- Expect(prune.ExitCode()).To(Equal(0))
+ Expect(prune).Should(Exit(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
})
@@ -91,7 +92,7 @@ var _ = Describe("Podman prune", func() {
It("podman image prune - remove only dangling images", func() {
session := podmanTest.Podman([]string{"images", "-a"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
hasNone, _ := session.GrepString("<none>")
Expect(hasNone).To(BeFalse())
numImages := len(session.OutputToStringArray())
@@ -99,14 +100,14 @@ var _ = Describe("Podman prune", func() {
// Since there's no dangling image, none should be removed.
session = podmanTest.Podman([]string{"image", "prune", "-f"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(0))
// Let's be extra sure that the same number of images is
// reported.
session = podmanTest.Podman([]string{"images", "-a"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(numImages))
// Now build a new image with dangling intermediate images.
@@ -114,7 +115,7 @@ var _ = Describe("Podman prune", func() {
session = podmanTest.Podman([]string{"images", "-a"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
hasNone, _ = session.GrepString("<none>")
Expect(hasNone).To(BeTrue()) // ! we have dangling ones
numImages = len(session.OutputToStringArray())
@@ -123,7 +124,7 @@ var _ = Describe("Podman prune", func() {
// remove them.
session = podmanTest.Podman([]string{"image", "prune", "-f"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
numPrunedImages := len(session.OutputToStringArray())
Expect(numPrunedImages >= 1).To(BeTrue())
@@ -131,7 +132,7 @@ var _ = Describe("Podman prune", func() {
// been removed.
session = podmanTest.Podman([]string{"images", "-a"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(numImages - numPrunedImages))
})
@@ -140,17 +141,17 @@ var _ = Describe("Podman prune", func() {
none := podmanTest.Podman([]string{"images", "-a"})
none.WaitWithDefaultTimeout()
- Expect(none.ExitCode()).To(Equal(0))
+ Expect(none).Should(Exit(0))
hasNone, _ := none.GrepString("<none>")
Expect(hasNone).To(BeTrue())
prune := podmanTest.Podman([]string{"image", "prune", "-f"})
prune.WaitWithDefaultTimeout()
- Expect(prune.ExitCode()).To(Equal(0))
+ Expect(prune).Should(Exit(0))
after := podmanTest.Podman([]string{"images", "-a"})
after.WaitWithDefaultTimeout()
- Expect(none.ExitCode()).To(Equal(0))
+ Expect(none).Should(Exit(0))
// Check if all "dangling" images were pruned.
hasNoneAfter, _ := after.GrepString("<none>")
Expect(hasNoneAfter).To(BeFalse())
@@ -162,18 +163,18 @@ var _ = Describe("Podman prune", func() {
podmanTest.BuildImage(pruneImage, "alpine_bash:latest", "true")
none := podmanTest.Podman([]string{"images", "-a"})
none.WaitWithDefaultTimeout()
- Expect(none.ExitCode()).To(Equal(0))
+ Expect(none).Should(Exit(0))
hasNone, result := none.GrepString("<none>")
Expect(len(result)).To(Equal(2))
Expect(hasNone).To(BeTrue())
prune := podmanTest.Podman([]string{"image", "prune", "-f"})
prune.WaitWithDefaultTimeout()
- Expect(prune.ExitCode()).To(Equal(0))
+ Expect(prune).Should(Exit(0))
after := podmanTest.Podman([]string{"images", "-a"})
after.WaitWithDefaultTimeout()
- Expect(none.ExitCode()).To(Equal(0))
+ Expect(none).Should(Exit(0))
hasNoneAfter, result := none.GrepString("<none>")
Expect(hasNoneAfter).To(BeTrue())
Expect(len(after.OutputToStringArray()) > 1).To(BeTrue())
@@ -186,15 +187,15 @@ var _ = Describe("Podman prune", func() {
images := podmanTest.Podman([]string{"images", "-a"})
images.WaitWithDefaultTimeout()
- Expect(images.ExitCode()).To(Equal(0))
+ Expect(images).Should(Exit(0))
prune := podmanTest.Podman([]string{"image", "prune", "-af"})
prune.WaitWithDefaultTimeout()
- Expect(prune.ExitCode()).To(Equal(0))
+ Expect(prune).Should(Exit(0))
images = podmanTest.Podman([]string{"images", "-aq"})
images.WaitWithDefaultTimeout()
- Expect(images.ExitCode()).To(Equal(0))
+ Expect(images).Should(Exit(0))
// all images are unused, so they all should be deleted!
Expect(len(images.OutputToStringArray())).To(Equal(len(CACHE_IMAGES)))
})
@@ -204,7 +205,7 @@ var _ = Describe("Podman prune", func() {
podmanTest.BuildImage(pruneImage, "alpine_bash:latest", "true")
prune := podmanTest.Podman([]string{"system", "prune", "-a", "--force"})
prune.WaitWithDefaultTimeout()
- Expect(prune.ExitCode()).To(Equal(0))
+ Expect(prune).Should(Exit(0))
images := podmanTest.Podman([]string{"images", "-aq"})
images.WaitWithDefaultTimeout()
@@ -215,63 +216,63 @@ var _ = Describe("Podman prune", func() {
It("podman system prune pods", func() {
session := podmanTest.Podman([]string{"pod", "create"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pod", "create"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
podid1 := session.OutputToString()
session = podmanTest.Podman([]string{"pod", "start", podid1})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pod", "stop", podid1})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
pods := podmanTest.Podman([]string{"pod", "ps"})
pods.WaitWithDefaultTimeout()
- Expect(pods.ExitCode()).To(Equal(0))
+ Expect(pods).Should(Exit(0))
Expect(len(pods.OutputToStringArray())).To(Equal(3))
prune := podmanTest.Podman([]string{"system", "prune", "-f"})
prune.WaitWithDefaultTimeout()
- Expect(prune.ExitCode()).To(Equal(0))
+ Expect(prune).Should(Exit(0))
pods = podmanTest.Podman([]string{"pod", "ps"})
pods.WaitWithDefaultTimeout()
- Expect(pods.ExitCode()).To(Equal(0))
+ Expect(pods).Should(Exit(0))
Expect(len(pods.OutputToStringArray())).To(Equal(2))
})
It("podman system prune - pod,container stopped", func() {
session := podmanTest.Podman([]string{"pod", "create"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
podid1 := session.OutputToString()
// Start and stop a pod to get it in exited state.
session = podmanTest.Podman([]string{"pod", "start", podid1})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pod", "stop", podid1})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Create a container. This container should be pruned.
create := podmanTest.Podman([]string{"create", "--name", "test", BB})
create.WaitWithDefaultTimeout()
- Expect(create.ExitCode()).To(Equal(0))
+ Expect(create).Should(Exit(0))
prune := podmanTest.Podman([]string{"system", "prune", "-f"})
prune.WaitWithDefaultTimeout()
- Expect(prune.ExitCode()).To(Equal(0))
+ Expect(prune).Should(Exit(0))
pods := podmanTest.Podman([]string{"pod", "ps"})
pods.WaitWithDefaultTimeout()
- Expect(pods.ExitCode()).To(Equal(0))
+ Expect(pods).Should(Exit(0))
Expect(podmanTest.NumberOfPods()).To(Equal(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
@@ -281,26 +282,26 @@ var _ = Describe("Podman prune", func() {
// Start and stop a pod to get it in exited state.
session := podmanTest.Podman([]string{"pod", "create"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
podid1 := session.OutputToString()
session = podmanTest.Podman([]string{"pod", "start", podid1})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pod", "stop", podid1})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Start a pod and leave it running
session = podmanTest.Podman([]string{"pod", "create"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
podid2 := session.OutputToString()
session = podmanTest.Podman([]string{"pod", "start", podid2})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Number of pod should be 2. One exited one running.
Expect(podmanTest.NumberOfPods()).To(Equal(2))
@@ -321,25 +322,25 @@ var _ = Describe("Podman prune", func() {
// Adding unused volume should be pruned
session = podmanTest.Podman([]string{"volume", "create"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"create", "-v", "myvol:/myvol", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(3))
session = podmanTest.Podman([]string{"system", "prune", "--force", "--volumes"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Volumes should be pruned.
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(0))
// One Pod should not be pruned as it was running
@@ -357,35 +358,35 @@ var _ = Describe("Podman prune", func() {
It("podman system prune - with dangling images true", func() {
session := podmanTest.Podman([]string{"pod", "create"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
podid1 := session.OutputToString()
// Start and stop a pod to get it in exited state.
session = podmanTest.Podman([]string{"pod", "start", podid1})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pod", "stop", podid1})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Create a container. This container should be pruned.
create := podmanTest.Podman([]string{"create", "--name", "test", BB})
create.WaitWithDefaultTimeout()
- Expect(create.ExitCode()).To(Equal(0))
+ Expect(create).Should(Exit(0))
// Adding unused volume should not be pruned as volumes not set
session = podmanTest.Podman([]string{"volume", "create"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
prune := podmanTest.Podman([]string{"system", "prune", "-f", "-a"})
prune.WaitWithDefaultTimeout()
- Expect(prune.ExitCode()).To(Equal(0))
+ Expect(prune).Should(Exit(0))
pods := podmanTest.Podman([]string{"pod", "ps"})
pods.WaitWithDefaultTimeout()
- Expect(pods.ExitCode()).To(Equal(0))
+ Expect(pods).Should(Exit(0))
Expect(podmanTest.NumberOfPods()).To(Equal(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
@@ -393,7 +394,7 @@ var _ = Describe("Podman prune", func() {
// Volumes should not be pruned
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(2))
images := podmanTest.Podman([]string{"images", "-aq"})
@@ -405,58 +406,58 @@ var _ = Describe("Podman prune", func() {
It("podman system prune --volumes --filter", func() {
session := podmanTest.Podman([]string{"volume", "create", "--label", "label1=value1", "myvol1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "create", "--label", "sharedlabel1=slv1", "myvol2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "create", "--label", "sharedlabel1=slv2", "myvol3"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "create", "--label", "sharedlabel1", "myvol4"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"create", "-v", "myvol5:/myvol5", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"create", "-v", "myvol6:/myvol6", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(7))
session = podmanTest.Podman([]string{"system", "prune", "--force", "--volumes", "--filter", "label=label1=value1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(6))
session = podmanTest.Podman([]string{"system", "prune", "--force", "--volumes", "--filter", "label=sharedlabel1=slv1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(5))
session = podmanTest.Podman([]string{"system", "prune", "--force", "--volumes", "--filter", "label=sharedlabel1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(3))
podmanTest.Cleanup()
diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go
index 2d7d84005..e27ff27a4 100644
--- a/test/e2e/ps_test.go
+++ b/test/e2e/ps_test.go
@@ -43,23 +43,23 @@ var _ = Describe("Podman ps", func() {
It("podman ps no containers", func() {
session := podmanTest.Podman([]string{"ps"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman container ps no containers", func() {
session := podmanTest.Podman([]string{"container", "ps"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman ps default", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"ps"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).Should(BeNumerically(">", 0))
})
@@ -69,7 +69,7 @@ var _ = Describe("Podman ps", func() {
result := podmanTest.Podman([]string{"ps", "-a"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).Should(BeNumerically(">", 0))
})
@@ -79,12 +79,12 @@ var _ = Describe("Podman ps", func() {
result := podmanTest.Podman([]string{"container", "list", "-a"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).Should(BeNumerically(">", 0))
result = podmanTest.Podman([]string{"container", "ls", "-a"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).Should(BeNumerically(">", 0))
})
@@ -94,7 +94,7 @@ var _ = Describe("Podman ps", func() {
result := podmanTest.Podman([]string{"ps", "-a", "--size"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).Should(BeNumerically(">", 0))
})
@@ -104,7 +104,7 @@ var _ = Describe("Podman ps", func() {
result := podmanTest.Podman([]string{"ps", "-a", "-q"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).Should(BeNumerically(">", 0))
Expect(fullCid).To(ContainSubstring(result.OutputToStringArray()[0]))
})
@@ -118,7 +118,7 @@ var _ = Describe("Podman ps", func() {
result := podmanTest.Podman([]string{"ps", "-q", "--latest"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).Should(Equal(1))
})
@@ -129,11 +129,11 @@ var _ = Describe("Podman ps", func() {
// well.
session := podmanTest.Podman([]string{"create", "alpine", "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"ps", "--last", "2"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).Should(Equal(2)) // 1 container
_, ec, _ := podmanTest.RunLsContainer("test1")
@@ -147,17 +147,17 @@ var _ = Describe("Podman ps", func() {
result = podmanTest.Podman([]string{"ps", "--last", "2"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).Should(Equal(3)) // 2 containers
result = podmanTest.Podman([]string{"ps", "--last", "3"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).Should(Equal(4)) // 3 containers
result = podmanTest.Podman([]string{"ps", "--last", "100"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).Should(Equal(5)) // 4 containers (3 running + 1 created)
})
@@ -167,7 +167,7 @@ var _ = Describe("Podman ps", func() {
result := podmanTest.Podman([]string{"ps", "-aq", "--no-trunc"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).Should(BeNumerically(">", 0))
Expect(fullCid).To(Equal(result.OutputToStringArray()[0]))
})
@@ -178,7 +178,7 @@ var _ = Describe("Podman ps", func() {
result := podmanTest.Podman([]string{"ps", "-a", "--namespace"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).Should(BeNumerically(">", 0))
})
@@ -189,7 +189,7 @@ var _ = Describe("Podman ps", func() {
result := podmanTest.Podman([]string{"ps", "-a", "--namespace", "--format",
"{{with .Namespaces}}{{.Cgroup}}:{{.IPC}}:{{.MNT}}:{{.NET}}:{{.PIDNS}}:{{.User}}:{{.UTS}}{{end}}"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
// it must contains `::` when some ns is null. If it works normally, it should be "$num1:$num2:$num3"
Expect(result.OutputToString()).To(Not(ContainSubstring(`::`)))
})
@@ -197,7 +197,7 @@ var _ = Describe("Podman ps", func() {
It("podman ps with no containers is valid json format", func() {
result := podmanTest.Podman([]string{"ps", "--format", "json"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.IsJSONOutputValid()).To(BeTrue())
})
@@ -207,18 +207,18 @@ var _ = Describe("Podman ps", func() {
result := podmanTest.Podman([]string{"ps", "-a", "--ns", "--format", "json"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.IsJSONOutputValid()).To(BeTrue())
})
It("podman ps json format Created field is int64", func() {
session := podmanTest.RunTopContainer("test1")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"ps", "--format", "json"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
// Make sure Created field is an int64
created, err := result.jq(".[0].Created")
@@ -233,7 +233,7 @@ var _ = Describe("Podman ps", func() {
result := podmanTest.Podman([]string{"ps", "-a", "--format", "json"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.IsJSONOutputValid()).To(BeTrue())
// must contain "Status"
match, StatusLine := result.GrepString(`Status`)
@@ -261,19 +261,19 @@ var _ = Describe("Podman ps", func() {
result := podmanTest.Podman([]string{"ps", "-q", "--no-trunc", "-a", "--filter", "ancestor=quay.io/libpod/alpine:latest"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(Equal(cid))
// Query just by image name, without :latest tag
result = podmanTest.Podman([]string{"ps", "-q", "--no-trunc", "-a", "--filter", "ancestor=quay.io/libpod/alpine"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(Equal(cid))
// Query by truncated image name should not match ( should return empty output )
result = podmanTest.Podman([]string{"ps", "-q", "--no-trunc", "-a", "--filter", "ancestor=quay.io/libpod/alpi"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(Equal(""))
})
@@ -283,34 +283,34 @@ var _ = Describe("Podman ps", func() {
result := podmanTest.Podman([]string{"ps", "-a", "--filter", fmt.Sprintf("id=%s", fullCid)})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
})
It("podman ps id filter flag", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
fullCid := session.OutputToString()
result := podmanTest.Podman([]string{"ps", "-aq", "--no-trunc", "--filter", "status=running"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToStringArray()[0]).To(Equal(fullCid))
})
It("podman ps multiple filters", func() {
session := podmanTest.Podman([]string{"run", "-d", "--name", "test1", "--label", "key1=value1", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
fullCid := session.OutputToString()
session2 := podmanTest.Podman([]string{"run", "-d", "--name", "test2", "--label", "key1=value1", ALPINE, "top"})
session2.WaitWithDefaultTimeout()
- Expect(session2.ExitCode()).To(Equal(0))
+ Expect(session2).Should(Exit(0))
result := podmanTest.Podman([]string{"ps", "-aq", "--no-trunc", "--filter", "name=test1", "--filter", "label=key1=value1"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
output := result.OutputToStringArray()
Expect(len(output)).To(Equal(1))
@@ -320,15 +320,15 @@ var _ = Describe("Podman ps", func() {
It("podman ps filter by exited does not need all", func() {
ctr := podmanTest.Podman([]string{"run", "-t", "-i", ALPINE, "ls", "/"})
ctr.WaitWithDefaultTimeout()
- Expect(ctr.ExitCode()).To(Equal(0))
+ Expect(ctr).Should(Exit(0))
psAll := podmanTest.Podman([]string{"ps", "-aq", "--no-trunc"})
psAll.WaitWithDefaultTimeout()
- Expect(psAll.ExitCode()).To(Equal(0))
+ Expect(psAll).Should(Exit(0))
psFilter := podmanTest.Podman([]string{"ps", "--no-trunc", "--quiet", "--filter", "status=exited"})
psFilter.WaitWithDefaultTimeout()
- Expect(psFilter.ExitCode()).To(Equal(0))
+ Expect(psFilter).Should(Exit(0))
Expect(psAll.OutputToString()).To(Equal(psFilter.OutputToString()))
})
@@ -337,11 +337,11 @@ var _ = Describe("Podman ps", func() {
ctrName := "aContainerName"
ctr := podmanTest.Podman([]string{"create", "--name", ctrName, "-t", "-i", ALPINE, "ls", "/"})
ctr.WaitWithDefaultTimeout()
- Expect(ctr.ExitCode()).To(Equal(0))
+ Expect(ctr).Should(Exit(0))
psFilter := podmanTest.Podman([]string{"ps", "--no-trunc", "--quiet", "--format", "{{.Names}}", "--filter", fmt.Sprintf("name=%s", ctrName)})
psFilter.WaitWithDefaultTimeout()
- Expect(psFilter.ExitCode()).To(Equal(0))
+ Expect(psFilter).Should(Exit(0))
Expect(strings.Contains(psFilter.OutputToString(), ctrName)).To(BeFalse())
})
@@ -359,30 +359,30 @@ var _ = Describe("Podman ps", func() {
It("podman --format by size", func() {
session := podmanTest.Podman([]string{"create", BB, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"create", "-t", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"ps", "-a", "--format", "{{.Size}}"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.ErrorToString()).To(ContainSubstring("Size format requires --size option"))
})
It("podman --sort by size", func() {
session := podmanTest.Podman([]string{"create", BB, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"create", "-t", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"ps", "-a", "-s", "--sort=size", "--format", "{{.Size}}"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
sortedArr := session.OutputToStringArray()
@@ -409,16 +409,16 @@ var _ = Describe("Podman ps", func() {
It("podman --sort by command", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "-d", ALPINE, "pwd"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"ps", "-a", "--sort=command", "--format", "{{.Command}}"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
sortedArr := session.OutputToStringArray()
@@ -432,16 +432,16 @@ var _ = Describe("Podman ps", func() {
session := podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"ps", "--no-trunc"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Not(ContainSubstring(podid)))
session = podmanTest.Podman([]string{"ps", "--pod", "--no-trunc"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(podid))
})
@@ -452,14 +452,14 @@ var _ = Describe("Podman ps", func() {
session := podmanTest.RunTopContainerInPod("", podName)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// "--no-trunc" must be given. If not it will trunc the pod ID
// in the output and you will have to trunc it in the test too.
session = podmanTest.Podman([]string{"ps", "--pod", "--no-trunc"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
output := session.OutputToString()
Expect(output).To(ContainSubstring(podid))
@@ -469,7 +469,7 @@ var _ = Describe("Podman ps", func() {
It("podman ps test with single port range", func() {
session := podmanTest.Podman([]string{"run", "-dt", "-p", "2000-2006:2000-2006", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"ps", "--format", "{{.Ports}}"})
session.WaitWithDefaultTimeout()
@@ -481,7 +481,7 @@ var _ = Describe("Podman ps", func() {
"run", "-p", "1000-2000:2000-3000", "-p", "1999-2999:3001-4001", ALPINE,
})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
Expect(session.ErrorToString()).To(ContainSubstring("conflicting port mappings for host port 1999"))
})
@@ -496,7 +496,7 @@ var _ = Describe("Podman ps", func() {
ALPINE, "top"},
)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"ps", "--format", "{{.Ports}}"})
session.WaitWithDefaultTimeout()
@@ -508,35 +508,35 @@ var _ = Describe("Podman ps", func() {
It("podman ps sync flag", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
fullCid := session.OutputToString()
result := podmanTest.Podman([]string{"ps", "-q", "--no-trunc", "--sync"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToStringArray()[0]).To(Equal(fullCid))
})
It("podman ps filter name regexp", func() {
session := podmanTest.Podman([]string{"run", "-d", "--name", "test1", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
fullCid := session.OutputToString()
session2 := podmanTest.Podman([]string{"run", "-d", "--name", "test11", ALPINE, "top"})
session2.WaitWithDefaultTimeout()
- Expect(session2.ExitCode()).To(Equal(0))
+ Expect(session2).Should(Exit(0))
result := podmanTest.Podman([]string{"ps", "-aq", "--no-trunc", "--filter", "name=test1"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
output := result.OutputToStringArray()
Expect(len(output)).To(Equal(2))
result = podmanTest.Podman([]string{"ps", "-aq", "--no-trunc", "--filter", "name=test1$"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
output = result.OutputToStringArray()
Expect(len(output)).To(Equal(1))
@@ -547,11 +547,11 @@ var _ = Describe("Podman ps", func() {
ctrName := "testCtr"
session := podmanTest.Podman([]string{"run", "-d", "--name", ctrName, ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"ps", "-q", "-a", "--format", "{{ .Names }}"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
output := result.OutputToStringArray()
Expect(len(output)).To(Equal(1))
@@ -562,23 +562,23 @@ var _ = Describe("Podman ps", func() {
podName := "testPod"
pod := podmanTest.Podman([]string{"pod", "create", "-p", "8080:80", "--name", podName})
pod.WaitWithDefaultTimeout()
- Expect(pod.ExitCode()).To(Equal(0))
+ Expect(pod).Should(Exit(0))
ctrName := "testCtr"
session := podmanTest.Podman([]string{"run", "--name", ctrName, "-dt", "--pod", podName, ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
ps := podmanTest.Podman([]string{"ps", "--filter", fmt.Sprintf("name=%s", ctrName), "--format", "{{.Ports}}"})
ps.WaitWithDefaultTimeout()
- Expect(ps.ExitCode()).To(Equal(0))
+ Expect(ps).Should(Exit(0))
Expect(ps.OutputToString()).To(ContainSubstring("0.0.0.0:8080->80/tcp"))
})
It("podman ps truncate long create command", func() {
session := podmanTest.Podman([]string{"run", ALPINE, "echo", "very", "long", "create", "command"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"ps", "-a"})
session.WaitWithDefaultTimeout()
@@ -590,7 +590,7 @@ var _ = Describe("Podman ps", func() {
result := podmanTest.Podman([]string{"ps", "-a", "--format", "{{.RunningFor}}"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(ContainSubstring("ago"))
})
@@ -598,26 +598,26 @@ var _ = Describe("Podman ps", func() {
session := podmanTest.Podman([]string{"run", "-d", "--name", "test1", "--label", "foo=1",
"--label", "bar=2", "--volume", "volume1:/test", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid1 := session.OutputToString()
session = podmanTest.Podman([]string{"run", "--name", "test2", "--label", "foo=1",
ALPINE, "ls", "/fail"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(1))
+ Expect(session).Should(Exit(1))
session = podmanTest.Podman([]string{"create", "--name", "test3", ALPINE, cid1})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--name", "test4", "--volume", "volume1:/test1",
"--volume", "/:/test2", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "name=test"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(5))
Expect(session.LineInOutputContains("test1")).To(BeTrue())
Expect(session.LineInOutputContains("test2")).To(BeTrue())
@@ -626,7 +626,7 @@ var _ = Describe("Podman ps", func() {
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "name=test1", "--filter", "name=test2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(3))
Expect(session.LineInOutputContains("test1")).To(BeTrue())
Expect(session.LineInOutputContains("test2")).To(BeTrue())
@@ -634,19 +634,19 @@ var _ = Describe("Podman ps", func() {
// check container id matches with regex
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "id=" + cid1[:40], "--filter", "id=" + cid1 + "$"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(2))
Expect(session.LineInOutputContains("test1")).To(BeTrue())
session = podmanTest.Podman([]string{"ps", "--filter", "status=created"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(2))
Expect(session.LineInOutputContains("test3")).To(BeTrue())
session = podmanTest.Podman([]string{"ps", "--filter", "status=created", "--filter", "status=exited"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(4))
Expect(session.LineInOutputContains("test2")).To(BeTrue())
Expect(session.LineInOutputContains("test3")).To(BeTrue())
@@ -654,63 +654,63 @@ var _ = Describe("Podman ps", func() {
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "label=foo=1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(3))
Expect(session.LineInOutputContains("test1")).To(BeTrue())
Expect(session.LineInOutputContains("test2")).To(BeTrue())
session = podmanTest.Podman([]string{"ps", "--filter", "label=foo=1", "--filter", "status=exited"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(2))
Expect(session.LineInOutputContains("test2")).To(BeTrue())
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "label=foo=1", "--filter", "label=non=1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(1))
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "label=foo=1", "--filter", "label=bar=2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(2))
Expect(session.LineInOutputContains("test1")).To(BeTrue())
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "exited=1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(2))
Expect(session.LineInOutputContains("test2")).To(BeTrue())
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "exited=1", "--filter", "exited=0"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(3))
Expect(session.LineInOutputContains("test2")).To(BeTrue())
Expect(session.LineInOutputContains("test4")).To(BeTrue())
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "volume=volume1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(3))
Expect(session.LineInOutputContains("test1")).To(BeTrue())
Expect(session.LineInOutputContains("test4")).To(BeTrue())
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "volume=/:/test2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(2))
Expect(session.LineInOutputContains("test4")).To(BeTrue())
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "before=test2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(2))
Expect(session.LineInOutputContains("test1")).To(BeTrue())
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "since=test2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(3))
Expect(session.LineInOutputContains("test3")).To(BeTrue())
Expect(session.LineInOutputContains("test4")).To(BeTrue())
@@ -718,48 +718,48 @@ var _ = Describe("Podman ps", func() {
It("podman ps filter pod", func() {
pod1 := podmanTest.Podman([]string{"pod", "create", "--name", "pod1"})
pod1.WaitWithDefaultTimeout()
- Expect(pod1.ExitCode()).To(BeZero())
+ Expect(pod1).Should(Exit(0))
con1 := podmanTest.Podman([]string{"run", "-dt", "--pod", "pod1", ALPINE, "top"})
con1.WaitWithDefaultTimeout()
- Expect(con1.ExitCode()).To(BeZero())
+ Expect(con1).Should(Exit(0))
pod2 := podmanTest.Podman([]string{"pod", "create", "--name", "pod2"})
pod2.WaitWithDefaultTimeout()
- Expect(pod2.ExitCode()).To(BeZero())
+ Expect(pod2).Should(Exit(0))
con2 := podmanTest.Podman([]string{"run", "-dt", "--pod", "pod2", ALPINE, "top"})
con2.WaitWithDefaultTimeout()
- Expect(con2.ExitCode()).To(BeZero())
+ Expect(con2).Should(Exit(0))
// bogus pod name or id should not result in error
session := podmanTest.Podman([]string{"ps", "--filter", "pod=1234"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
// filter by pod name
session = podmanTest.Podman([]string{"ps", "-q", "--no-trunc", "--filter", "pod=pod1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(2))
Expect(StringInSlice(pod1.OutputToString(), session.OutputToStringArray()))
// filter by full pod id
session = podmanTest.Podman([]string{"ps", "-q", "--no-trunc", "--filter", "pod=" + pod1.OutputToString()})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(2))
Expect(StringInSlice(pod1.OutputToString(), session.OutputToStringArray()))
// filter by partial pod id
session = podmanTest.Podman([]string{"ps", "-q", "--no-trunc", "--filter", "pod=" + pod1.OutputToString()[0:12]})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(2))
Expect(StringInSlice(pod1.OutputToString(), session.OutputToStringArray()))
// filter by multiple pods is inclusive
session = podmanTest.Podman([]string{"ps", "-q", "--no-trunc", "--filter", "pod=pod1", "--filter", "pod=pod2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(4))
Expect(StringInSlice(pod1.OutputToString(), session.OutputToStringArray()))
Expect(StringInSlice(pod2.OutputToString(), session.OutputToStringArray()))
@@ -770,22 +770,22 @@ var _ = Describe("Podman ps", func() {
net := stringid.GenerateNonCryptoID()
session := podmanTest.Podman([]string{"network", "create", net})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
defer podmanTest.removeCNINetwork(net)
session = podmanTest.Podman([]string{"create", "--network", net, ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
ctrWithNet := session.OutputToString()
session = podmanTest.Podman([]string{"create", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
ctrWithoutNet := session.OutputToString()
session = podmanTest.Podman([]string{"ps", "--all", "--no-trunc", "--filter", "network=" + net})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(ctrWithNet))
Expect(session.OutputToString()).To(Not(ContainSubstring(ctrWithoutNet)))
})
@@ -793,11 +793,11 @@ var _ = Describe("Podman ps", func() {
It("podman ps --format networks", func() {
session := podmanTest.Podman([]string{"create", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"ps", "--all", "--format", "{{ .Networks }}"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
if isRootless() {
// rootless container don't have a network by default
Expect(session.OutputToString()).To(Equal(""))
@@ -809,22 +809,22 @@ var _ = Describe("Podman ps", func() {
net1 := stringid.GenerateNonCryptoID()
session = podmanTest.Podman([]string{"network", "create", net1})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
defer podmanTest.removeCNINetwork(net1)
net2 := stringid.GenerateNonCryptoID()
session = podmanTest.Podman([]string{"network", "create", net2})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
defer podmanTest.removeCNINetwork(net2)
session = podmanTest.Podman([]string{"create", "--network", net1 + "," + net2, ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
session = podmanTest.Podman([]string{"ps", "--all", "--format", "{{ .Networks }}", "--filter", "id=" + cid})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
// the output is not deterministic so check both possible orders
Expect(session.OutputToString()).To(Or(Equal(net1+","+net2), Equal(net2+","+net1)))
})
diff --git a/test/e2e/pull_test.go b/test/e2e/pull_test.go
index 048f19b1e..fd9656f4d 100644
--- a/test/e2e/pull_test.go
+++ b/test/e2e/pull_test.go
@@ -10,6 +10,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman pull", func() {
@@ -38,18 +39,18 @@ var _ = Describe("Podman pull", func() {
It("podman pull multiple images with/without tag/digest", func() {
session := podmanTest.Podman([]string{"pull", "busybox:musl", "alpine", "alpine:latest", "quay.io/libpod/cirros", "quay.io/libpod/testdigest_v2s2@sha256:755f4d90b3716e2bf57060d249e2cd61c9ac089b1233465c5c2cb2d7ee550fdb"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pull", "busybox:latest", "docker.io/library/ibetthisdoesnotexistfr:random", "alpine"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
expectedError := "Error initializing source docker://ibetthisdoesnotexistfr:random"
found, _ := session.ErrorGrepString(expectedError)
Expect(found).To(Equal(true))
session = podmanTest.Podman([]string{"rmi", "busybox", "alpine", "testdigest_v2s2", "quay.io/libpod/cirros"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman pull from docker a not existing image", func() {
@@ -61,188 +62,188 @@ var _ = Describe("Podman pull", func() {
It("podman pull from docker with tag", func() {
session := podmanTest.Podman([]string{"pull", "quay.io/libpod/testdigest_v2s2:20200210"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"rmi", "testdigest_v2s2:20200210"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman pull from docker without tag", func() {
session := podmanTest.Podman([]string{"pull", "quay.io/libpod/testdigest_v2s2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"rmi", "testdigest_v2s2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman pull from alternate registry with tag", func() {
session := podmanTest.Podman([]string{"pull", cirros})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"rmi", cirros})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman pull from alternate registry without tag", func() {
session := podmanTest.Podman([]string{"pull", "quay.io/libpod/cirros"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"rmi", "quay.io/libpod/cirros"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman pull by digest", func() {
session := podmanTest.Podman([]string{"pull", "quay.io/libpod/testdigest_v2s2@sha256:755f4d90b3716e2bf57060d249e2cd61c9ac089b1233465c5c2cb2d7ee550fdb"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"rmi", "testdigest_v2s2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman pull by digest (image list)", func() {
session := podmanTest.Podman([]string{"pull", "--arch=arm64", ALPINELISTDIGEST})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// inspect using the digest of the list
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoTags}}", ALPINELISTDIGEST})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(string(session.Out.Contents())).To(HavePrefix("[]"))
// inspect using the digest of the list
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINELISTDIGEST})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTDIGEST))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64DIGEST))
// inspect using the digest of the arch-specific image's manifest
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoTags}}", ALPINEARM64DIGEST})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(string(session.Out.Contents())).To(HavePrefix("[]"))
// inspect using the digest of the arch-specific image's manifest
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINEARM64DIGEST})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTDIGEST))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64DIGEST))
// inspect using the image ID
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoTags}}", ALPINEARM64ID})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(string(session.Out.Contents())).To(HavePrefix("[]"))
// inspect using the image ID
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINEARM64ID})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTDIGEST))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64DIGEST))
// remove using the digest of the list
session = podmanTest.Podman([]string{"rmi", ALPINELISTDIGEST})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman pull by instance digest (image list)", func() {
session := podmanTest.Podman([]string{"pull", "--arch=arm64", ALPINEARM64DIGEST})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// inspect using the digest of the list
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoTags}}", ALPINELISTDIGEST})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
// inspect using the digest of the list
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINELISTDIGEST})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
// inspect using the digest of the arch-specific image's manifest
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoTags}}", ALPINEARM64DIGEST})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(string(session.Out.Contents())).To(HavePrefix("[]"))
// inspect using the digest of the arch-specific image's manifest
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINEARM64DIGEST})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(string(session.Out.Contents())).To(Not(ContainSubstring(ALPINELISTDIGEST)))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64DIGEST))
// inspect using the image ID
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoTags}}", ALPINEARM64ID})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(string(session.Out.Contents())).To(HavePrefix("[]"))
// inspect using the image ID
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINEARM64ID})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(string(session.Out.Contents())).To(Not(ContainSubstring(ALPINELISTDIGEST)))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64DIGEST))
// remove using the digest of the instance
session = podmanTest.Podman([]string{"rmi", ALPINEARM64DIGEST})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman pull by tag (image list)", func() {
session := podmanTest.Podman([]string{"pull", "--arch=arm64", ALPINELISTTAG})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// inspect using the tag we used for pulling
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoTags}}", ALPINELISTTAG})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTTAG))
// inspect using the tag we used for pulling
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINELISTTAG})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTDIGEST))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64DIGEST))
// inspect using the digest of the list
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoTags}}", ALPINELISTDIGEST})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTTAG))
// inspect using the digest of the list
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINELISTDIGEST})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTDIGEST))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64DIGEST))
// inspect using the digest of the arch-specific image's manifest
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoTags}}", ALPINEARM64DIGEST})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTTAG))
// inspect using the digest of the arch-specific image's manifest
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINEARM64DIGEST})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTDIGEST))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64DIGEST))
// inspect using the image ID
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoTags}}", ALPINEARM64ID})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTTAG))
// inspect using the image ID
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINEARM64ID})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTDIGEST))
Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64DIGEST))
// remove using the tag
session = podmanTest.Podman([]string{"rmi", ALPINELISTTAG})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman pull bogus image", func() {
@@ -259,23 +260,23 @@ var _ = Describe("Podman pull", func() {
session := podmanTest.Podman([]string{"save", "-o", tarfn, "cirros"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"rmi", "cirros"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pull", fmt.Sprintf("docker-archive:%s", tarfn)})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"rmi", "cirros"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Pulling a multi-image archive without further specifying
// which image _must_ error out. Pulling is restricted to one
// image.
session = podmanTest.Podman([]string{"pull", fmt.Sprintf("docker-archive:./testdata/docker-two-images.tar.xz")})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
expectedError := "Unexpected tar manifest.json: expected 1 item, got 2"
found, _ := session.ErrorGrepString(expectedError)
Expect(found).To(Equal(true))
@@ -284,31 +285,31 @@ var _ = Describe("Podman pull", func() {
// and index syntax.
session = podmanTest.Podman([]string{"pull", fmt.Sprintf("docker-archive:./testdata/docker-two-images.tar.xz:@0")})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pull", fmt.Sprintf("docker-archive:./testdata/docker-two-images.tar.xz:example.com/empty:latest")})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pull", fmt.Sprintf("docker-archive:./testdata/docker-two-images.tar.xz:@1")})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pull", fmt.Sprintf("docker-archive:./testdata/docker-two-images.tar.xz:example.com/empty/but:different")})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Now check for some errors.
session = podmanTest.Podman([]string{"pull", fmt.Sprintf("docker-archive:./testdata/docker-two-images.tar.xz:foo.com/does/not/exist:latest")})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
expectedError = "Tag \"foo.com/does/not/exist:latest\" not found"
found, _ = session.ErrorGrepString(expectedError)
Expect(found).To(Equal(true))
session = podmanTest.Podman([]string{"pull", fmt.Sprintf("docker-archive:./testdata/docker-two-images.tar.xz:@2")})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
expectedError = "Invalid source index @2, only 2 manifest items available"
found, _ = session.ErrorGrepString(expectedError)
Expect(found).To(Equal(true))
@@ -322,16 +323,16 @@ var _ = Describe("Podman pull", func() {
session := podmanTest.Podman([]string{"save", "--format", "oci-archive", "-o", tarfn, "cirros"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"rmi", "cirros"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pull", fmt.Sprintf("oci-archive:%s", tarfn)})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"rmi", "cirros"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman pull from local directory", func() {
@@ -344,16 +345,16 @@ var _ = Describe("Podman pull", func() {
session := podmanTest.Podman([]string{"push", "cirros", imgPath})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"rmi", "cirros"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pull", imgPath})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"images"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.LineInOutputContainsTag(filepath.Join("localhost", dirpath), "latest")).To(BeTrue())
})
@@ -367,16 +368,16 @@ var _ = Describe("Podman pull", func() {
session := podmanTest.Podman([]string{"push", "cirros", imgPath})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"rmi", "cirros"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pull", imgPath})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"images"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.LineInOutputContainsTag(filepath.Join("localhost", dirpath), "latest")).To(BeTrue())
})
@@ -384,16 +385,16 @@ var _ = Describe("Podman pull", func() {
podmanTest.RestoreArtifact(ALPINE)
setup := podmanTest.Podman([]string{"images", ALPINE, "-q", "--no-trunc"})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
shortImageId := strings.Split(setup.OutputToString(), ":")[1]
rmi := podmanTest.Podman([]string{"rmi", ALPINE})
rmi.WaitWithDefaultTimeout()
- Expect(rmi.ExitCode()).To(Equal(0))
+ Expect(rmi).Should(Exit(0))
pull := podmanTest.Podman([]string{"pull", "-q", ALPINE})
pull.WaitWithDefaultTimeout()
- Expect(pull.ExitCode()).To(Equal(0))
+ Expect(pull).Should(Exit(0))
Expect(pull.OutputToString()).To(ContainSubstring(shortImageId))
})
@@ -401,18 +402,18 @@ var _ = Describe("Podman pull", func() {
It("podman pull check all tags", func() {
session := podmanTest.Podman([]string{"pull", "--all-tags", "k8s.gcr.io/pause"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"images"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 4))
})
It("podman pull from docker with nonexistent --authfile", func() {
session := podmanTest.Podman([]string{"pull", "--authfile", "/tmp/nonexistent", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
})
It("podman pull + inspect from unqualified-search registry", func() {
@@ -434,7 +435,7 @@ var _ = Describe("Podman pull", func() {
getID := func(image string) string {
setup := podmanTest.Podman([]string{"image", "inspect", image})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
data := setup.InspectImageJSON() // returns []inspect.ImageData
Expect(len(data)).To(Equal(1))
@@ -444,11 +445,11 @@ var _ = Describe("Podman pull", func() {
untag := func(image string) {
setup := podmanTest.Podman([]string{"untag", image})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
setup = podmanTest.Podman([]string{"image", "inspect", image})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
data := setup.InspectImageJSON() // returns []inspect.ImageData
Expect(len(data)).To(Equal(1))
@@ -458,10 +459,10 @@ var _ = Describe("Podman pull", func() {
tag := func(image, tag string) {
setup := podmanTest.Podman([]string{"tag", image, tag})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
setup = podmanTest.Podman([]string{"image", "exists", tag})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
}
image1 := getID(ALPINE)
@@ -502,7 +503,7 @@ var _ = Describe("Podman pull", func() {
setup := podmanTest.Podman([]string{"image", "inspect", name})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
data := setup.InspectImageJSON() // returns []inspect.ImageData
Expect(len(data)).To(Equal(1))
@@ -515,23 +516,23 @@ var _ = Describe("Podman pull", func() {
It("podman pull --platform", func() {
session := podmanTest.Podman([]string{"pull", "--platform=linux/bogus", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
expectedError := "no image found in manifest list for architecture bogus"
Expect(session.ErrorToString()).To(ContainSubstring(expectedError))
session = podmanTest.Podman([]string{"pull", "--platform=linux/arm64", "--os", "windows", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
expectedError = "--platform option can not be specified with --arch or --os"
Expect(session.ErrorToString()).To(ContainSubstring(expectedError))
session = podmanTest.Podman([]string{"pull", "-q", "--platform=linux/arm64", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
setup := podmanTest.Podman([]string{"image", "inspect", session.OutputToString()})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
data := setup.InspectImageJSON() // returns []inspect.ImageData
Expect(len(data)).To(Equal(1))
@@ -542,23 +543,23 @@ var _ = Describe("Podman pull", func() {
It("podman pull --arch", func() {
session := podmanTest.Podman([]string{"pull", "--arch=bogus", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
expectedError := "no image found in manifest list for architecture bogus"
Expect(session.ErrorToString()).To(ContainSubstring(expectedError))
session = podmanTest.Podman([]string{"pull", "--arch=arm64", "--os", "windows", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
expectedError = "no image found in manifest list for architecture"
Expect(session.ErrorToString()).To(ContainSubstring(expectedError))
session = podmanTest.Podman([]string{"pull", "-q", "--arch=arm64", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
setup := podmanTest.Podman([]string{"image", "inspect", session.OutputToString()})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
data := setup.InspectImageJSON() // returns []inspect.ImageData
Expect(len(data)).To(Equal(1))
diff --git a/test/e2e/push_test.go b/test/e2e/push_test.go
index cc7c67941..b7e8309fb 100644
--- a/test/e2e/push_test.go
+++ b/test/e2e/push_test.go
@@ -10,6 +10,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman push", func() {
@@ -40,11 +41,11 @@ var _ = Describe("Podman push", func() {
SkipIfRemote("Remote push does not support containers-storage transport")
session := podmanTest.Podman([]string{"push", ALPINE, "containers-storage:busybox:test"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"rmi", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman push to dir", func() {
@@ -53,13 +54,13 @@ var _ = Describe("Podman push", func() {
session := podmanTest.Podman([]string{"push", "--remove-signatures", ALPINE,
fmt.Sprintf("dir:%s", bbdir)})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
bbdir = filepath.Join(podmanTest.TempDir, "busybox")
session = podmanTest.Podman([]string{"push", "--format", "oci", ALPINE,
fmt.Sprintf("dir:%s", bbdir)})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman push to local registry", func() {
@@ -74,7 +75,7 @@ var _ = Describe("Podman push", func() {
defer lock.Unlock()
session := podmanTest.Podman([]string{"run", "-d", "--name", "registry", "-p", "5000:5000", registry, "/entrypoint.sh", "/etc/docker/registry/config.yml"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
if !WaitContainerReady(podmanTest, "registry", "listening on", 20, 1) {
Skip("Cannot start docker registry.")
@@ -82,7 +83,7 @@ var _ = Describe("Podman push", func() {
push := podmanTest.Podman([]string{"push", "-q", "--tls-verify=false", "--remove-signatures", ALPINE, "localhost:5000/my-alpine"})
push.WaitWithDefaultTimeout()
- Expect(push.ExitCode()).To(Equal(0))
+ Expect(push).Should(Exit(0))
// Test --digestfile option
push2 := podmanTest.Podman([]string{"push", "--tls-verify=false", "--digestfile=/tmp/digestfile.txt", "--remove-signatures", ALPINE, "localhost:5000/my-alpine"})
@@ -90,7 +91,7 @@ var _ = Describe("Podman push", func() {
fi, err := os.Lstat("/tmp/digestfile.txt")
Expect(err).To(BeNil())
Expect(fi.Name()).To(Equal("digestfile.txt"))
- Expect(push2.ExitCode()).To(Equal(0))
+ Expect(push2).Should(Exit(0))
})
It("podman push to local registry with authorization", func() {
@@ -108,13 +109,13 @@ var _ = Describe("Podman push", func() {
if IsCommandAvailable("getenforce") {
ge := SystemExec("getenforce", []string{})
- Expect(ge.ExitCode()).To(Equal(0))
+ Expect(ge).Should(Exit(0))
if ge.OutputToString() == "Enforcing" {
se := SystemExec("setenforce", []string{"0"})
- Expect(se.ExitCode()).To(Equal(0))
+ Expect(se).Should(Exit(0))
defer func() {
se2 := SystemExec("setenforce", []string{"1"})
- Expect(se2.ExitCode()).To(Equal(0))
+ Expect(se2).Should(Exit(0))
}()
}
}
@@ -122,7 +123,7 @@ var _ = Describe("Podman push", func() {
defer lock.Unlock()
session := podmanTest.Podman([]string{"run", "--entrypoint", "htpasswd", registry, "-Bbn", "podmantest", "test"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
f, _ := os.Create(filepath.Join(authPath, "htpasswd"))
defer f.Close()
@@ -136,7 +137,7 @@ var _ = Describe("Podman push", func() {
"-v", strings.Join([]string{certPath, "/certs"}, ":"), "-e", "REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt",
"-e", "REGISTRY_HTTP_TLS_KEY=/certs/domain.key", registry})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
if !WaitContainerReady(podmanTest, "registry", "listening on", 20, 1) {
Skip("Cannot start docker registry.")
@@ -151,10 +152,10 @@ var _ = Describe("Podman push", func() {
push = podmanTest.Podman([]string{"push", "--creds=podmantest:test", "--tls-verify=false", ALPINE, "localhost:5000/tlstest"})
push.WaitWithDefaultTimeout()
- Expect(push.ExitCode()).To(Equal(0))
+ Expect(push).Should(Exit(0))
setup := SystemExec("cp", []string{filepath.Join(certPath, "domain.crt"), "/etc/containers/certs.d/localhost:5000/ca.crt"})
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
push = podmanTest.Podman([]string{"push", "--creds=podmantest:wrongpasswd", ALPINE, "localhost:5000/credstest"})
push.WaitWithDefaultTimeout()
@@ -169,7 +170,7 @@ var _ = Describe("Podman push", func() {
push = podmanTest.Podman([]string{"push", "--creds=podmantest:test", ALPINE, "localhost:5000/defaultflags"})
push.WaitWithDefaultTimeout()
- Expect(push.ExitCode()).To(Equal(0))
+ Expect(push).Should(Exit(0))
})
It("podman push to docker-archive", func() {
@@ -178,7 +179,7 @@ var _ = Describe("Podman push", func() {
session := podmanTest.Podman([]string{"push", ALPINE,
fmt.Sprintf("docker-archive:%s:latest", tarfn)})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman push to docker daemon", func() {
@@ -189,7 +190,7 @@ var _ = Describe("Podman push", func() {
setup = SystemExec("systemctl", []string{"start", "docker"})
defer func() {
stop := SystemExec("systemctl", []string{"stop", "docker"})
- Expect(stop.ExitCode()).To(Equal(0))
+ Expect(stop).Should(Exit(0))
}()
} else if setup.ExitCode() != 0 {
Skip("Docker is not available")
@@ -197,14 +198,14 @@ var _ = Describe("Podman push", func() {
session := podmanTest.Podman([]string{"push", ALPINE, "docker-daemon:alpine:podmantest"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
check := SystemExec("docker", []string{"images", "--format", "{{.Repository}}:{{.Tag}}"})
- Expect(check.ExitCode()).To(Equal(0))
+ Expect(check).Should(Exit(0))
Expect(check.OutputToString()).To(ContainSubstring("alpine:podmantest"))
clean := SystemExec("docker", []string{"rmi", "alpine:podmantest"})
- Expect(clean.ExitCode()).To(Equal(0))
+ Expect(clean).Should(Exit(0))
})
It("podman push to oci-archive", func() {
@@ -213,7 +214,7 @@ var _ = Describe("Podman push", func() {
session := podmanTest.Podman([]string{"push", ALPINE,
fmt.Sprintf("oci-archive:%s:latest", tarfn)})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman push to docker-archive no reference", func() {
@@ -222,7 +223,7 @@ var _ = Describe("Podman push", func() {
session := podmanTest.Podman([]string{"push", ALPINE,
fmt.Sprintf("docker-archive:%s", tarfn)})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman push to oci-archive no reference", func() {
@@ -232,7 +233,7 @@ var _ = Describe("Podman push", func() {
fmt.Sprintf("oci-archive:%s", ociarc)})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
})
diff --git a/test/e2e/rename_test.go b/test/e2e/rename_test.go
index 14696c0f6..0bd1792c9 100644
--- a/test/e2e/rename_test.go
+++ b/test/e2e/rename_test.go
@@ -7,6 +7,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("podman rename", func() {
@@ -36,23 +37,23 @@ var _ = Describe("podman rename", func() {
It("podman rename on non-existent container", func() {
session := podmanTest.Podman([]string{"rename", "doesNotExist", "aNewName"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
})
It("Podman rename on existing container with bad name", func() {
ctrName := "testCtr"
ctr := podmanTest.Podman([]string{"create", "--name", ctrName, ALPINE, "top"})
ctr.WaitWithDefaultTimeout()
- Expect(ctr.ExitCode()).To(Equal(0))
+ Expect(ctr).Should(Exit(0))
newName := "invalid<>:char"
rename := podmanTest.Podman([]string{"rename", ctrName, newName})
rename.WaitWithDefaultTimeout()
- Expect(rename.ExitCode()).To(Not(Equal(0)))
+ Expect(rename).To(ExitWithError())
ps := podmanTest.Podman([]string{"ps", "-aq", "--filter", fmt.Sprintf("name=%s", ctrName), "--format", "{{ .Names }}"})
ps.WaitWithDefaultTimeout()
- Expect(ps.ExitCode()).To(Equal(0))
+ Expect(ps).Should(Exit(0))
Expect(ps.OutputToString()).To(ContainSubstring(ctrName))
})
@@ -60,16 +61,16 @@ var _ = Describe("podman rename", func() {
ctrName := "testCtr"
ctr := podmanTest.Podman([]string{"create", "--name", ctrName, ALPINE, "top"})
ctr.WaitWithDefaultTimeout()
- Expect(ctr.ExitCode()).To(Equal(0))
+ Expect(ctr).Should(Exit(0))
newName := "aNewName"
rename := podmanTest.Podman([]string{"rename", ctrName, newName})
rename.WaitWithDefaultTimeout()
- Expect(rename.ExitCode()).To(Equal(0))
+ Expect(rename).Should(Exit(0))
ps := podmanTest.Podman([]string{"ps", "-aq", "--filter", fmt.Sprintf("name=%s", newName), "--format", "{{ .Names }}"})
ps.WaitWithDefaultTimeout()
- Expect(ps.ExitCode()).To(Equal(0))
+ Expect(ps).Should(Exit(0))
Expect(ps.OutputToString()).To(ContainSubstring(newName))
})
@@ -77,16 +78,16 @@ var _ = Describe("podman rename", func() {
ctrName := "testCtr"
ctr := podmanTest.Podman([]string{"run", "-d", "--name", ctrName, ALPINE, "top"})
ctr.WaitWithDefaultTimeout()
- Expect(ctr.ExitCode()).To(Equal(0))
+ Expect(ctr).Should(Exit(0))
newName := "aNewName"
rename := podmanTest.Podman([]string{"rename", ctrName, newName})
rename.WaitWithDefaultTimeout()
- Expect(rename.ExitCode()).To(Equal(0))
+ Expect(rename).Should(Exit(0))
ps := podmanTest.Podman([]string{"ps", "-aq", "--filter", fmt.Sprintf("name=%s", newName), "--format", "{{ .Names }}"})
ps.WaitWithDefaultTimeout()
- Expect(ps.ExitCode()).To(Equal(0))
+ Expect(ps).Should(Exit(0))
Expect(ps.OutputToString()).To(ContainSubstring(newName))
})
@@ -94,20 +95,20 @@ var _ = Describe("podman rename", func() {
ctrName := "testCtr"
ctr := podmanTest.Podman([]string{"run", "-d", "--name", ctrName, ALPINE, "top"})
ctr.WaitWithDefaultTimeout()
- Expect(ctr.ExitCode()).To(Equal(0))
+ Expect(ctr).Should(Exit(0))
exec := podmanTest.Podman([]string{"exec", "-d", ctrName, "top"})
exec.WaitWithDefaultTimeout()
- Expect(exec.ExitCode()).To(Equal(0))
+ Expect(exec).Should(Exit(0))
newName := "aNewName"
rename := podmanTest.Podman([]string{"rename", ctrName, newName})
rename.WaitWithDefaultTimeout()
- Expect(rename.ExitCode()).To(Equal(0))
+ Expect(rename).Should(Exit(0))
ps := podmanTest.Podman([]string{"ps", "-aq", "--filter", fmt.Sprintf("name=%s", newName), "--format", "{{ .Names }}"})
ps.WaitWithDefaultTimeout()
- Expect(ps.ExitCode()).To(Equal(0))
+ Expect(ps).Should(Exit(0))
Expect(ps.OutputToString()).To(ContainSubstring(newName))
})
})
diff --git a/test/e2e/restart_test.go b/test/e2e/restart_test.go
index dc8e64e63..6a61c1292 100644
--- a/test/e2e/restart_test.go
+++ b/test/e2e/restart_test.go
@@ -7,6 +7,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman restart", func() {
@@ -36,7 +37,7 @@ var _ = Describe("Podman restart", func() {
It("Podman restart bogus container", func() {
session := podmanTest.Podman([]string{"start", "123"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
It("Podman restart stopped container by name", func() {
@@ -47,7 +48,7 @@ var _ = Describe("Podman restart", func() {
session := podmanTest.Podman([]string{"restart", "test1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
restartTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1"})
restartTime.WaitWithDefaultTimeout()
Expect(restartTime.OutputToString()).To(Not(Equal(startTime.OutputToString())))
@@ -56,18 +57,18 @@ var _ = Describe("Podman restart", func() {
It("Podman restart stopped container by ID", func() {
session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
startTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", cid})
startTime.WaitWithDefaultTimeout()
startSession := podmanTest.Podman([]string{"start", cid})
startSession.WaitWithDefaultTimeout()
- Expect(startSession.ExitCode()).To(Equal(0))
+ Expect(startSession).Should(Exit(0))
session2 := podmanTest.Podman([]string{"restart", cid})
session2.WaitWithDefaultTimeout()
- Expect(session2.ExitCode()).To(Equal(0))
+ Expect(session2).Should(Exit(0))
restartTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", cid})
restartTime.WaitWithDefaultTimeout()
Expect(restartTime.OutputToString()).To(Not(Equal(startTime.OutputToString())))
@@ -82,7 +83,7 @@ var _ = Describe("Podman restart", func() {
session := podmanTest.Podman([]string{"restart", "test1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
restartTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1"})
restartTime.WaitWithDefaultTimeout()
Expect(restartTime.OutputToString()).To(Not(Equal(startTime.OutputToString())))
@@ -97,7 +98,7 @@ var _ = Describe("Podman restart", func() {
session := podmanTest.Podman([]string{"container", "restart", "test1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
restartTime := podmanTest.Podman([]string{"container", "inspect", "--format='{{.State.StartedAt}}'", "test1"})
restartTime.WaitWithDefaultTimeout()
Expect(restartTime.OutputToString()).To(Not(Equal(startTime.OutputToString())))
@@ -114,7 +115,7 @@ var _ = Describe("Podman restart", func() {
session := podmanTest.Podman([]string{"restart", "test1", "test2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
restartTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1", "test2"})
restartTime.WaitWithDefaultTimeout()
Expect(restartTime.OutputToStringArray()[0]).To(Not(Equal(startTime.OutputToStringArray()[0])))
@@ -137,7 +138,7 @@ var _ = Describe("Podman restart", func() {
}
session := podmanTest.Podman([]string{"restart", cid})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
restartTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1", "test2"})
restartTime.WaitWithDefaultTimeout()
Expect(restartTime.OutputToStringArray()[0]).To(Equal(startTime.OutputToStringArray()[0]))
@@ -147,11 +148,11 @@ var _ = Describe("Podman restart", func() {
It("Podman restart non-stop container with short timeout", func() {
session := podmanTest.Podman([]string{"run", "-d", "--name", "test1", "--env", "STOPSIGNAL=SIGKILL", ALPINE, "sleep", "999"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
startTime := time.Now()
session = podmanTest.Podman([]string{"restart", "-t", "2", "test1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
timeSince := time.Since(startTime)
Expect(timeSince < 10*time.Second).To(BeTrue())
Expect(timeSince > 2*time.Second).To(BeTrue())
@@ -163,14 +164,14 @@ var _ = Describe("Podman restart", func() {
test2 := podmanTest.RunTopContainer("test2")
test2.WaitWithDefaultTimeout()
- Expect(test2.ExitCode()).To(Equal(0))
+ Expect(test2).Should(Exit(0))
startTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1", "test2"})
startTime.WaitWithDefaultTimeout()
session := podmanTest.Podman([]string{"restart", "--all"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
restartTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1", "test2"})
restartTime.WaitWithDefaultTimeout()
Expect(restartTime.OutputToStringArray()[0]).To(Not(Equal(startTime.OutputToStringArray()[0])))
@@ -183,14 +184,14 @@ var _ = Describe("Podman restart", func() {
test2 := podmanTest.RunTopContainer("test2")
test2.WaitWithDefaultTimeout()
- Expect(test2.ExitCode()).To(Equal(0))
+ Expect(test2).Should(Exit(0))
startTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1", "test2"})
startTime.WaitWithDefaultTimeout()
session := podmanTest.Podman([]string{"restart", "-a", "--running"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
restartTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1", "test2"})
restartTime.WaitWithDefaultTimeout()
Expect(restartTime.OutputToStringArray()[0]).To(Equal(startTime.OutputToStringArray()[0]))
@@ -205,22 +206,22 @@ var _ = Describe("Podman restart", func() {
session := podmanTest.RunTopContainerInPod("host-restart-test", "foobar99")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
testCmd := []string{"exec", "host-restart-test", "sh", "-c", "wc -l < /etc/hosts"}
// before restart
beforeRestart := podmanTest.Podman(testCmd)
beforeRestart.WaitWithDefaultTimeout()
- Expect(beforeRestart.ExitCode()).To(Equal(0))
+ Expect(beforeRestart).Should(Exit(0))
session = podmanTest.Podman([]string{"restart", "host-restart-test"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
afterRestart := podmanTest.Podman(testCmd)
afterRestart.WaitWithDefaultTimeout()
- Expect(afterRestart.ExitCode()).To(Equal(0))
+ Expect(afterRestart).Should(Exit(0))
// line count should be equal
Expect(beforeRestart.OutputToString()).To(Equal(afterRestart.OutputToString()))
@@ -229,22 +230,22 @@ var _ = Describe("Podman restart", func() {
It("podman restart --all", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
session = podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(2))
session = podmanTest.Podman([]string{"stop", "--all"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
session = podmanTest.Podman([]string{"restart", "--all"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(2))
})
})
diff --git a/test/e2e/rm_test.go b/test/e2e/rm_test.go
index 788d14141..ec4dce752 100644
--- a/test/e2e/rm_test.go
+++ b/test/e2e/rm_test.go
@@ -7,6 +7,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman rm", func() {
@@ -39,93 +40,93 @@ var _ = Describe("Podman rm", func() {
result := podmanTest.Podman([]string{"rm", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
})
It("podman rm refuse to remove a running container", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
result := podmanTest.Podman([]string{"rm", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(2))
+ Expect(result).Should(Exit(2))
})
It("podman rm created container", func() {
session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
result := podmanTest.Podman([]string{"rm", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
})
It("podman container rm created container", func() {
session := podmanTest.Podman([]string{"container", "create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
result := podmanTest.Podman([]string{"container", "rm", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
})
It("podman rm running container with -f", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
result := podmanTest.Podman([]string{"rm", "-f", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
})
It("podman rm all containers", func() {
session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"rm", "-a"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
})
It("podman rm all containers with one running and short options", func() {
session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"rm", "-af"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
})
It("podman rm the latest container", func() {
session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
_, ec, cid := podmanTest.RunLsContainer("test1")
Expect(ec).To(Equal(0))
@@ -136,7 +137,7 @@ var _ = Describe("Podman rm", func() {
}
result := podmanTest.Podman([]string{"rm", latest})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
output := result.OutputToString()
Expect(output).To(ContainSubstring(cid))
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
@@ -153,13 +154,13 @@ var _ = Describe("Podman rm", func() {
session := podmanTest.Podman([]string{"create", "--cidfile", tmpFile, ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToStringArray()[0]
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
result := podmanTest.Podman([]string{"rm", "--cidfile", tmpFile})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
output := result.OutputToString()
Expect(output).To(ContainSubstring(cid))
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
@@ -176,19 +177,19 @@ var _ = Describe("Podman rm", func() {
session := podmanTest.Podman([]string{"create", "--cidfile", tmpFile1, ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid1 := session.OutputToStringArray()[0]
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
session = podmanTest.Podman([]string{"create", "--cidfile", tmpFile2, ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid2 := session.OutputToStringArray()[0]
Expect(podmanTest.NumberOfContainers()).To(Equal(2))
result := podmanTest.Podman([]string{"rm", "--cidfile", tmpFile1, "--cidfile", tmpFile2})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
output := result.OutputToString()
Expect(output).To(ContainSubstring(cid1))
Expect(output).To(ContainSubstring(cid2))
@@ -200,86 +201,86 @@ var _ = Describe("Podman rm", func() {
result := podmanTest.Podman([]string{"rm", "--cidfile", "foobar", "--latest"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(125))
+ Expect(result).Should(Exit(125))
result = podmanTest.Podman([]string{"rm", "--cidfile", "foobar", "--all"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(125))
+ Expect(result).Should(Exit(125))
result = podmanTest.Podman([]string{"rm", "--cidfile", "foobar", "--all", "--latest"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(125))
+ Expect(result).Should(Exit(125))
result = podmanTest.Podman([]string{"rm", "--latest", "--all"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(125))
+ Expect(result).Should(Exit(125))
})
It("podman rm --all", func() {
session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
session = podmanTest.Podman([]string{"create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(2))
session = podmanTest.Podman([]string{"rm", "--all"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
})
It("podman rm --ignore", func() {
session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToStringArray()[0]
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
session = podmanTest.Podman([]string{"rm", "bogus", cid})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(1))
+ Expect(session).Should(Exit(1))
session = podmanTest.Podman([]string{"rm", "--ignore", "bogus", cid})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
})
It("podman rm bogus container", func() {
session := podmanTest.Podman([]string{"rm", "bogus"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(1))
+ Expect(session).Should(Exit(1))
})
It("podman rm bogus container and a running container", func() {
session := podmanTest.RunTopContainer("test1")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"rm", "bogus", "test1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(1))
+ Expect(session).Should(Exit(1))
session = podmanTest.Podman([]string{"rm", "test1", "bogus"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(1))
+ Expect(session).Should(Exit(1))
})
It("podman rm --ignore bogus container and a running container", func() {
session := podmanTest.RunTopContainer("test1")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"rm", "--force", "--ignore", "bogus", "test1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"rm", "--ignore", "test1", "bogus"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
})
diff --git a/test/e2e/run_apparmor_test.go b/test/e2e/run_apparmor_test.go
index 1f9b9bc90..6532402ed 100644
--- a/test/e2e/run_apparmor_test.go
+++ b/test/e2e/run_apparmor_test.go
@@ -12,6 +12,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
// wip
@@ -54,7 +55,7 @@ var _ = Describe("Podman run", func() {
skipIfAppArmorDisabled()
session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
// Verify that apparmor.Profile is being set
@@ -66,7 +67,7 @@ var _ = Describe("Podman run", func() {
skipIfAppArmorDisabled()
session := podmanTest.Podman([]string{"create", "--privileged", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
// Verify that apparmor.Profile is being set
@@ -78,7 +79,7 @@ var _ = Describe("Podman run", func() {
skipIfAppArmorDisabled()
session := podmanTest.Podman([]string{"create", "--security-opt", fmt.Sprintf("apparmor=%s", apparmor.Profile), "--privileged", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
// Verify that apparmor.Profile is being set
@@ -105,11 +106,11 @@ profile aa-test-profile flags=(attach_disconnected,mediate_deleted) {
aaFile := filepath.Join(os.TempDir(), "aaFile")
Expect(ioutil.WriteFile(aaFile, []byte(aaProfile), 0755)).To(BeNil())
parse := SystemExec("apparmor_parser", []string{"-Kr", aaFile})
- Expect(parse.ExitCode()).To(Equal(0))
+ Expect(parse).Should(Exit(0))
session := podmanTest.Podman([]string{"create", "--security-opt", "apparmor=aa-test-profile", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
// Verify that apparmor.Profile is being set
@@ -121,14 +122,14 @@ profile aa-test-profile flags=(attach_disconnected,mediate_deleted) {
skipIfAppArmorDisabled()
session := podmanTest.Podman([]string{"run", "--security-opt", "apparmor=invalid", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).ToNot(Equal(0))
+ Expect(session).To(ExitWithError())
})
It("podman run apparmor unconfined", func() {
skipIfAppArmorDisabled()
session := podmanTest.Podman([]string{"create", "--security-opt", "apparmor=unconfined", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
// Verify that apparmor.Profile is being set
@@ -141,7 +142,7 @@ profile aa-test-profile flags=(attach_disconnected,mediate_deleted) {
// Should fail if user specifies apparmor on disabled system
session := podmanTest.Podman([]string{"create", "--security-opt", fmt.Sprintf("apparmor=%s", apparmor.Profile), ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).ToNot(Equal(0))
+ Expect(session).To(ExitWithError())
})
It("podman run apparmor disabled no default", func() {
@@ -149,7 +150,7 @@ profile aa-test-profile flags=(attach_disconnected,mediate_deleted) {
// Should succeed if user specifies apparmor on disabled system
session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
// Verify that apparmor.Profile is being set
@@ -162,7 +163,7 @@ profile aa-test-profile flags=(attach_disconnected,mediate_deleted) {
session := podmanTest.Podman([]string{"create", "--security-opt", "apparmor=unconfined", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
// Verify that apparmor.Profile is being set
diff --git a/test/e2e/run_cgroup_parent_test.go b/test/e2e/run_cgroup_parent_test.go
index 1df4c4033..300c3a8e0 100644
--- a/test/e2e/run_cgroup_parent_test.go
+++ b/test/e2e/run_cgroup_parent_test.go
@@ -9,6 +9,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman run with --cgroup-parent", func() {
@@ -43,7 +44,7 @@ var _ = Describe("Podman run with --cgroup-parent", func() {
cgroup := "/zzz"
run := podmanTest.Podman([]string{"run", "--cgroupns=host", "--cgroup-parent", cgroup, fedoraMinimal, "cat", "/proc/self/cgroup"})
run.WaitWithDefaultTimeout()
- Expect(run.ExitCode()).To(Equal(0))
+ Expect(run).Should(Exit(0))
ok, _ := run.GrepString(cgroup)
Expect(ok).To(BeTrue())
})
@@ -56,7 +57,7 @@ var _ = Describe("Podman run with --cgroup-parent", func() {
}
run := podmanTest.Podman([]string{"run", "--cgroupns=host", fedoraMinimal, "cat", "/proc/self/cgroup"})
run.WaitWithDefaultTimeout()
- Expect(run.ExitCode()).To(Equal(0))
+ Expect(run).Should(Exit(0))
ok, _ := run.GrepString(cgroup)
Expect(ok).To(BeTrue())
})
@@ -72,22 +73,22 @@ var _ = Describe("Podman run with --cgroup-parent", func() {
run := podmanTest.Podman([]string{"run", "-d", "--cgroupns=host", fedoraMinimal, "sleep", "100"})
run.WaitWithDefaultTimeout()
- Expect(run.ExitCode()).To(Equal(0))
+ Expect(run).Should(Exit(0))
cid := run.OutputToString()
exec := podmanTest.Podman([]string{"exec", cid, "cat", "/proc/self/cgroup"})
exec.WaitWithDefaultTimeout()
- Expect(exec.ExitCode()).To(Equal(0))
+ Expect(exec).Should(Exit(0))
cgroup := filepath.Dir(strings.TrimRight(strings.Replace(exec.OutputToString(), "0::", "", -1), "\n"))
run = podmanTest.Podman([]string{"--cgroup-manager=cgroupfs", "run", "-d", fmt.Sprintf("--cgroup-parent=%s", cgroup), fedoraMinimal, "sleep", "100"})
run.WaitWithDefaultTimeout()
- Expect(run.ExitCode()).To(Equal(0))
+ Expect(run).Should(Exit(0))
exec = podmanTest.Podman([]string{"exec", cid, "cat", "/proc/self/cgroup"})
exec.WaitWithDefaultTimeout()
- Expect(exec.ExitCode()).To(Equal(0))
+ Expect(exec).Should(Exit(0))
cgroupEffective := filepath.Dir(strings.TrimRight(strings.Replace(exec.OutputToString(), "0::", "", -1), "\n"))
Expect(cgroupEffective).To(Equal(cgroup))
@@ -100,7 +101,7 @@ var _ = Describe("Podman run with --cgroup-parent", func() {
cgroup := "aaaa.slice"
run := podmanTest.Podman([]string{"run", "--cgroupns=host", "--cgroup-parent", cgroup, fedoraMinimal, "cat", "/proc/1/cgroup"})
run.WaitWithDefaultTimeout()
- Expect(run.ExitCode()).To(Equal(0))
+ Expect(run).Should(Exit(0))
ok, _ := run.GrepString(cgroup)
Expect(ok).To(BeTrue())
})
diff --git a/test/e2e/run_cleanup_test.go b/test/e2e/run_cleanup_test.go
index 2dfaf1329..cfe11079d 100644
--- a/test/e2e/run_cleanup_test.go
+++ b/test/e2e/run_cleanup_test.go
@@ -6,6 +6,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman run exit", func() {
@@ -39,33 +40,33 @@ var _ = Describe("Podman run exit", func() {
result := podmanTest.Podman([]string{"run", "-dt", ALPINE, "top"})
result.WaitWithDefaultTimeout()
cid := result.OutputToString()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
mount := SystemExec("mount", nil)
- Expect(mount.ExitCode()).To(Equal(0))
+ Expect(mount).Should(Exit(0))
Expect(mount.OutputToString()).To(ContainSubstring(cid))
pmount := podmanTest.Podman([]string{"mount", "--notruncate"})
pmount.WaitWithDefaultTimeout()
- Expect(pmount.ExitCode()).To(Equal(0))
+ Expect(pmount).Should(Exit(0))
Expect(pmount.OutputToString()).To(ContainSubstring(cid))
stop := podmanTest.Podman([]string{"stop", cid})
stop.WaitWithDefaultTimeout()
- Expect(stop.ExitCode()).To(Equal(0))
+ Expect(stop).Should(Exit(0))
// We have to force cleanup so the unmount happens
podmanCleanupSession := podmanTest.Podman([]string{"container", "cleanup", cid})
podmanCleanupSession.WaitWithDefaultTimeout()
- Expect(podmanCleanupSession.ExitCode()).To(Equal(0))
+ Expect(podmanCleanupSession).Should(Exit(0))
mount = SystemExec("mount", nil)
- Expect(mount.ExitCode()).To(Equal(0))
+ Expect(mount).Should(Exit(0))
Expect(mount.OutputToString()).NotTo(ContainSubstring(cid))
pmount = podmanTest.Podman([]string{"mount", "--notruncate"})
pmount.WaitWithDefaultTimeout()
- Expect(pmount.ExitCode()).To(Equal(0))
+ Expect(pmount).Should(Exit(0))
Expect(pmount.OutputToString()).NotTo(ContainSubstring(cid))
})
diff --git a/test/e2e/run_cpu_test.go b/test/e2e/run_cpu_test.go
index 2f4452ba4..6dbb5886d 100644
--- a/test/e2e/run_cpu_test.go
+++ b/test/e2e/run_cpu_test.go
@@ -7,6 +7,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman run cpu", func() {
@@ -50,7 +51,7 @@ var _ = Describe("Podman run cpu", func() {
result = podmanTest.Podman([]string{"run", "--rm", "--cpu-period=5000", ALPINE, "cat", "/sys/fs/cgroup/cpu/cpu.cfs_period_us"})
}
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.LineInOutputContains("5000")).To(BeTrue())
})
@@ -63,7 +64,7 @@ var _ = Describe("Podman run cpu", func() {
result = podmanTest.Podman([]string{"run", "--rm", "--cpu-quota=5000", ALPINE, "cat", "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"})
}
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.LineInOutputContains("5000")).To(BeTrue())
})
@@ -71,17 +72,17 @@ var _ = Describe("Podman run cpu", func() {
if CGROUPSV2 {
result := podmanTest.Podman([]string{"run", "--rm", "--cpu-quota=5000", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/cpu.max"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(Equal("5000 100000"))
} else {
result := podmanTest.Podman([]string{"run", "--rm", "--cpus=0.5", ALPINE, "cat", "/sys/fs/cgroup/cpu/cpu.cfs_period_us"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(Equal("100000"))
result = podmanTest.Podman([]string{"run", "--rm", "--cpus=0.5", ALPINE, "cat", "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(Equal("50000"))
}
})
@@ -91,12 +92,12 @@ var _ = Describe("Podman run cpu", func() {
// [2-262144] is mapped to [1-10000]
result := podmanTest.Podman([]string{"run", "--rm", "--cpu-shares=262144", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/cpu.weight"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(Equal("10000"))
} else {
result := podmanTest.Podman([]string{"run", "--rm", "--cpu-shares=2", ALPINE, "cat", "/sys/fs/cgroup/cpu/cpu.shares"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(Equal("2"))
}
})
@@ -110,7 +111,7 @@ var _ = Describe("Podman run cpu", func() {
result = podmanTest.Podman([]string{"run", "--rm", "--cpuset-cpus=0", ALPINE, "cat", "/sys/fs/cgroup/cpuset/cpuset.cpus"})
}
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(Equal("0"))
})
@@ -123,7 +124,7 @@ var _ = Describe("Podman run cpu", func() {
result = podmanTest.Podman([]string{"run", "--rm", "--cpuset-mems=0", ALPINE, "cat", "/sys/fs/cgroup/cpuset/cpuset.mems"})
}
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(Equal("0"))
})
diff --git a/test/e2e/run_device_test.go b/test/e2e/run_device_test.go
index 735e44d3e..40de1d50d 100644
--- a/test/e2e/run_device_test.go
+++ b/test/e2e/run_device_test.go
@@ -7,6 +7,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman run device", func() {
@@ -42,28 +43,28 @@ var _ = Describe("Podman run device", func() {
It("podman run device test", func() {
session := podmanTest.Podman([]string{"run", "-q", "--security-opt", "label=disable", "--device", "/dev/kmsg", ALPINE, "ls", "--color=never", "/dev/kmsg"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("/dev/kmsg"))
})
It("podman run device rename test", func() {
session := podmanTest.Podman([]string{"run", "-q", "--security-opt", "label=disable", "--device", "/dev/kmsg:/dev/kmsg1", ALPINE, "ls", "--color=never", "/dev/kmsg1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("/dev/kmsg1"))
})
It("podman run device permission test", func() {
session := podmanTest.Podman([]string{"run", "-q", "--security-opt", "label=disable", "--device", "/dev/kmsg:r", ALPINE, "ls", "--color=never", "/dev/kmsg"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("/dev/kmsg"))
})
It("podman run device rename and permission test", func() {
session := podmanTest.Podman([]string{"run", "-q", "--security-opt", "label=disable", "--device", "/dev/kmsg:/dev/kmsg1:r", ALPINE, "ls", "--color=never", "/dev/kmsg1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("/dev/kmsg1"))
})
It("podman run device rename and bad permission test", func() {
@@ -79,11 +80,11 @@ var _ = Describe("Podman run device", func() {
mknod := SystemExec("mknod", []string{"/dev/foodevdir/null", "c", "1", "3"})
mknod.WaitWithDefaultTimeout()
- Expect(mknod.ExitCode()).To(Equal(0))
+ Expect(mknod).Should(Exit(0))
session := podmanTest.Podman([]string{"run", "-q", "--device", "/dev/foodevdir:/dev/bar", ALPINE, "stat", "-c%t:%T", "/dev/bar/null"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("1:3"))
})
@@ -93,7 +94,7 @@ var _ = Describe("Podman run device", func() {
}
session := podmanTest.Podman([]string{"run", "--privileged", ALPINE, "ls", "/dev/kvm"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman run CDI device test", func() {
@@ -110,13 +111,13 @@ var _ = Describe("Podman run device", func() {
session := podmanTest.Podman([]string{"run", "-q", "--security-opt", "label=disable", "--device", "myKmsg", ALPINE, "ls", "--color=never", "/dev/kmsg1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("/dev/kmsg1"))
})
It("podman run --gpus noop", func() {
session := podmanTest.Podman([]string{"run", "--gpus", "all", ALPINE, "ls", "/"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
})
diff --git a/test/e2e/run_dns_test.go b/test/e2e/run_dns_test.go
index 05f8c3f99..166160ad2 100644
--- a/test/e2e/run_dns_test.go
+++ b/test/e2e/run_dns_test.go
@@ -6,6 +6,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman run dns", func() {
@@ -35,14 +36,14 @@ var _ = Describe("Podman run dns", func() {
It("podman run add search domain", func() {
session := podmanTest.Podman([]string{"run", "--dns-search=foobar.com", ALPINE, "cat", "/etc/resolv.conf"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session.LineInOutputStartsWith("search foobar.com")
})
It("podman run remove all search domain", func() {
session := podmanTest.Podman([]string{"run", "--dns-search=.", ALPINE, "cat", "/etc/resolv.conf"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.LineInOutputStartsWith("search")).To(BeFalse())
})
@@ -55,14 +56,14 @@ var _ = Describe("Podman run dns", func() {
It("podman run add dns server", func() {
session := podmanTest.Podman([]string{"run", "--dns=1.2.3.4", ALPINE, "cat", "/etc/resolv.conf"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session.LineInOutputStartsWith("server 1.2.3.4")
})
It("podman run add dns option", func() {
session := podmanTest.Podman([]string{"run", "--dns-opt=debug", ALPINE, "cat", "/etc/resolv.conf"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session.LineInOutputStartsWith("options debug")
})
@@ -75,7 +76,7 @@ var _ = Describe("Podman run dns", func() {
It("podman run add host", func() {
session := podmanTest.Podman([]string{"run", "--add-host=foobar:1.1.1.1", "--add-host=foobaz:2001:db8::68", ALPINE, "cat", "/etc/hosts"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session.LineInOutputStartsWith("1.1.1.1 foobar")
session.LineInOutputStartsWith("2001:db8::68 foobaz")
})
@@ -83,19 +84,19 @@ var _ = Describe("Podman run dns", func() {
It("podman run add hostname", func() {
session := podmanTest.Podman([]string{"run", "--hostname=foobar", ALPINE, "cat", "/etc/hostname"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("foobar"))
session = podmanTest.Podman([]string{"run", "--hostname=foobar", ALPINE, "hostname"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("foobar"))
})
It("podman run add hostname sets /etc/hosts", func() {
session := podmanTest.Podman([]string{"run", "-t", "-i", "--hostname=foobar", ALPINE, "cat", "/etc/hosts"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.LineInOutputContains("foobar")).To(BeTrue())
})
@@ -114,6 +115,6 @@ var _ = Describe("Podman run dns", func() {
session = podmanTest.Podman([]string{"run", "--dns=1.2.3.4", "--network", "host", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To((Equal(0)))
+ Expect(session).Should(Exit(0))
})
})
diff --git a/test/e2e/run_entrypoint_test.go b/test/e2e/run_entrypoint_test.go
index ddad89c85..9560b1627 100644
--- a/test/e2e/run_entrypoint_test.go
+++ b/test/e2e/run_entrypoint_test.go
@@ -6,6 +6,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman run entrypoint", func() {
@@ -40,7 +41,7 @@ CMD []
podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest", "false")
session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
It("podman run entrypoint == [\"\"]", func() {
@@ -51,7 +52,7 @@ CMD []
podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest", "false")
session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest", "echo", "hello"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("hello"))
})
@@ -62,7 +63,7 @@ ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest", "false")
session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(2))
})
@@ -74,7 +75,7 @@ ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest", "false")
session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(4))
})
@@ -86,7 +87,7 @@ ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest", "false")
session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest", "-i"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(5))
})
@@ -97,7 +98,7 @@ ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest", "false")
session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest", "-i"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(5))
})
@@ -110,12 +111,12 @@ ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest", "false")
session := podmanTest.Podman([]string{"run", "--entrypoint=uname", "foobar.com/entrypoint:latest"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.LineInOutputStartsWith("Linux")).To(BeTrue())
session = podmanTest.Podman([]string{"run", "--entrypoint", "", "foobar.com/entrypoint:latest", "uname"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.LineInOutputStartsWith("Linux")).To(BeTrue())
})
@@ -127,7 +128,7 @@ ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest", "false")
session := podmanTest.Podman([]string{"run", "--entrypoint=uname", "foobar.com/entrypoint:latest", "-r"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.LineInOutputStartsWith("Linux")).To(BeFalse())
})
})
diff --git a/test/e2e/run_env_test.go b/test/e2e/run_env_test.go
index 83d8e8da6..9324c1957 100644
--- a/test/e2e/run_env_test.go
+++ b/test/e2e/run_env_test.go
@@ -6,6 +6,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman run", func() {
@@ -35,38 +36,38 @@ var _ = Describe("Podman run", func() {
It("podman run environment test", func() {
session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "printenv", "HOME"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ := session.GrepString("/root")
Expect(match).Should(BeTrue())
session = podmanTest.Podman([]string{"run", "--rm", "--user", "2", ALPINE, "printenv", "HOME"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ = session.GrepString("/sbin")
Expect(match).Should(BeTrue())
session = podmanTest.Podman([]string{"run", "--rm", "--env", "HOME=/foo", ALPINE, "printenv", "HOME"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ = session.GrepString("/foo")
Expect(match).Should(BeTrue())
session = podmanTest.Podman([]string{"run", "--rm", "--env", "FOO=BAR,BAZ", ALPINE, "printenv", "FOO"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ = session.GrepString("BAR,BAZ")
Expect(match).Should(BeTrue())
session = podmanTest.Podman([]string{"run", "--rm", "--env", "PATH=/bin", ALPINE, "printenv", "PATH"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ = session.GrepString("/bin")
Expect(match).Should(BeTrue())
os.Setenv("FOO", "BAR")
session = podmanTest.Podman([]string{"run", "--rm", "--env", "FOO", ALPINE, "printenv", "FOO"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ = session.GrepString("BAR")
Expect(match).Should(BeTrue())
os.Unsetenv("FOO")
@@ -74,17 +75,17 @@ var _ = Describe("Podman run", func() {
session = podmanTest.Podman([]string{"run", "--rm", "--env", "FOO", ALPINE, "printenv", "FOO"})
session.WaitWithDefaultTimeout()
Expect(len(session.OutputToString())).To(Equal(0))
- Expect(session.ExitCode()).To(Equal(1))
+ Expect(session).Should(Exit(1))
session = podmanTest.Podman([]string{"run", "--rm", ALPINE, "printenv"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// This currently does not work
// Re-enable when hostname is an env variable
session = podmanTest.Podman([]string{"run", "--rm", ALPINE, "sh", "-c", "printenv"})
session.Wait(10)
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ = session.GrepString("HOSTNAME")
Expect(match).Should(BeTrue())
})
@@ -95,17 +96,17 @@ var _ = Describe("Podman run", func() {
session.WaitWithDefaultTimeout()
if IsRemote() {
// podman-remote does not support --env-host
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
Expect(session.ErrorToString()).To(ContainSubstring("unknown flag: --env-host"))
return
}
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ := session.GrepString("BAR")
Expect(match).Should(BeTrue())
session = podmanTest.PodmanAsUser([]string{"run", "--rm", "--env", "FOO=BAR1", "--env-host", ALPINE, "/bin/printenv", "FOO"}, 0, 0, "", env)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ = session.GrepString("BAR1")
Expect(match).Should(BeTrue())
os.Unsetenv("FOO")
@@ -119,25 +120,25 @@ var _ = Describe("Podman run", func() {
}
session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "printenv", "http_proxy"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ := session.GrepString("1.2.3.4")
Expect(match).Should(BeTrue())
session = podmanTest.Podman([]string{"run", "--http-proxy=false", ALPINE, "printenv", "http_proxy"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(1))
+ Expect(session).Should(Exit(1))
Expect(session.OutputToString()).To(Equal(""))
session = podmanTest.Podman([]string{"run", "--env", "http_proxy=5.6.7.8", ALPINE, "printenv", "http_proxy"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ = session.GrepString("5.6.7.8")
Expect(match).Should(BeTrue())
os.Unsetenv("http_proxy")
session = podmanTest.Podman([]string{"run", "--http-proxy=false", "--env", "http_proxy=5.6.7.8", ALPINE, "printenv", "http_proxy"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ = session.GrepString("5.6.7.8")
Expect(match).Should(BeTrue())
os.Unsetenv("http_proxy")
diff --git a/test/e2e/run_exit_test.go b/test/e2e/run_exit_test.go
index 3d969cbc2..21f1a8650 100644
--- a/test/e2e/run_exit_test.go
+++ b/test/e2e/run_exit_test.go
@@ -7,6 +7,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman run exit", func() {
@@ -36,13 +37,13 @@ var _ = Describe("Podman run exit", func() {
It("podman run exit define.ExecErrorCodeGeneric", func() {
result := podmanTest.Podman([]string{"run", "--foobar", ALPINE, "ls", "$tmp"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(define.ExecErrorCodeGeneric))
+ Expect(result).Should(Exit(define.ExecErrorCodeGeneric))
})
It("podman run exit ExecErrorCodeCannotInvoke", func() {
result := podmanTest.Podman([]string{"run", ALPINE, "/etc"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(define.ExecErrorCodeCannotInvoke))
+ Expect(result).Should(Exit(define.ExecErrorCodeCannotInvoke))
})
It("podman run exit ExecErrorCodeNotFound", func() {
@@ -52,18 +53,18 @@ var _ = Describe("Podman run exit", func() {
// TODO This is failing we believe because of a race condition
// Between conmon and podman closing the socket early.
// Test with the following, once the race condition is solved
- // Expect(result.ExitCode()).To(Equal(define.ExecErrorCodeNotFound))
+ // Expect(result).Should(Exit(define.ExecErrorCodeNotFound))
})
It("podman run exit 0", func() {
result := podmanTest.Podman([]string{"run", ALPINE, "ls"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
})
It("podman run exit 50", func() {
result := podmanTest.Podman([]string{"run", ALPINE, "sh", "-c", "exit 50"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(50))
+ Expect(result).Should(Exit(50))
})
})
diff --git a/test/e2e/run_memory_test.go b/test/e2e/run_memory_test.go
index cb13993f4..e2f2937ba 100644
--- a/test/e2e/run_memory_test.go
+++ b/test/e2e/run_memory_test.go
@@ -7,6 +7,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman run memory", func() {
@@ -44,7 +45,7 @@ var _ = Describe("Podman run memory", func() {
session = podmanTest.Podman([]string{"run", "--memory=40m", ALPINE, "cat", "/sys/fs/cgroup/memory/memory.limit_in_bytes"})
}
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("41943040"))
})
@@ -62,7 +63,7 @@ var _ = Describe("Podman run memory", func() {
}
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("41943040"))
})
@@ -70,7 +71,7 @@ var _ = Describe("Podman run memory", func() {
SkipIfCgroupV2("memory-swappiness not supported on cgroupV2")
session := podmanTest.Podman([]string{"run", "--memory-swappiness=15", ALPINE, "cat", "/sys/fs/cgroup/memory/memory.swappiness"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("15"))
})
@@ -88,7 +89,7 @@ var _ = Describe("Podman run memory", func() {
}
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("41943040"))
})
@@ -103,7 +104,7 @@ var _ = Describe("Podman run memory", func() {
session = podmanTest.Podman([]string{"run", "--cgroupns=private", ALPINE, "cat", "/sys/fs/cgroup/memory/memory.memsw.limit_in_bytes"})
}
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
output := session.OutputToString()
Expect(err).To(BeNil())
if CGROUPSV2 {
diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go
index 696cec76c..80a82ea05 100644
--- a/test/e2e/run_networking_test.go
+++ b/test/e2e/run_networking_test.go
@@ -9,6 +9,7 @@ import (
"github.com/containers/storage/pkg/stringid"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
"github.com/uber/jaeger-client-go/utils"
)
@@ -40,47 +41,47 @@ var _ = Describe("Podman run networking", func() {
It("podman run network connection with default bridge", func() {
session := podmanTest.Podman([]string{"run", "-dt", ALPINE, "wget", "www.podman.io"})
session.Wait(90)
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman run network connection with host", func() {
session := podmanTest.Podman([]string{"run", "-dt", "--network", "host", ALPINE, "wget", "www.podman.io"})
session.Wait(90)
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman run network connection with default", func() {
session := podmanTest.Podman([]string{"run", "--network", "default", ALPINE, "wget", "www.podman.io"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman run network connection with none", func() {
session := podmanTest.Podman([]string{"run", "--network", "none", ALPINE, "wget", "www.podman.io"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(1))
+ Expect(session).Should(Exit(1))
Expect(session.ErrorToString()).To(ContainSubstring("wget: bad address 'www.podman.io'"))
})
It("podman run network connection with private", func() {
session := podmanTest.Podman([]string{"run", "--network", "private", ALPINE, "wget", "www.podman.io"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman run network connection with loopback", func() {
session := podmanTest.Podman([]string{"run", "--network", "host", ALPINE, "wget", "www.podman.io"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman run network expose port 222", func() {
SkipIfRootless("iptables is not supported for rootless users")
session := podmanTest.Podman([]string{"run", "-dt", "--expose", "222-223", "-P", ALPINE, "/bin/sh"})
session.Wait(30)
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
results := SystemExec("iptables", []string{"-t", "nat", "-L"})
- Expect(results.ExitCode()).To(Equal(0))
+ Expect(results).Should(Exit(0))
Expect(results.OutputToString()).To(ContainSubstring("222"))
Expect(results.OutputToString()).To(ContainSubstring("223"))
})
@@ -338,9 +339,9 @@ var _ = Describe("Podman run networking", func() {
SkipIfRootless("iptables is not supported for rootless users")
session := podmanTest.Podman([]string{"run", "-dt", "-p", "80:8000", ALPINE, "/bin/sh"})
session.Wait(30)
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
results := SystemExec("iptables", []string{"-t", "nat", "-L"})
- Expect(results.ExitCode()).To(Equal(0))
+ Expect(results).Should(Exit(0))
Expect(results.OutputToString()).To(ContainSubstring("8000"))
ncBusy := SystemExec("nc", []string{"-l", "-p", "80"})
@@ -350,7 +351,7 @@ var _ = Describe("Podman run networking", func() {
It("podman run network expose host port 8081 to container port 8000 using rootlesskit port handler", func() {
session := podmanTest.Podman([]string{"run", "--network", "slirp4netns:port_handler=rootlesskit", "-dt", "-p", "8081:8000", ALPINE, "/bin/sh"})
session.Wait(30)
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
ncBusy := SystemExec("nc", []string{"-l", "-p", "8081"})
Expect(ncBusy).To(ExitWithError())
@@ -359,7 +360,7 @@ var _ = Describe("Podman run networking", func() {
It("podman run network expose host port 8082 to container port 8000 using slirp4netns port handler", func() {
session := podmanTest.Podman([]string{"run", "--network", "slirp4netns:port_handler=slirp4netns", "-dt", "-p", "8082:8000", ALPINE, "/bin/sh"})
session.Wait(30)
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
ncBusy := SystemExec("nc", []string{"-l", "-p", "8082"})
Expect(ncBusy).To(ExitWithError())
})
@@ -367,41 +368,41 @@ var _ = Describe("Podman run networking", func() {
It("podman run network expose host port 8080 to container port 8000 using invalid port handler", func() {
session := podmanTest.Podman([]string{"run", "--network", "slirp4netns:port_handler=invalid", "-dt", "-p", "8080:8000", ALPINE, "/bin/sh"})
session.Wait(30)
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
})
It("podman run slirp4netns network with host loopback", func() {
session := podmanTest.Podman([]string{"run", "--network", "slirp4netns:allow_host_loopback=true", ALPINE, "ping", "-c1", "10.0.2.2"})
session.Wait(30)
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman run slirp4netns network with mtu", func() {
session := podmanTest.Podman([]string{"run", "--network", "slirp4netns:mtu=9000", ALPINE, "ip", "addr"})
session.Wait(30)
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("mtu 9000"))
})
It("podman run slirp4netns network with different cidr", func() {
slirp4netnsHelp := SystemExec("slirp4netns", []string{"--help"})
- Expect(slirp4netnsHelp.ExitCode()).To(Equal(0))
+ Expect(slirp4netnsHelp).Should(Exit(0))
networkConfiguration := "slirp4netns:cidr=192.168.0.0/24,allow_host_loopback=true"
session := podmanTest.Podman([]string{"run", "--network", networkConfiguration, ALPINE, "ping", "-c1", "192.168.0.2"})
session.Wait(30)
if strings.Contains(slirp4netnsHelp.OutputToString(), "cidr") {
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
} else {
- Expect(session.ExitCode()).ToNot(Equal(0))
+ Expect(session).To(ExitWithError())
Expect(session.ErrorToString()).To(ContainSubstring("cidr not supported"))
}
})
It("podman run network bind to 127.0.0.1", func() {
slirp4netnsHelp := SystemExec("slirp4netns", []string{"--help"})
- Expect(slirp4netnsHelp.ExitCode()).To(Equal(0))
+ Expect(slirp4netnsHelp).Should(Exit(0))
networkConfiguration := "slirp4netns:outbound_addr=127.0.0.1,allow_host_loopback=true"
if strings.Contains(slirp4netnsHelp.OutputToString(), "outbound-addr") {
@@ -410,13 +411,13 @@ var _ = Describe("Podman run networking", func() {
session.Wait(30)
ncListener.Wait(30)
- Expect(session.ExitCode()).To(Equal(0))
- Expect(ncListener.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
+ Expect(ncListener).Should(Exit(0))
Expect(ncListener.ErrorToString()).To(ContainSubstring("127.0.0.1"))
} else {
session := podmanTest.Podman([]string{"run", "--network", networkConfiguration, "-dt", ALPINE, "nc", "-w", "2", "10.0.2.2", "8083"})
session.Wait(30)
- Expect(session.ExitCode()).ToNot(Equal(0))
+ Expect(session).To(ExitWithError())
Expect(session.ErrorToString()).To(ContainSubstring("outbound_addr not supported"))
}
})
@@ -426,7 +427,7 @@ var _ = Describe("Podman run networking", func() {
Expect(err).To(BeNil())
slirp4netnsHelp := SystemExec("slirp4netns", []string{"--help"})
- Expect(slirp4netnsHelp.ExitCode()).To(Equal(0))
+ Expect(slirp4netnsHelp).Should(Exit(0))
networkConfiguration := fmt.Sprintf("slirp4netns:outbound_addr=%s,allow_host_loopback=true", ip.String())
if strings.Contains(slirp4netnsHelp.OutputToString(), "outbound-addr") {
@@ -435,13 +436,13 @@ var _ = Describe("Podman run networking", func() {
session.Wait(30)
ncListener.Wait(30)
- Expect(session.ExitCode()).To(Equal(0))
- Expect(ncListener.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
+ Expect(ncListener).Should(Exit(0))
Expect(ncListener.ErrorToString()).To(ContainSubstring(ip.String()))
} else {
session := podmanTest.Podman([]string{"run", "--network", networkConfiguration, "-dt", ALPINE, "nc", "-w", "2", "10.0.2.2", "8084"})
session.Wait(30)
- Expect(session.ExitCode()).ToNot(Equal(0))
+ Expect(session).To(ExitWithError())
Expect(session.ErrorToString()).To(ContainSubstring("outbound_addr not supported"))
}
})
@@ -449,10 +450,10 @@ var _ = Describe("Podman run networking", func() {
It("podman run network expose ports in image metadata", func() {
session := podmanTest.Podman([]string{"create", "--name", "test", "-t", "-P", nginx})
session.Wait(90)
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
results := podmanTest.Podman([]string{"inspect", "test"})
results.Wait(30)
- Expect(results.ExitCode()).To(Equal(0))
+ Expect(results).Should(Exit(0))
Expect(results.OutputToString()).To(ContainSubstring(`"80/tcp":`))
})
@@ -461,11 +462,11 @@ var _ = Describe("Podman run networking", func() {
session := podmanTest.Podman([]string{"run", "--name", "test", "-dt", "-p", "80", ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", "test"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
containerConfig := inspect.InspectContainerToJSON()
Expect(containerConfig[0].NetworkSettings.Ports).To(Not(BeNil()))
@@ -476,7 +477,7 @@ var _ = Describe("Podman run networking", func() {
It("podman run hostname test", func() {
session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "printenv", "HOSTNAME"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ := session.GrepString(hostname)
Expect(match).Should(BeFalse())
})
@@ -484,21 +485,21 @@ var _ = Describe("Podman run networking", func() {
It("podman run --net host hostname test", func() {
session := podmanTest.Podman([]string{"run", "--rm", "--net", "host", ALPINE, "printenv", "HOSTNAME"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ := session.GrepString(hostname)
Expect(match).Should(BeTrue())
})
It("podman run --net host --uts host hostname test", func() {
session := podmanTest.Podman([]string{"run", "--rm", "--net", "host", "--uts", "host", ALPINE, "printenv", "HOSTNAME"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ := session.GrepString(hostname)
Expect(match).Should(BeTrue())
})
It("podman run --uts host hostname test", func() {
session := podmanTest.Podman([]string{"run", "--rm", "--uts", "host", ALPINE, "printenv", "HOSTNAME"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ := session.GrepString(hostname)
Expect(match).Should(BeTrue())
})
@@ -506,7 +507,7 @@ var _ = Describe("Podman run networking", func() {
It("podman run --net host --hostname ... hostname test", func() {
session := podmanTest.Podman([]string{"run", "--rm", "--net", "host", "--hostname", "foobar", ALPINE, "printenv", "HOSTNAME"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ := session.GrepString("foobar")
Expect(match).Should(BeTrue())
})
@@ -514,7 +515,7 @@ var _ = Describe("Podman run networking", func() {
It("podman run --hostname ... hostname test", func() {
session := podmanTest.Podman([]string{"run", "--rm", "--hostname", "foobar", ALPINE, "printenv", "HOSTNAME"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ := session.GrepString("foobar")
Expect(match).Should(BeTrue())
})
@@ -523,59 +524,59 @@ var _ = Describe("Podman run networking", func() {
ctrName := "ctrToJoin"
ctr1 := podmanTest.RunTopContainer(ctrName)
ctr1.WaitWithDefaultTimeout()
- Expect(ctr1.ExitCode()).To(Equal(0))
+ Expect(ctr1).Should(Exit(0))
ctr2 := podmanTest.Podman([]string{"run", "-d", "--net=container:" + ctrName, "--uts=container:" + ctrName, ALPINE, "true"})
ctr2.WaitWithDefaultTimeout()
- Expect(ctr2.ExitCode()).To(Equal(0))
+ Expect(ctr2).Should(Exit(0))
})
It("podman run --net container: copies hosts and resolv", func() {
ctrName := "ctr1"
ctr1 := podmanTest.RunTopContainer(ctrName)
ctr1.WaitWithDefaultTimeout()
- Expect(ctr1.ExitCode()).To(Equal(0))
+ Expect(ctr1).Should(Exit(0))
// Exec in and modify /etc/resolv.conf and /etc/hosts
exec1 := podmanTest.Podman([]string{"exec", ctrName, "sh", "-c", "echo nameserver 192.0.2.1 > /etc/resolv.conf"})
exec1.WaitWithDefaultTimeout()
- Expect(exec1.ExitCode()).To(Equal(0))
+ Expect(exec1).Should(Exit(0))
exec2 := podmanTest.Podman([]string{"exec", ctrName, "sh", "-c", "echo 192.0.2.2 test1 > /etc/hosts"})
exec2.WaitWithDefaultTimeout()
- Expect(exec2.ExitCode()).To(Equal(0))
+ Expect(exec2).Should(Exit(0))
ctrName2 := "ctr2"
ctr2 := podmanTest.Podman([]string{"run", "-d", "--net=container:" + ctrName, "--name", ctrName2, ALPINE, "top"})
ctr2.WaitWithDefaultTimeout()
- Expect(ctr2.ExitCode()).To(Equal(0))
+ Expect(ctr2).Should(Exit(0))
exec3 := podmanTest.Podman([]string{"exec", "-i", ctrName2, "cat", "/etc/resolv.conf"})
exec3.WaitWithDefaultTimeout()
- Expect(exec3.ExitCode()).To(Equal(0))
+ Expect(exec3).Should(Exit(0))
Expect(exec3.OutputToString()).To(ContainSubstring("nameserver 192.0.2.1"))
exec4 := podmanTest.Podman([]string{"exec", "-i", ctrName2, "cat", "/etc/hosts"})
exec4.WaitWithDefaultTimeout()
- Expect(exec4.ExitCode()).To(Equal(0))
+ Expect(exec4).Should(Exit(0))
Expect(exec4.OutputToString()).To(ContainSubstring("192.0.2.2 test1"))
})
It("podman run /etc/hosts contains --hostname", func() {
session := podmanTest.Podman([]string{"run", "--rm", "--hostname", "foohostname", ALPINE, "grep", "foohostname", "/etc/hosts"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman run --uidmap /etc/hosts contains --hostname", func() {
SkipIfRootless("uidmap population of cninetworks not supported for rootless users")
session := podmanTest.Podman([]string{"run", "--uidmap", "0:100000:1000", "--rm", "--hostname", "foohostname", ALPINE, "grep", "foohostname", "/etc/hosts"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--uidmap", "0:100000:1000", "--rm", "--hostname", "foohostname", "-v", "/etc/hosts:/etc/hosts", ALPINE, "grep", "foohostname", "/etc/hosts"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(1))
+ Expect(session).Should(Exit(1))
})
It("podman run network in user created network namespace", func() {
@@ -584,15 +585,15 @@ var _ = Describe("Podman run networking", func() {
Skip("Cannot be run within a container.")
}
addXXX := SystemExec("ip", []string{"netns", "add", "xxx"})
- Expect(addXXX.ExitCode()).To(Equal(0))
+ Expect(addXXX).Should(Exit(0))
defer func() {
delXXX := SystemExec("ip", []string{"netns", "delete", "xxx"})
- Expect(delXXX.ExitCode()).To(Equal(0))
+ Expect(delXXX).Should(Exit(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))
+ Expect(session).Should(Exit(0))
})
It("podman run n user created network namespace with resolv.conf", func() {
@@ -601,22 +602,22 @@ var _ = Describe("Podman run networking", func() {
Skip("Cannot be run within a container.")
}
addXXX2 := SystemExec("ip", []string{"netns", "add", "xxx2"})
- Expect(addXXX2.ExitCode()).To(Equal(0))
+ Expect(addXXX2).Should(Exit(0))
defer func() {
delXXX2 := SystemExec("ip", []string{"netns", "delete", "xxx2"})
- Expect(delXXX2.ExitCode()).To(Equal(0))
+ Expect(delXXX2).Should(Exit(0))
}()
mdXXX2 := SystemExec("mkdir", []string{"-p", "/etc/netns/xxx2"})
- Expect(mdXXX2.ExitCode()).To(Equal(0))
+ Expect(mdXXX2).Should(Exit(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))
+ Expect(nsXXX2).Should(Exit(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).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("11.11.11.11"))
})
@@ -632,12 +633,12 @@ var _ = Describe("Podman run networking", func() {
ipAddr := "10.25.30.128"
create := podmanTest.Podman([]string{"network", "create", "--subnet", "10.25.30.0/24", netName})
create.WaitWithDefaultTimeout()
- Expect(create.ExitCode()).To(BeZero())
+ Expect(create).Should(Exit(0))
defer podmanTest.removeCNINetwork(netName)
run := podmanTest.Podman([]string{"run", "-t", "-i", "--rm", "--net", netName, "--ip", ipAddr, ALPINE, "ip", "addr"})
run.WaitWithDefaultTimeout()
- Expect(run.ExitCode()).To(BeZero())
+ Expect(run).Should(Exit(0))
Expect(run.OutputToString()).To(ContainSubstring(ipAddr))
})
@@ -645,23 +646,23 @@ var _ = Describe("Podman run networking", func() {
netName := stringid.GenerateNonCryptoID()
create := podmanTest.Podman([]string{"network", "create", netName})
create.WaitWithDefaultTimeout()
- Expect(create.ExitCode()).To(BeZero())
+ Expect(create).Should(Exit(0))
defer podmanTest.removeCNINetwork(netName)
name := "nc-server"
run := podmanTest.Podman([]string{"run", "--log-driver", "k8s-file", "-d", "--name", name, "--net", netName, ALPINE, "nc", "-l", "-p", "8080"})
run.WaitWithDefaultTimeout()
- Expect(run.ExitCode()).To(Equal(0))
+ Expect(run).Should(Exit(0))
// NOTE: we force the k8s-file log driver to make sure the
// tests are passing inside a container.
run = podmanTest.Podman([]string{"run", "--log-driver", "k8s-file", "--rm", "--net", netName, "--uidmap", "0:1:4096", ALPINE, "sh", "-c", fmt.Sprintf("echo podman | nc -w 1 %s.dns.podman 8080", name)})
run.WaitWithDefaultTimeout()
- Expect(run.ExitCode()).To(Equal(0))
+ Expect(run).Should(Exit(0))
log := podmanTest.Podman([]string{"logs", name})
log.WaitWithDefaultTimeout()
- Expect(log.ExitCode()).To(Equal(0))
+ Expect(log).Should(Exit(0))
Expect(log.OutputToString()).To(Equal("podman"))
})
@@ -671,23 +672,23 @@ var _ = Describe("Podman run networking", func() {
podname := "testpod"
create := podmanTest.Podman([]string{"network", "create", "--subnet", "10.25.40.0/24", netName})
create.WaitWithDefaultTimeout()
- Expect(create.ExitCode()).To(BeZero())
+ Expect(create).Should(Exit(0))
defer podmanTest.removeCNINetwork(netName)
run := podmanTest.Podman([]string{"run", "-t", "-i", "--rm", "--pod", "new:" + podname, "--net", netName, "--ip", ipAddr, ALPINE, "ip", "addr"})
run.WaitWithDefaultTimeout()
- Expect(run.ExitCode()).To(BeZero())
+ Expect(run).Should(Exit(0))
Expect(run.OutputToString()).To(ContainSubstring(ipAddr))
podrm := podmanTest.Podman([]string{"pod", "rm", "-f", podname})
podrm.WaitWithDefaultTimeout()
- Expect(podrm.ExitCode()).To(BeZero())
+ Expect(podrm).Should(Exit(0))
})
It("podman run net=host adds entry to /etc/hosts", func() {
run := podmanTest.Podman([]string{"run", "--net=host", ALPINE, "cat", "/etc/hosts"})
run.WaitWithDefaultTimeout()
- Expect(run.ExitCode()).To(BeZero())
+ Expect(run).Should(Exit(0))
Expect(strings.Contains(run.OutputToString(), "127.0.1.1")).To(BeTrue())
})
@@ -695,7 +696,7 @@ var _ = Describe("Podman run networking", func() {
hostname := "testctr"
run := podmanTest.Podman([]string{"run", "--net=host", "--hostname", hostname, ALPINE, "hostname"})
run.WaitWithDefaultTimeout()
- Expect(run.ExitCode()).To(BeZero())
+ Expect(run).Should(Exit(0))
Expect(strings.Contains(run.OutputToString(), hostname)).To(BeTrue())
})
@@ -703,7 +704,7 @@ var _ = Describe("Podman run networking", func() {
hostname := "testctr"
run := podmanTest.Podman([]string{"run", "--net=none", "--hostname", hostname, ALPINE, "hostname"})
run.WaitWithDefaultTimeout()
- Expect(run.ExitCode()).To(BeZero())
+ Expect(run).Should(Exit(0))
Expect(strings.Contains(run.OutputToString(), hostname)).To(BeTrue())
})
@@ -711,7 +712,7 @@ var _ = Describe("Podman run networking", func() {
hostname := "testctr"
run := podmanTest.Podman([]string{"run", "--net=none", "--hostname", hostname, ALPINE, "cat", "/etc/hosts"})
run.WaitWithDefaultTimeout()
- Expect(run.ExitCode()).To(BeZero())
+ Expect(run).Should(Exit(0))
Expect(strings.Contains(run.OutputToString(), hostname)).To(BeTrue())
})
@@ -719,11 +720,11 @@ var _ = Describe("Podman run networking", func() {
hostname := "testctr"
run := podmanTest.Podman([]string{"run", netns, "--hostname", hostname, ALPINE, "ping", "-c", "1", hostname})
run.WaitWithDefaultTimeout()
- Expect(run.ExitCode()).To(BeZero())
+ Expect(run).Should(Exit(0))
run = podmanTest.Podman([]string{"run", netns, "--hostname", hostname, "--name", "test", ALPINE, "ping", "-c", "1", "test"})
run.WaitWithDefaultTimeout()
- Expect(run.ExitCode()).To(BeZero())
+ Expect(run).Should(Exit(0))
}
It("podman attempt to ping container name and hostname --net=none", func() {
@@ -742,35 +743,35 @@ var _ = Describe("Podman run networking", func() {
pod := "testpod"
session := podmanTest.Podman([]string{"pod", "create", "--name", pod})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
net := "IntTest" + stringid.GenerateNonCryptoID()
session = podmanTest.Podman([]string{"network", "create", net})
session.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(net)
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
pod2 := "testpod2"
session = podmanTest.Podman([]string{"pod", "create", "--network", net, "--name", pod2})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--name", "con1", "--network", net, ALPINE, "nslookup", "con1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--name", "con2", "--pod", pod, "--network", net, ALPINE, "nslookup", "con2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--name", "con3", "--pod", pod2, ALPINE, "nslookup", "con1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(1))
+ Expect(session).Should(Exit(1))
Expect(session.ErrorToString()).To(ContainSubstring("can't resolve 'con1'"))
session = podmanTest.Podman([]string{"run", "--name", "con4", "--network", net, ALPINE, "nslookup", pod2 + ".dns.podman"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
})
It("podman run check dnsname adds dns search domain", func() {
@@ -779,11 +780,11 @@ var _ = Describe("Podman run networking", func() {
session := podmanTest.Podman([]string{"network", "create", net})
session.WaitWithDefaultTimeout()
defer podmanTest.removeCNINetwork(net)
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--network", net, ALPINE, "cat", "/etc/resolv.conf"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("search dns.podman"))
})
@@ -792,7 +793,7 @@ var _ = Describe("Podman run networking", func() {
ctrName := "testctr"
ctr := podmanTest.Podman([]string{"run", "-d", "--net=bridge", "--name", ctrName, ALPINE, "top"})
ctr.WaitWithDefaultTimeout()
- Expect(ctr.ExitCode()).To(BeZero())
+ Expect(ctr).Should(Exit(0))
inspectOut := podmanTest.InspectContainer(ctrName)
Expect(len(inspectOut)).To(Equal(1))
diff --git a/test/e2e/run_ns_test.go b/test/e2e/run_ns_test.go
index c72891107..db81cc1a7 100644
--- a/test/e2e/run_ns_test.go
+++ b/test/e2e/run_ns_test.go
@@ -8,6 +8,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman run ns", func() {
@@ -38,12 +39,12 @@ var _ = Describe("Podman run ns", func() {
SkipIfRootlessCgroupsV1("Not supported for rootless + CGroupsV1")
session := podmanTest.Podman([]string{"run", fedoraMinimal, "bash", "-c", "echo $$"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("1"))
session = podmanTest.Podman([]string{"run", "--pid=host", fedoraMinimal, "bash", "-c", "echo $$"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Not(Equal("1")))
session = podmanTest.Podman([]string{"run", "--pid=badpid", fedoraMinimal, "bash", "-c", "echo $$"})
@@ -54,7 +55,7 @@ var _ = Describe("Podman run ns", func() {
It("podman run --cgroup private test", func() {
session := podmanTest.Podman([]string{"run", "--cgroupns=private", fedoraMinimal, "cat", "/proc/self/cgroup"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
output := session.OutputToString()
Expect(output).ToNot(ContainSubstring("slice"))
@@ -62,41 +63,41 @@ var _ = Describe("Podman run ns", func() {
It("podman run ipcns test", func() {
setup := SystemExec("ls", []string{"--inode", "-d", "/dev/shm"})
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
hostShm := setup.OutputToString()
session := podmanTest.Podman([]string{"run", "--ipc=host", fedoraMinimal, "ls", "--inode", "-d", "/dev/shm"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal(hostShm))
})
It("podman run ipcns ipcmk host test", func() {
setup := SystemExec("ipcmk", []string{"-M", "1024"})
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
output := strings.Split(setup.OutputToString(), " ")
ipc := output[len(output)-1]
session := podmanTest.Podman([]string{"run", "--ipc=host", fedoraMinimal, "ipcs", "-m", "-i", ipc})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
setup = SystemExec("ipcrm", []string{"-m", ipc})
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
})
It("podman run ipcns ipcmk container test", func() {
setup := podmanTest.Podman([]string{"run", "-d", "--name", "test1", fedoraMinimal, "sleep", "999"})
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
session := podmanTest.Podman([]string{"exec", "test1", "ipcmk", "-M", "1024"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
output := strings.Split(session.OutputToString(), " ")
ipc := output[len(output)-1]
session = podmanTest.Podman([]string{"run", "--ipc=container:test1", fedoraMinimal, "ipcs", "-m", "-i", ipc})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman run bad ipc pid test", func() {
@@ -108,7 +109,7 @@ var _ = Describe("Podman run ns", func() {
It("podman run mounts fresh cgroup", func() {
session := podmanTest.Podman([]string{"run", fedoraMinimal, "grep", "cgroup", "/proc/self/mountinfo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
output := session.OutputToString()
Expect(output).ToNot(ContainSubstring(".."))
})
@@ -129,13 +130,13 @@ var _ = Describe("Podman run ns", func() {
session := podmanTest.Podman([]string{"run", "--ipc=host", "--pid=host", ALPINE, "ls", "-l", "/proc/self/ns/pid"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
fields = strings.Split(session.OutputToString(), " ")
ctrPidNS := strings.TrimSuffix(fields[len(fields)-1], "\n")
session = podmanTest.Podman([]string{"run", "--ipc=host", "--pid=host", ALPINE, "ls", "-l", "/proc/self/ns/ipc"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
fields = strings.Split(session.OutputToString(), " ")
ctrIpcNS := strings.TrimSuffix(fields[len(fields)-1], "\n")
diff --git a/test/e2e/run_passwd_test.go b/test/e2e/run_passwd_test.go
index 0d5dd5f3b..3e7e73fad 100644
--- a/test/e2e/run_passwd_test.go
+++ b/test/e2e/run_passwd_test.go
@@ -7,6 +7,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman run passwd", func() {
@@ -36,27 +37,27 @@ var _ = Describe("Podman run passwd", func() {
It("podman run no user specified ", func() {
session := podmanTest.Podman([]string{"run", "--read-only", BB, "mount"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.LineInOutputContains("passwd")).To(BeFalse())
})
It("podman run user specified in container", func() {
session := podmanTest.Podman([]string{"run", "--read-only", "-u", "bin", BB, "mount"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.LineInOutputContains("passwd")).To(BeFalse())
})
It("podman run UID specified in container", func() {
session := podmanTest.Podman([]string{"run", "--read-only", "-u", "2:1", BB, "mount"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.LineInOutputContains("passwd")).To(BeFalse())
})
It("podman run UID not specified in container", func() {
session := podmanTest.Podman([]string{"run", "--read-only", "-u", "20001:1", BB, "mount"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.LineInOutputContains("passwd")).To(BeTrue())
})
@@ -68,48 +69,48 @@ USER 1000`, ALPINE)
podmanTest.BuildImage(dockerfile, imgName, "false")
session := podmanTest.Podman([]string{"run", "--rm", imgName, "ls", "/etc/"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Not(ContainSubstring("passwd")))
})
It("podman run with no user specified does not change --group specified", func() {
session := podmanTest.Podman([]string{"run", "--read-only", BB, "mount"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.LineInOutputContains("/etc/group")).To(BeFalse())
})
It("podman run group specified in container", func() {
session := podmanTest.Podman([]string{"run", "--read-only", "-u", "root:bin", BB, "mount"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.LineInOutputContains("/etc/group")).To(BeFalse())
})
It("podman run non-numeric group not specified in container", func() {
session := podmanTest.Podman([]string{"run", "--read-only", "-u", "root:doesnotexist", BB, "mount"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
})
It("podman run numeric group specified in container", func() {
session := podmanTest.Podman([]string{"run", "--read-only", "-u", "root:11", BB, "mount"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.LineInOutputContains("/etc/group")).To(BeFalse())
})
It("podman run numeric group not specified in container", func() {
session := podmanTest.Podman([]string{"run", "--read-only", "-u", "20001:20001", BB, "mount"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.LineInOutputContains("/etc/group")).To(BeTrue())
})
It("podman run numeric user not specified in container modifies group", func() {
session := podmanTest.Podman([]string{"run", "--read-only", "-u", "20001", BB, "mount"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.LineInOutputContains("/etc/group")).To(BeTrue())
})
@@ -121,7 +122,7 @@ USER 1000`, ALPINE)
podmanTest.BuildImage(dockerfile, imgName, "false")
session := podmanTest.Podman([]string{"run", "--rm", imgName, "ls", "/etc/"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Not(ContainSubstring("/etc/group")))
})
})
diff --git a/test/e2e/run_privileged_test.go b/test/e2e/run_privileged_test.go
index 0bf68e20b..3e4262cfb 100644
--- a/test/e2e/run_privileged_test.go
+++ b/test/e2e/run_privileged_test.go
@@ -8,6 +8,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
"github.com/syndtr/gocapability/capability"
)
@@ -61,7 +62,7 @@ var _ = Describe("Podman privileged container tests", func() {
It("podman privileged make sure sys is mounted rw", func() {
session := podmanTest.Podman([]string{"run", "--privileged", BB, "mount"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
ok, lines := session.GrepString("sysfs")
Expect(ok).To(BeTrue())
Expect(lines[0]).To(ContainSubstring("sysfs (rw,"))
@@ -69,11 +70,11 @@ var _ = Describe("Podman privileged container tests", func() {
It("podman privileged CapEff", func() {
hostCap := SystemExec("awk", []string{"/^CapEff/ { print $2 }", "/proc/self/status"})
- Expect(hostCap.ExitCode()).To(Equal(0))
+ Expect(hostCap).Should(Exit(0))
session := podmanTest.Podman([]string{"run", "--privileged", BB, "awk", "/^CapEff/ { print $2 }", "/proc/self/status"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
containerCapMatchesHost(session.OutputToString(), hostCap.OutputToString())
})
@@ -81,11 +82,11 @@ var _ = Describe("Podman privileged container tests", func() {
It("podman cap-add CapEff", func() {
// Get caps of current process
hostCap := SystemExec("awk", []string{"/^CapEff/ { print $2 }", "/proc/self/status"})
- Expect(hostCap.ExitCode()).To(Equal(0))
+ Expect(hostCap).Should(Exit(0))
session := podmanTest.Podman([]string{"run", "--cap-add", "all", BB, "awk", "/^CapEff/ { print $2 }", "/proc/self/status"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
containerCapMatchesHost(session.OutputToString(), hostCap.OutputToString())
})
@@ -93,11 +94,11 @@ var _ = Describe("Podman privileged container tests", func() {
It("podman cap-add CapEff with --user", func() {
// Get caps of current process
hostCap := SystemExec("awk", []string{"/^CapEff/ { print $2 }", "/proc/self/status"})
- Expect(hostCap.ExitCode()).To(Equal(0))
+ Expect(hostCap).Should(Exit(0))
session := podmanTest.Podman([]string{"run", "--user=bin", "--cap-add", "all", BB, "awk", "/^CapEff/ { print $2 }", "/proc/self/status"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
containerCapMatchesHost(session.OutputToString(), hostCap.OutputToString())
})
@@ -105,24 +106,24 @@ var _ = Describe("Podman privileged container tests", func() {
It("podman cap-drop CapEff", func() {
session := podmanTest.Podman([]string{"run", "--cap-drop", "all", BB, "grep", "CapEff", "/proc/self/status"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
capEff := strings.Split(session.OutputToString(), " ")
Expect("0000000000000000").To(Equal(capEff[1]))
})
It("podman privileged should disable seccomp by default", func() {
hostSeccomp := SystemExec("grep", []string{"-Ei", "^Seccomp:\\s+0$", "/proc/self/status"})
- Expect(hostSeccomp.ExitCode()).To(Equal(0))
+ Expect(hostSeccomp).Should(Exit(0))
session := podmanTest.Podman([]string{"run", "--privileged", ALPINE, "grep", "-Ei", "^Seccomp:\\s+0$", "/proc/self/status"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman non-privileged should have very few devices", func() {
session := podmanTest.Podman([]string{"run", "-t", BB, "ls", "-l", "/dev"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(17))
})
@@ -130,7 +131,7 @@ var _ = Describe("Podman privileged container tests", func() {
SkipIfRootless("FIXME: This seems to be broken for rootless mode, /dev/ is close to the same")
session := podmanTest.Podman([]string{"run", "--privileged", ALPINE, "ls", "-l", "/dev"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 20))
})
@@ -149,12 +150,12 @@ var _ = Describe("Podman privileged container tests", func() {
session := podmanTest.Podman([]string{"run", BB, "grep", "NoNewPrivs", "/proc/self/status"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
privs := strings.Split(session.OutputToString(), ":")
session = podmanTest.Podman([]string{"run", "--security-opt", "no-new-privileges", BB, "grep", "NoNewPrivs", "/proc/self/status"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
noprivs := strings.Split(session.OutputToString(), ":")
Expect(privs[1]).To(Not(Equal(noprivs[1])))
diff --git a/test/e2e/run_restart_test.go b/test/e2e/run_restart_test.go
index c996bdb25..35768ca51 100644
--- a/test/e2e/run_restart_test.go
+++ b/test/e2e/run_restart_test.go
@@ -6,6 +6,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman run restart containers", func() {
@@ -35,15 +36,15 @@ var _ = Describe("Podman run restart containers", func() {
It("Podman start after successful run", func() {
session := podmanTest.Podman([]string{"run", "--name", "test", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"wait", "test"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session2 := podmanTest.Podman([]string{"start", "--attach", "test"})
session2.WaitWithDefaultTimeout()
- Expect(session2.ExitCode()).To(Equal(0))
+ Expect(session2).Should(Exit(0))
})
It("Podman start after signal kill", func() {
@@ -53,10 +54,10 @@ var _ = Describe("Podman run restart containers", func() {
killSession := podmanTest.Podman([]string{"kill", "-s", "9", "test1"})
killSession.WaitWithDefaultTimeout()
- Expect(killSession.ExitCode()).To(Equal(0))
+ Expect(killSession).Should(Exit(0))
session2 := podmanTest.Podman([]string{"start", "test1"})
session2.WaitWithDefaultTimeout()
- Expect(session2.ExitCode()).To(Equal(0))
+ Expect(session2).Should(Exit(0))
})
})
diff --git a/test/e2e/run_seccomp_test.go b/test/e2e/run_seccomp_test.go
index ed1cdeecd..3a6adca0e 100644
--- a/test/e2e/run_seccomp_test.go
+++ b/test/e2e/run_seccomp_test.go
@@ -6,6 +6,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman run", func() {
@@ -35,20 +36,20 @@ var _ = Describe("Podman run", func() {
It("podman run --seccomp-policy default", func() {
session := podmanTest.Podman([]string{"run", "--seccomp-policy", "default", alpineSeccomp, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman run --seccomp-policy ''", func() {
// Empty string is interpreted as "default".
session := podmanTest.Podman([]string{"run", "--seccomp-policy", "", alpineSeccomp, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman run --seccomp-policy invalid", func() {
session := podmanTest.Podman([]string{"run", "--seccomp-policy", "invalid", alpineSeccomp, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).ToNot(Equal(0))
+ Expect(session).To(ExitWithError())
})
It("podman run --seccomp-policy image (block all syscalls)", func() {
@@ -57,12 +58,12 @@ var _ = Describe("Podman run", func() {
// TODO: we're getting a "cannot start a container that has
// stopped" error which seems surprising. Investigate
// why that is so.
- Expect(session.ExitCode()).ToNot(Equal(0))
+ Expect(session).To(ExitWithError())
})
It("podman run --seccomp-policy image (bogus profile)", func() {
session := podmanTest.Podman([]string{"run", "--seccomp-policy", "image", alpineBogusSeccomp, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
})
diff --git a/test/e2e/run_security_labels_test.go b/test/e2e/run_security_labels_test.go
index ae86bb690..1da80e61d 100644
--- a/test/e2e/run_security_labels_test.go
+++ b/test/e2e/run_security_labels_test.go
@@ -8,6 +8,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman generate kube", func() {
@@ -37,11 +38,11 @@ var _ = Describe("Podman generate kube", func() {
It("podman security labels", func() {
test1 := podmanTest.Podman([]string{"create", "--label", "io.containers.capabilities=setuid,setgid", "--name", "test1", "alpine", "echo", "test1"})
test1.WaitWithDefaultTimeout()
- Expect(test1.ExitCode()).To(BeZero())
+ Expect(test1).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", "test1"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
ctr := inspect.InspectContainerToJSON()
caps := strings.Join(ctr[0].EffectiveCaps, ",")
@@ -51,11 +52,11 @@ var _ = Describe("Podman generate kube", func() {
It("podman bad security labels", func() {
test1 := podmanTest.Podman([]string{"create", "--label", "io.containers.capabilities=sys_admin", "--name", "test1", "alpine", "echo", "test1"})
test1.WaitWithDefaultTimeout()
- Expect(test1.ExitCode()).To(BeZero())
+ Expect(test1).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", "test1"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
ctr := inspect.InspectContainerToJSON()
caps := strings.Join(ctr[0].EffectiveCaps, ",")
@@ -65,11 +66,11 @@ var _ = Describe("Podman generate kube", func() {
It("podman --cap-add sys_admin security labels", func() {
test1 := podmanTest.Podman([]string{"create", "--cap-add", "SYS_ADMIN", "--label", "io.containers.capabilities=sys_admin", "--name", "test1", "alpine", "echo", "test1"})
test1.WaitWithDefaultTimeout()
- Expect(test1.ExitCode()).To(BeZero())
+ Expect(test1).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", "test1"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
ctr := inspect.InspectContainerToJSON()
caps := strings.Join(ctr[0].EffectiveCaps, ",")
@@ -79,11 +80,11 @@ var _ = Describe("Podman generate kube", func() {
It("podman --cap-drop all sys_admin security labels", func() {
test1 := podmanTest.Podman([]string{"create", "--cap-drop", "all", "--label", "io.containers.capabilities=sys_admin", "--name", "test1", "alpine", "echo", "test1"})
test1.WaitWithDefaultTimeout()
- Expect(test1.ExitCode()).To(BeZero())
+ Expect(test1).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", "test1"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
ctr := inspect.InspectContainerToJSON()
caps := strings.Join(ctr[0].EffectiveCaps, ",")
@@ -93,19 +94,19 @@ var _ = Describe("Podman generate kube", func() {
It("podman security labels from image", func() {
test1 := podmanTest.Podman([]string{"create", "--name", "test1", "alpine", "echo", "test1"})
test1.WaitWithDefaultTimeout()
- Expect(test1.ExitCode()).To(BeZero())
+ Expect(test1).Should(Exit(0))
commit := podmanTest.Podman([]string{"commit", "-c", "label=io.containers.capabilities=sys_chroot,setuid", "test1", "image1"})
commit.WaitWithDefaultTimeout()
- Expect(commit.ExitCode()).To(BeZero())
+ Expect(commit).Should(Exit(0))
image1 := podmanTest.Podman([]string{"create", "--name", "test2", "image1", "echo", "test1"})
image1.WaitWithDefaultTimeout()
- Expect(image1.ExitCode()).To(BeZero())
+ Expect(image1).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", "test2"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
ctr := inspect.InspectContainerToJSON()
caps := strings.Join(ctr[0].EffectiveCaps, ",")
@@ -116,11 +117,11 @@ var _ = Describe("Podman generate kube", func() {
It("podman --privileged security labels", func() {
pull := podmanTest.Podman([]string{"create", "--privileged", "--label", "io.containers.capabilities=setuid,setgid", "--name", "test1", "alpine", "echo", "test"})
pull.WaitWithDefaultTimeout()
- Expect(pull.ExitCode()).To(BeZero())
+ Expect(pull).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", "test1"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
ctr := inspect.InspectContainerToJSON()
caps := strings.Join(ctr[0].EffectiveCaps, ",")
@@ -138,11 +139,11 @@ LABEL io.containers.capabilities=chown,kill`, ALPINE)
test1 := podmanTest.Podman([]string{"create", "--name", "test1", image, "echo", "test1"})
test1.WaitWithDefaultTimeout()
- Expect(test1.ExitCode()).To(BeZero())
+ Expect(test1).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", "test1"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
ctr := inspect.InspectContainerToJSON()
caps := strings.Join(ctr[0].EffectiveCaps, ",")
diff --git a/test/e2e/run_selinux_test.go b/test/e2e/run_selinux_test.go
index 2886f06c1..1a5ef4d5d 100644
--- a/test/e2e/run_selinux_test.go
+++ b/test/e2e/run_selinux_test.go
@@ -7,6 +7,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
"github.com/opencontainers/selinux/go-selinux"
)
@@ -40,7 +41,7 @@ var _ = Describe("Podman run", func() {
It("podman run selinux", func() {
session := podmanTest.Podman([]string{"run", ALPINE, "cat", "/proc/self/attr/current"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ := session.GrepString("container_t")
Expect(match).Should(BeTrue())
})
@@ -48,7 +49,7 @@ var _ = Describe("Podman run", func() {
It("podman run selinux grep test", func() {
session := podmanTest.Podman([]string{"run", "-it", "--security-opt", "label=level:s0:c1,c2", ALPINE, "cat", "/proc/self/attr/current"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ := session.GrepString("s0:c1,c2")
Expect(match).Should(BeTrue())
})
@@ -56,7 +57,7 @@ var _ = Describe("Podman run", func() {
It("podman run selinux disable test", func() {
session := podmanTest.Podman([]string{"run", "-it", "--security-opt", "label=disable", ALPINE, "cat", "/proc/self/attr/current"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ := session.GrepString("spc_t")
Expect(match).Should(BeTrue())
})
@@ -64,7 +65,7 @@ var _ = Describe("Podman run", func() {
It("podman run selinux type check test", func() {
session := podmanTest.Podman([]string{"run", "-it", ALPINE, "cat", "/proc/self/attr/current"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match1, _ := session.GrepString("container_t")
match2, _ := session.GrepString("svirt_lxc_net_t")
Expect(match1 || match2).Should(BeTrue())
@@ -73,7 +74,7 @@ var _ = Describe("Podman run", func() {
It("podman run selinux type setup test", func() {
session := podmanTest.Podman([]string{"run", "-it", "--security-opt", "label=type:spc_t", ALPINE, "cat", "/proc/self/attr/current"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ := session.GrepString("spc_t")
Expect(match).Should(BeTrue())
})
@@ -81,7 +82,7 @@ var _ = Describe("Podman run", func() {
It("podman privileged selinux", func() {
session := podmanTest.Podman([]string{"run", "--privileged", ALPINE, "cat", "/proc/self/attr/current"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ := session.GrepString("spc_t")
Expect(match).Should(BeTrue())
})
@@ -89,7 +90,7 @@ var _ = Describe("Podman run", func() {
It("podman test selinux label resolv.conf", func() {
session := podmanTest.Podman([]string{"run", fedoraMinimal, "ls", "-Z", "/etc/resolv.conf"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ := session.GrepString("container_file_t")
Expect(match).Should(BeTrue())
})
@@ -97,7 +98,7 @@ var _ = Describe("Podman run", func() {
It("podman test selinux label hosts", func() {
session := podmanTest.Podman([]string{"run", fedoraMinimal, "ls", "-Z", "/etc/hosts"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ := session.GrepString("container_file_t")
Expect(match).Should(BeTrue())
})
@@ -105,7 +106,7 @@ var _ = Describe("Podman run", func() {
It("podman test selinux label hostname", func() {
session := podmanTest.Podman([]string{"run", fedoraMinimal, "ls", "-Z", "/etc/hostname"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ := session.GrepString("container_file_t")
Expect(match).Should(BeTrue())
})
@@ -113,7 +114,7 @@ var _ = Describe("Podman run", func() {
It("podman test selinux label /run/secrets", func() {
session := podmanTest.Podman([]string{"run", fedoraMinimal, "ls", "-dZ", "/run/secrets"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ := session.GrepString("container_file_t")
Expect(match).Should(BeTrue())
})
@@ -121,7 +122,7 @@ var _ = Describe("Podman run", func() {
It("podman test selinux --privileged label resolv.conf", func() {
session := podmanTest.Podman([]string{"run", "--privileged", fedoraMinimal, "ls", "-Z", "/etc/resolv.conf"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ := session.GrepString("container_file_t")
Expect(match).Should(BeTrue())
})
@@ -129,7 +130,7 @@ var _ = Describe("Podman run", func() {
It("podman test selinux --privileged label hosts", func() {
session := podmanTest.Podman([]string{"run", "--privileged", fedoraMinimal, "ls", "-Z", "/etc/hosts"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ := session.GrepString("container_file_t")
Expect(match).Should(BeTrue())
})
@@ -137,7 +138,7 @@ var _ = Describe("Podman run", func() {
It("podman test selinux --privileged label hostname", func() {
session := podmanTest.Podman([]string{"run", "--privileged", fedoraMinimal, "ls", "-Z", "/etc/hostname"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ := session.GrepString("container_file_t")
Expect(match).Should(BeTrue())
})
@@ -145,7 +146,7 @@ var _ = Describe("Podman run", func() {
It("podman test selinux --privileged label /run/secrets", func() {
session := podmanTest.Podman([]string{"run", "--privileged", fedoraMinimal, "ls", "-dZ", "/run/secrets"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ := session.GrepString("container_file_t")
Expect(match).Should(BeTrue())
})
@@ -153,19 +154,19 @@ var _ = Describe("Podman run", func() {
It("podman run selinux file type setup test", func() {
session := podmanTest.Podman([]string{"run", "-it", "--security-opt", "label=type:spc_t", "--security-opt", "label=filetype:container_var_lib_t", fedoraMinimal, "ls", "-Z", "/dev"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ := session.GrepString("container_var_lib_t")
Expect(match).Should(BeTrue())
session = podmanTest.Podman([]string{"run", "-it", "--security-opt", "label=type:spc_t", "--security-opt", "label=filetype:foobar", fedoraMinimal, "ls", "-Z", "/dev"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(126))
+ Expect(session).Should(Exit(126))
})
It("podman exec selinux check", func() {
setup := podmanTest.RunTopContainer("test1")
setup.WaitWithDefaultTimeout()
- Expect(setup.ExitCode()).To(Equal(0))
+ Expect(setup).Should(Exit(0))
session := podmanTest.Podman([]string{"exec", "test1", "cat", "/proc/1/attr/current"})
session.WaitWithDefaultTimeout()
@@ -177,7 +178,7 @@ var _ = Describe("Podman run", func() {
It("podman run --privileged and --security-opt SELinux options", func() {
session := podmanTest.Podman([]string{"run", "-it", "--privileged", "--security-opt", "label=type:spc_t", "--security-opt", "label=level:s0:c1,c2", ALPINE, "cat", "/proc/self/attr/current"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ := session.GrepString("spc_t")
Expect(match).To(BeTrue())
match2, _ := session.GrepString("s0:c1,c2")
@@ -187,90 +188,90 @@ var _ = Describe("Podman run", func() {
It("podman pod container share SELinux labels", func() {
session := podmanTest.Podman([]string{"pod", "create"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
podID := session.OutputToString()
session = podmanTest.Podman([]string{"run", "--pod", podID, ALPINE, "cat", "/proc/self/attr/current"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
label1 := session.OutputToString()
session = podmanTest.Podman([]string{"run", "--pod", podID, ALPINE, "cat", "/proc/self/attr/current"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal(label1))
session = podmanTest.Podman([]string{"pod", "rm", podID, "--force"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman pod container --infra=false doesn't share SELinux labels", func() {
session := podmanTest.Podman([]string{"pod", "create", "--infra=false"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
podID := session.OutputToString()
session = podmanTest.Podman([]string{"run", "--pod", podID, ALPINE, "cat", "/proc/self/attr/current"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
label1 := session.OutputToString()
session = podmanTest.Podman([]string{"run", "--pod", podID, ALPINE, "cat", "/proc/self/attr/current"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Not(Equal(label1)))
session = podmanTest.Podman([]string{"pod", "rm", podID, "--force"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman shared IPC NS container share SELinux labels", func() {
session := podmanTest.RunTopContainer("test1")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"exec", "test1", "cat", "/proc/self/attr/current"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
label1 := session.OutputToString()
session = podmanTest.Podman([]string{"run", "--ipc", "container:test1", ALPINE, "cat", "/proc/self/attr/current"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal(label1))
})
It("podman shared PID NS container share SELinux labels", func() {
session := podmanTest.RunTopContainer("test1")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"exec", "test1", "cat", "/proc/self/attr/current"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
label1 := session.OutputToString()
session = podmanTest.Podman([]string{"run", "--pid", "container:test1", ALPINE, "cat", "/proc/self/attr/current"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal(label1))
})
It("podman shared NET NS container doesn't share SELinux labels", func() {
session := podmanTest.RunTopContainer("test1")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"exec", "test1", "cat", "/proc/self/attr/current"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
label1 := session.OutputToString()
session = podmanTest.Podman([]string{"run", "--net", "container:test1", ALPINE, "cat", "/proc/self/attr/current"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Not(Equal(label1)))
})
@@ -278,35 +279,35 @@ var _ = Describe("Podman run", func() {
SkipIfRootlessCgroupsV1("Not supported for rootless + CGroupsV1")
session := podmanTest.Podman([]string{"run", "--pid=host", ALPINE, "cat", "/proc/self/attr/current"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("spc_t"))
})
It("podman test --ipc=host", func() {
session := podmanTest.Podman([]string{"run", "--ipc=host", ALPINE, "cat", "/proc/self/attr/current"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("spc_t"))
})
It("podman test --ipc=net", func() {
session := podmanTest.Podman([]string{"run", "--net=host", ALPINE, "cat", "/proc/self/attr/current"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("container_t"))
})
It("podman test --ipc=net", func() {
session := podmanTest.Podman([]string{"run", "--net=host", ALPINE, "cat", "/proc/self/attr/current"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("container_t"))
})
It("podman test --ipc=net", func() {
session := podmanTest.Podman([]string{"run", "--net=host", ALPINE, "cat", "/proc/self/attr/current"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("container_t"))
})
@@ -321,7 +322,7 @@ var _ = Describe("Podman run", func() {
}
session := podmanTest.Podman([]string{"create", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
session = podmanTest.Podman([]string{"inspect", "--format", "{{ .ProcessLabel }}", cid})
session.WaitWithDefaultTimeout()
@@ -337,7 +338,7 @@ var _ = Describe("Podman run", func() {
It("podman test init labels", func() {
session := podmanTest.Podman([]string{"create", ubi_init, "/sbin/init"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
session = podmanTest.Podman([]string{"inspect", "--format", "{{ .ProcessLabel }}", cid})
session.WaitWithDefaultTimeout()
@@ -347,7 +348,7 @@ var _ = Describe("Podman run", func() {
It("podman relabels named volume with :Z", func() {
session := podmanTest.Podman([]string{"run", "-v", "testvol:/test1/test:Z", fedoraMinimal, "ls", "-alZ", "/test1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ := session.GrepString(":s0:")
Expect(match).Should(BeTrue())
})
diff --git a/test/e2e/run_signal_test.go b/test/e2e/run_signal_test.go
index f601bee72..e9c073a6c 100644
--- a/test/e2e/run_signal_test.go
+++ b/test/e2e/run_signal_test.go
@@ -13,6 +13,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
"golang.org/x/sys/unix"
)
@@ -129,10 +130,10 @@ var _ = Describe("Podman run with --sig-proxy", func() {
// Kill with -9 to guarantee the container dies
killSession := podmanTest.Podman([]string{"kill", "-s", "9", "test2"})
killSession.WaitWithDefaultTimeout()
- Expect(killSession.ExitCode()).To(Equal(0))
+ Expect(killSession).Should(Exit(0))
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).ToNot(Equal(0))
+ Expect(session).To(ExitWithError())
ok, _ = session.GrepString("Received")
Expect(ok).To(BeFalse())
})
diff --git a/test/e2e/run_staticip_test.go b/test/e2e/run_staticip_test.go
index bff142b12..6dd7a14d0 100644
--- a/test/e2e/run_staticip_test.go
+++ b/test/e2e/run_staticip_test.go
@@ -9,6 +9,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman run with --ip flag", func() {
@@ -60,7 +61,7 @@ var _ = Describe("Podman run with --ip flag", func() {
ip := GetRandomIPAddress()
result := podmanTest.Podman([]string{"run", "-ti", "--ip", ip, ALPINE, "ip", "addr"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(ContainSubstring(ip + "/16"))
})
@@ -68,7 +69,7 @@ var _ = Describe("Podman run with --ip flag", func() {
ip := GetRandomIPAddress()
result := podmanTest.Podman([]string{"run", "-dt", "--ip", ip, nginx})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
for i := 0; i < 10; i++ {
fmt.Println("Waiting for nginx", err)
time.Sleep(1 * time.Second)
diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go
index e71e7a248..3bfd59b54 100644
--- a/test/e2e/run_test.go
+++ b/test/e2e/run_test.go
@@ -16,6 +16,7 @@ import (
"github.com/mrunalp/fileutils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman run", func() {
@@ -44,29 +45,29 @@ var _ = Describe("Podman run", func() {
It("podman run a container based on local image", func() {
session := podmanTest.Podman([]string{"run", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman run check /run/.containerenv", func() {
session := podmanTest.Podman([]string{"run", ALPINE, "cat", "/run/.containerenv"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal(""))
session = podmanTest.Podman([]string{"run", "--privileged", "--name=test1", ALPINE, "cat", "/run/.containerenv"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("name=\"test1\""))
Expect(session.OutputToString()).To(ContainSubstring("image=\"" + ALPINE + "\""))
session = podmanTest.Podman([]string{"run", "-v", "/:/host", ALPINE, "cat", "/run/.containerenv"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("graphRootMounted=1"))
session = podmanTest.Podman([]string{"run", "-v", "/:/host", "--privileged", ALPINE, "cat", "/run/.containerenv"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("graphRootMounted=1"))
})
@@ -75,40 +76,40 @@ var _ = Describe("Podman run", func() {
session := podmanTest.Podman([]string{"run", imageName, "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ErrorToString()).ToNot(ContainSubstring("Trying to pull"))
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman run --signature-policy", func() {
SkipIfRemote("SigPolicy not handled by remote")
session := podmanTest.Podman([]string{"run", "--pull=always", "--signature-policy", "/no/such/file", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
session = podmanTest.Podman([]string{"run", "--pull=always", "--signature-policy", "/etc/containers/policy.json", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman run --rm with --restart", func() {
session := podmanTest.Podman([]string{"run", "--rm", "--restart", "", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--rm", "--restart", "no", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--rm", "--restart", "on-failure", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--rm", "--restart", "always", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
session = podmanTest.Podman([]string{"run", "--rm", "--restart", "unless-stopped", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
})
It("podman run a container based on on a short name with localhost", func() {
@@ -121,7 +122,7 @@ var _ = Describe("Podman run", func() {
session := podmanTest.Podman([]string{"run", "libpod/alpine_nginx:latest", "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ErrorToString()).ToNot(ContainSubstring("Trying to pull"))
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman container run a container based on on a short name with localhost", func() {
@@ -134,20 +135,20 @@ var _ = Describe("Podman run", func() {
session := podmanTest.Podman([]string{"container", "run", "libpod/alpine_nginx:latest", "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ErrorToString()).ToNot(ContainSubstring("Trying to pull"))
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman run a container based on local image with short options", func() {
session := podmanTest.Podman([]string{"run", "-dt", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman run a container based on local image with short options and args", func() {
// regression test for #714
session := podmanTest.Podman([]string{"run", ALPINE, "find", "/etc", "-name", "hosts"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ := session.GrepString("/etc/hosts")
Expect(match).Should(BeTrue())
})
@@ -157,7 +158,7 @@ var _ = Describe("Podman run", func() {
hostname := "test_hostname"
session := podmanTest.Podman([]string{"run", "-ti", "--rm", "--name", name, "--hostname", hostname, ALPINE, "cat", "/etc/hosts"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ := session.GrepString(name)
Expect(match).Should(BeTrue())
match, _ = session.GrepString(hostname)
@@ -167,7 +168,7 @@ var _ = Describe("Podman run", func() {
It("podman run a container based on remote image", func() {
session := podmanTest.Podman([]string{"run", "-dt", BB_GLIBC, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman run a container with a --rootfs", func() {
@@ -184,25 +185,25 @@ var _ = Describe("Podman run", func() {
csession := podmanTest.Podman([]string{"run", "--name", uniqueString, ALPINE,
"/bin/sh", "-c", fmt.Sprintf("echo %s > %s", uniqueString, testFilePath)})
csession.WaitWithDefaultTimeout()
- Expect(csession.ExitCode()).To(Equal(0))
+ Expect(csession).Should(Exit(0))
// Export from working container image guarantees working root
esession := podmanTest.Podman([]string{"export", "--output", tarball, uniqueString})
esession.WaitWithDefaultTimeout()
- Expect(esession.ExitCode()).To(Equal(0))
+ Expect(esession).Should(Exit(0))
Expect(tarball).Should(BeARegularFile())
// N/B: This will loose any extended attributes like SELinux types
fmt.Fprintf(os.Stderr, "Extracting container root tarball\n")
tarsession := SystemExec("tar", []string{"xf", tarball, "-C", rootfs})
- Expect(tarsession.ExitCode()).To(Equal(0))
+ Expect(tarsession).Should(Exit(0))
Expect(filepath.Join(rootfs, uls)).Should(BeADirectory())
// Other tests confirm SELinux types, just confirm --rootfs is working.
session := podmanTest.Podman([]string{"run", "-i", "--security-opt", "label=disable",
"--rootfs", rootfs, "cat", testFilePath})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Validate changes made in original container and export
stdoutLines := session.OutputToStringArray()
@@ -213,10 +214,10 @@ var _ = Describe("Podman run", func() {
It("podman run a container with --init", func() {
session := podmanTest.Podman([]string{"run", "--name", "test", "--init", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"inspect", "test"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
conData := result.InspectContainerToJSON()
Expect(conData[0].Path).To(Equal("/dev/init"))
Expect(conData[0].Config.Annotations["io.podman.annotations.init"]).To(Equal("TRUE"))
@@ -225,10 +226,10 @@ var _ = Describe("Podman run", func() {
It("podman run a container with --init and --init-path", func() {
session := podmanTest.Podman([]string{"run", "--name", "test", "--init", "--init-path", "/usr/libexec/podman/catatonit", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"inspect", "test"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
conData := result.InspectContainerToJSON()
Expect(conData[0].Path).To(Equal("/dev/init"))
Expect(conData[0].Config.Annotations["io.podman.annotations.init"]).To(Equal("TRUE"))
@@ -237,10 +238,10 @@ var _ = Describe("Podman run", func() {
It("podman run a container without --init", func() {
session := podmanTest.Podman([]string{"run", "--name", "test", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"inspect", "test"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
conData := result.InspectContainerToJSON()
Expect(conData[0].Path).To(Equal("ls"))
Expect(conData[0].Config.Annotations["io.podman.annotations.init"]).To(Equal("FALSE"))
@@ -259,56 +260,56 @@ var _ = Describe("Podman run", func() {
It("podman run mask and unmask path test", func() {
session := podmanTest.Podman([]string{"run", "-d", "--name=maskCtr1", "--security-opt", "unmask=ALL", "--security-opt", "mask=/proc/acpi", ALPINE, "sleep", "200"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"exec", "maskCtr1", "ls", "/sys/firmware"})
session.WaitWithDefaultTimeout()
Expect(session.OutputToString()).To(Not(BeEmpty()))
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"exec", "maskCtr1", "ls", "/proc/acpi"})
session.WaitWithDefaultTimeout()
Expect(session.OutputToString()).To(BeEmpty())
session = podmanTest.Podman([]string{"run", "-d", "--name=maskCtr2", "--security-opt", "unmask=/proc/acpi:/sys/firmware", ALPINE, "sleep", "200"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"exec", "maskCtr2", "ls", "/sys/firmware"})
session.WaitWithDefaultTimeout()
Expect(session.OutputToString()).To(Not(BeEmpty()))
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"exec", "maskCtr2", "ls", "/proc/acpi"})
session.WaitWithDefaultTimeout()
Expect(session.OutputToString()).To(Not(BeEmpty()))
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "-d", "--name=maskCtr3", "--security-opt", "mask=/sys/power/disk", ALPINE, "sleep", "200"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"exec", "maskCtr3", "cat", "/sys/power/disk"})
session.WaitWithDefaultTimeout()
Expect(session.OutputToString()).To(BeEmpty())
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "-d", "--name=maskCtr4", "--security-opt", "systempaths=unconfined", ALPINE, "sleep", "200"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"exec", "maskCtr4", "ls", "/sys/firmware"})
session.WaitWithDefaultTimeout()
Expect(session.OutputToString()).To(Not(BeEmpty()))
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "-d", "--name=maskCtr5", "--security-opt", "systempaths=unconfined", ALPINE, "grep", "/proc", "/proc/self/mounts"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToStringArray()).Should(HaveLen(1))
session = podmanTest.Podman([]string{"run", "-d", "--security-opt", "unmask=/proc/*", ALPINE, "grep", "/proc", "/proc/self/mounts"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToStringArray()).Should(HaveLen(1))
session = podmanTest.Podman([]string{"run", "--security-opt", "unmask=/proc/a*", ALPINE, "ls", "/proc/acpi"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Not(BeEmpty()))
})
@@ -319,32 +320,32 @@ var _ = Describe("Podman run", func() {
rwOnCGroups := "/sys/fs/cgroup cgroup2 rw"
session := podmanTest.Podman([]string{"run", "--security-opt", "unmask=ALL", "--security-opt", "mask=/sys/fs/cgroup", ALPINE, "cat", "/proc/mounts"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(rwOnCGroups))
session = podmanTest.Podman([]string{"run", "--security-opt", "unmask=/sys/fs/cgroup", ALPINE, "cat", "/proc/mounts"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(rwOnCGroups))
session = podmanTest.Podman([]string{"run", "--security-opt", "unmask=/sys/fs/cgroup///", ALPINE, "cat", "/proc/mounts"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(rwOnCGroups))
session = podmanTest.Podman([]string{"run", "--security-opt", "unmask=ALL", ALPINE, "cat", "/proc/mounts"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(rwOnCGroups))
session = podmanTest.Podman([]string{"run", "--security-opt", "unmask=/sys/fs/cgroup", "--security-opt", "mask=/sys/fs/cgroup", ALPINE, "cat", "/proc/mounts"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(rwOnCGroups))
session = podmanTest.Podman([]string{"run", "--security-opt", "unmask=/sys/fs/cgroup", ALPINE, "ls", "/sys/fs/cgroup"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).ToNot(BeEmpty())
})
@@ -368,32 +369,32 @@ var _ = Describe("Podman run", func() {
session := podmanTest.Podman([]string{"run", "-it", "--privileged", ALPINE, "grep", "Seccomp", "/proc/self/status"})
session.WaitWithDefaultTimeout()
Expect(session.OutputToString()).To(ContainSubstring("0"))
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman run seccomp test no profile should be default", func() {
session := podmanTest.Podman([]string{"run", "-it", ALPINE, "grep", "Seccomp", "/proc/self/status"})
session.WaitWithDefaultTimeout()
Expect(session.OutputToString()).To(ContainSubstring("2"))
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman run capabilities test", func() {
session := podmanTest.Podman([]string{"run", "--rm", "--cap-add", "all", ALPINE, "cat", "/proc/self/status"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--rm", "--cap-add", "sys_admin", ALPINE, "cat", "/proc/self/status"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--rm", "--cap-drop", "all", ALPINE, "cat", "/proc/self/status"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--rm", "--cap-drop", "setuid", ALPINE, "cat", "/proc/self/status"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman run user capabilities test", func() {
@@ -404,67 +405,67 @@ var _ = Describe("Podman run", func() {
}
session := podmanTest.Podman([]string{"run", "--rm", "--user", "bin", ALPINE, "grep", "CapBnd", "/proc/self/status"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("00000000a80425fb"))
session = podmanTest.Podman([]string{"run", "--rm", "--user", "bin", ALPINE, "grep", "CapEff", "/proc/self/status"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("0000000000000000"))
session = podmanTest.Podman([]string{"run", "--rm", "--user", "bin", ALPINE, "grep", "CapInh", "/proc/self/status"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("0000000000000000"))
session = podmanTest.Podman([]string{"run", "--rm", "--user", "root", ALPINE, "grep", "CapBnd", "/proc/self/status"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("00000000a80425fb"))
session = podmanTest.Podman([]string{"run", "--rm", "--user", "root", ALPINE, "grep", "CapEff", "/proc/self/status"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("00000000a80425fb"))
session = podmanTest.Podman([]string{"run", "--rm", "--user", "root", ALPINE, "grep", "CapInh", "/proc/self/status"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("00000000a80425fb"))
session = podmanTest.Podman([]string{"run", "--rm", ALPINE, "grep", "CapBnd", "/proc/self/status"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("00000000a80425fb"))
session = podmanTest.Podman([]string{"run", "--rm", ALPINE, "grep", "CapEff", "/proc/self/status"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("00000000a80425fb"))
session = podmanTest.Podman([]string{"run", "--user=1000:1000", "--cap-add=DAC_OVERRIDE", "--rm", ALPINE, "grep", "CapAmb", "/proc/self/status"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("0000000000000002"))
session = podmanTest.Podman([]string{"run", "--user=1000:1000", "--cap-add=DAC_OVERRIDE", "--rm", ALPINE, "grep", "CapInh", "/proc/self/status"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("0000000000000002"))
session = podmanTest.Podman([]string{"run", "--user=0", "--cap-add=DAC_OVERRIDE", "--rm", ALPINE, "grep", "CapAmb", "/proc/self/status"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("0000000000000000"))
session = podmanTest.Podman([]string{"run", "--user=0:0", "--cap-add=DAC_OVERRIDE", "--rm", ALPINE, "grep", "CapAmb", "/proc/self/status"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("0000000000000000"))
session = podmanTest.Podman([]string{"run", "--user=0:0", "--cap-add=DAC_OVERRIDE", "--rm", ALPINE, "grep", "CapInh", "/proc/self/status"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("00000000a80425fb"))
if os.Geteuid() > 0 {
@@ -476,17 +477,17 @@ var _ = Describe("Podman run", func() {
}
session = podmanTest.Podman([]string{"run", "--userns=keep-id", "--cap-add=DAC_OVERRIDE", "--rm", ALPINE, "grep", "CapAmb", "/proc/self/status"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("0000000000000002"))
session = podmanTest.Podman([]string{"run", "--userns=keep-id", "--privileged", "--rm", ALPINE, "grep", "CapInh", "/proc/self/status"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("0000000000000000"))
session = podmanTest.Podman([]string{"run", "--userns=keep-id", "--cap-add=DAC_OVERRIDE", "--rm", ALPINE, "grep", "CapInh", "/proc/self/status"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("0000000000000002"))
}
})
@@ -502,12 +503,12 @@ USER bin`, BB)
podmanTest.BuildImage(dockerfile, "test", "false")
session := podmanTest.Podman([]string{"run", "--rm", "--user", "bin", "test", "grep", "CapBnd", "/proc/self/status"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("00000000a80425fb"))
session = podmanTest.Podman([]string{"run", "--rm", "--user", "bin", "test", "grep", "CapEff", "/proc/self/status"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("0000000000000000"))
})
@@ -517,29 +518,29 @@ USER bin`, BB)
if !isRootless() {
session := podmanTest.Podman([]string{"run", "--rm", "--ulimit", "rtprio=99", "--cap-add=sys_nice", fedoraMinimal, "cat", "/proc/self/sched"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
}
session := podmanTest.Podman([]string{"run", "--rm", "--ulimit", "nofile=2048:2048", fedoraMinimal, "ulimit", "-n"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("2048"))
session = podmanTest.Podman([]string{"run", "--rm", "--ulimit", "nofile=1024:1028", fedoraMinimal, "ulimit", "-n"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("1024"))
if !CGROUPSV2 {
// --oom-kill-disable not supported on cgroups v2.
session = podmanTest.Podman([]string{"run", "--rm", "--oom-kill-disable=true", fedoraMinimal, "echo", "memory-hog"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
}
session = podmanTest.Podman([]string{"run", "--rm", "--oom-score-adj=111", fedoraMinimal, "cat", "/proc/self/oom_score_adj"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("111"))
})
@@ -553,7 +554,7 @@ USER bin`, BB)
session := podmanTest.Podman([]string{"run", "--rm", "--ulimit", "host", fedoraMinimal, "ulimit", "-Hn"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
ulimitCtrStr := strings.TrimSpace(session.OutputToString())
ulimitCtr, err := strconv.ParseUint(ulimitCtrStr, 10, 0)
@@ -565,7 +566,7 @@ USER bin`, BB)
It("podman run with cidfile", func() {
session := podmanTest.Podman([]string{"run", "--cidfile", tempdir + "cidfile", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
err := os.Remove(tempdir + "cidfile")
Expect(err).To(BeNil())
})
@@ -574,13 +575,13 @@ USER bin`, BB)
SkipIfRootless("Network sysctls are not available root rootless")
session := podmanTest.Podman([]string{"run", "--rm", "--sysctl", "net.core.somaxconn=65535", ALPINE, "sysctl", "net.core.somaxconn"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("net.core.somaxconn = 65535"))
// network sysctls should fail if --net=host is set
session = podmanTest.Podman([]string{"run", "--net", "host", "--rm", "--sysctl", "net.core.somaxconn=65535", ALPINE, "sysctl", "net.core.somaxconn"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
It("podman run blkio-weight test", func() {
@@ -595,7 +596,7 @@ USER bin`, BB)
}
session := podmanTest.Podman([]string{"run", "--rm", "--blkio-weight=15", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/io.bfq.weight"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// there was a documentation issue in the kernel that reported a different range [1-10000] for the io controller.
// older versions of crun/runc used it. For the time being allow both versions to pass the test.
// FIXME: drop "|51" once all the runtimes we test have the fix in place.
@@ -606,7 +607,7 @@ USER bin`, BB)
}
session := podmanTest.Podman([]string{"run", "--rm", "--blkio-weight=15", ALPINE, "cat", "/sys/fs/cgroup/blkio/blkio.weight"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("15"))
}
})
@@ -624,7 +625,7 @@ USER bin`, BB)
}
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
if !CGROUPSV2 { // TODO: Test Simplification. For now, we only care about exit(0) w/ cgroupsv2
Expect(session.OutputToString()).To(ContainSubstring("1048576"))
}
@@ -642,7 +643,7 @@ USER bin`, BB)
session = podmanTest.Podman([]string{"run", "--rm", "--device-write-bps=/dev/zero:1mb", ALPINE, "cat", "/sys/fs/cgroup/blkio/blkio.throttle.write_bps_device"})
}
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
if !CGROUPSV2 { // TODO: Test Simplification. For now, we only care about exit(0) w/ cgroupsv2
Expect(session.OutputToString()).To(ContainSubstring("1048576"))
}
@@ -660,7 +661,7 @@ USER bin`, BB)
}
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
if !CGROUPSV2 { // TODO: Test Simplification. For now, we only care about exit(0) w/ cgroupsv2
Expect(session.OutputToString()).To(ContainSubstring("100"))
}
@@ -678,7 +679,7 @@ USER bin`, BB)
}
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
if !CGROUPSV2 { // TODO: Test Simplification. For now, we only care about exit(0) w/ cgroupsv2
Expect(session.OutputToString()).To(ContainSubstring("100"))
}
@@ -706,7 +707,7 @@ USER bin`, BB)
session := podmanTest.Podman([]string{"run", ALPINE, "printenv", "NOTIFY_SOCKET"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 0))
})
@@ -714,7 +715,7 @@ USER bin`, BB)
log := filepath.Join(podmanTest.TempDir, "/container.log")
session := podmanTest.Podman([]string{"run", "--rm", "--log-driver", "k8s-file", "--log-opt", fmt.Sprintf("path=%s", log), ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
_, err := os.Stat(log)
Expect(err).To(BeNil())
_ = os.Remove(log)
@@ -724,11 +725,11 @@ USER bin`, BB)
podmanTest.AddImageToRWStore(BB)
tag := podmanTest.Podman([]string{"tag", BB, "bb"})
tag.WaitWithDefaultTimeout()
- Expect(tag.ExitCode()).To(Equal(0))
+ Expect(tag).Should(Exit(0))
session := podmanTest.Podman([]string{"run", "--rm", "bb", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman test hooks", func() {
@@ -741,7 +742,7 @@ USER bin`, BB)
session := podmanTest.Podman([]string{"run", ALPINE, "ls"})
session.Wait(10)
os.Unsetenv("HOOK_OPTION")
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman run with subscription secrets", func() {
@@ -771,16 +772,16 @@ USER bin`, BB)
err = ioutil.WriteFile(keyFile, []byte(mountString), 0755)
Expect(err).To(BeNil())
execSession := SystemExec("ln", []string{"-s", targetDir, filepath.Join(secretsDir, "mysymlink")})
- Expect(execSession.ExitCode()).To(Equal(0))
+ Expect(execSession).Should(Exit(0))
session := podmanTest.Podman([]string{"--default-mounts-file=" + mountsFile, "run", "--rm", ALPINE, "cat", "/run/secrets/test.txt"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal(secretsString))
session = podmanTest.Podman([]string{"--default-mounts-file=" + mountsFile, "run", "--rm", ALPINE, "ls", "/run/secrets/mysymlink"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("key.pem"))
})
@@ -792,7 +793,7 @@ USER bin`, BB)
session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "ls", "/run/secrets"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("system-fips"))
err = os.Remove(fipsFile)
@@ -802,63 +803,63 @@ USER bin`, BB)
It("podman run without group-add", func() {
session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "id"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.LineInOutputContains("27(video),777,65533(nogroup)")).To(BeFalse())
})
It("podman run with group-add", func() {
session := podmanTest.Podman([]string{"run", "--rm", "--group-add=audio", "--group-add=nogroup", "--group-add=777", ALPINE, "id"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.LineInOutputContains("777,65533(nogroup)")).To(BeTrue())
})
It("podman run with user (default)", func() {
session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "id"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.LineInOutputContains("uid=0(root) gid=0(root)")).To(BeTrue())
})
It("podman run with user (integer, not in /etc/passwd)", func() {
session := podmanTest.Podman([]string{"run", "--rm", "--user=1234", ALPINE, "id"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("uid=1234(1234) gid=0(root)"))
})
It("podman run with user (integer, in /etc/passwd)", func() {
session := podmanTest.Podman([]string{"run", "--rm", "--user=8", ALPINE, "id"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.LineInOutputContains("uid=8(mail) gid=12(mail)")).To(BeTrue())
})
It("podman run with user (username)", func() {
session := podmanTest.Podman([]string{"run", "--rm", "--user=mail", ALPINE, "id"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.LineInOutputContains("uid=8(mail) gid=12(mail)")).To(BeTrue())
})
It("podman run with user:group (username:integer)", func() {
session := podmanTest.Podman([]string{"run", "--rm", "--user=mail:21", ALPINE, "id"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("uid=8(mail) gid=21(ftp)"))
})
It("podman run with user:group (integer:groupname)", func() {
session := podmanTest.Podman([]string{"run", "--rm", "--user=8:ftp", ALPINE, "id"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("uid=8(mail) gid=21(ftp)"))
})
It("podman run with user, verify caps dropped", func() {
session := podmanTest.Podman([]string{"run", "--rm", "--user=1234", ALPINE, "grep", "CapEff", "/proc/self/status"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
capEff := strings.Split(session.OutputToString(), " ")
Expect("0000000000000000").To(Equal(capEff[1]))
})
@@ -866,10 +867,10 @@ USER bin`, BB)
It("podman run with attach stdin outputs container ID", func() {
session := podmanTest.Podman([]string{"run", "--attach", "stdin", ALPINE, "printenv"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
ps := podmanTest.Podman([]string{"ps", "-aq", "--no-trunc"})
ps.WaitWithDefaultTimeout()
- Expect(ps.ExitCode()).To(Equal(0))
+ Expect(ps).Should(Exit(0))
Expect(ps.LineInOutputContains(session.OutputToString())).To(BeTrue())
})
@@ -882,44 +883,44 @@ USER bin`, BB)
It("podman run with attach stderr does not print stdout", func() {
session := podmanTest.Podman([]string{"run", "--rm", "--attach", "stderr", ALPINE, "ls", "/"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal(""))
})
It("podman run attach nonsense errors", func() {
session := podmanTest.Podman([]string{"run", "--rm", "--attach", "asdfasdf", ALPINE, "ls", "/"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
It("podman run exit code on failure to exec", func() {
session := podmanTest.Podman([]string{"run", ALPINE, "/etc"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(126))
+ Expect(session).Should(Exit(126))
})
It("podman run error on exec", func() {
session := podmanTest.Podman([]string{"run", ALPINE, "sh", "-c", "exit 100"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(100))
+ Expect(session).Should(Exit(100))
})
It("podman run with named volume", func() {
session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "stat", "-c", "%a %Y", "/var/tmp"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
perms := session.OutputToString()
session = podmanTest.Podman([]string{"run", "--rm", "-v", "test:/var/tmp", ALPINE, "stat", "-c", "%a %Y", "/var/tmp"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal(perms))
})
It("podman run with built-in volume image", func() {
session := podmanTest.Podman([]string{"run", "--rm", redis, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
dockerfile := fmt.Sprintf(`FROM %s
RUN mkdir -p /myvol/data && chown -R mail.0 /myvol
@@ -929,7 +930,7 @@ USER mail`, BB)
podmanTest.BuildImage(dockerfile, "test", "false")
session = podmanTest.Podman([]string{"run", "--rm", "test", "ls", "-al", "/myvol/data"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("mail root"))
})
@@ -947,21 +948,21 @@ USER mail`, BB)
session := podmanTest.Podman([]string{"create", "--volume", vol + ":" + mountpoint, ALPINE, "cat", mountpoint + filename})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
ctrID := session.OutputToString()
session = podmanTest.Podman([]string{"run", "--volumes-from", ctrID, ALPINE, "cat", mountpoint + filename})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal(data))
session = podmanTest.Podman([]string{"run", "--volumes-from", ctrID, ALPINE, "sh", "-c", "echo test >> " + mountpoint + filename})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"start", "--attach", ctrID})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal(data + "test"))
})
@@ -979,55 +980,55 @@ USER mail`, BB)
session := podmanTest.Podman([]string{"create", "--volume", vol + ":" + mountpoint, ALPINE, "cat", mountpoint + filename})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
ctrID := session.OutputToString()
// check that the read only option works
session = podmanTest.Podman([]string{"run", "--volumes-from", ctrID + ":ro", ALPINE, "touch", mountpoint + "abc.txt"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(1))
+ Expect(session).Should(Exit(1))
Expect(session.ErrorToString()).To(ContainSubstring("Read-only file system"))
// check that both z and ro options work
session = podmanTest.Podman([]string{"run", "--volumes-from", ctrID + ":ro,z", ALPINE, "cat", mountpoint + filename})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal(data))
// check that multiple ro/rw are not working
session = podmanTest.Podman([]string{"run", "--volumes-from", ctrID + ":ro,rw", ALPINE, "cat", mountpoint + filename})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
Expect(session.ErrorToString()).To(ContainSubstring("cannot set ro or rw options more than once"))
// check that multiple z options are not working
session = podmanTest.Podman([]string{"run", "--volumes-from", ctrID + ":z,z,ro", ALPINE, "cat", mountpoint + filename})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
Expect(session.ErrorToString()).To(ContainSubstring("cannot set :z more than once in mount options"))
// create new read only volume
session = podmanTest.Podman([]string{"create", "--volume", vol + ":" + mountpoint + ":ro", ALPINE, "cat", mountpoint + filename})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
ctrID = session.OutputToString()
// check if the original volume was mounted as read only that --volumes-from also mount it as read only
session = podmanTest.Podman([]string{"run", "--volumes-from", ctrID, ALPINE, "touch", mountpoint + "abc.txt"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(1))
+ Expect(session).Should(Exit(1))
Expect(session.ErrorToString()).To(ContainSubstring("Read-only file system"))
})
It("podman run --volumes-from flag with built-in volumes", func() {
session := podmanTest.Podman([]string{"create", redis, "sh"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
ctrID := session.OutputToString()
session = podmanTest.Podman([]string{"run", "--volumes-from", ctrID, ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("data"))
})
@@ -1041,7 +1042,7 @@ USER mail`, BB)
session := podmanTest.Podman([]string{"run", "--volume", vol1 + ":/myvol1:z", "--volume", vol2 + ":/myvol2:z", ALPINE, "touch", "/myvol2/foo.txt"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman run --volumes flag with empty host dir", func() {
@@ -1069,7 +1070,7 @@ USER mail`, BB)
session := podmanTest.Podman([]string{"run", "--mount", "type=bind,src=" + vol1 + ",target=/myvol1,z", "--mount", "type=bind,src=" + vol2 + ",target=/myvol2,z", ALPINE, "touch", "/myvol2/foo.txt"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman run findmnt nothing shared", func() {
@@ -1082,7 +1083,7 @@ USER mail`, BB)
session := podmanTest.Podman([]string{"run", "--volume", vol1 + ":/myvol1:z", "--volume", vol2 + ":/myvol2:z", fedoraMinimal, "findmnt", "-o", "TARGET,PROPAGATION"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, _ := session.GrepString("shared")
Expect(match).Should(BeFalse())
})
@@ -1097,7 +1098,7 @@ USER mail`, BB)
session := podmanTest.Podman([]string{"run", "--volume", vol1 + ":/myvol1:z", "--volume", vol2 + ":/myvol2:shared,z", fedoraMinimal, "findmnt", "-o", "TARGET,PROPAGATION"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
match, shared := session.GrepString("shared")
Expect(match).Should(BeTrue())
// make sure it's only shared (and not 'shared,slave')
@@ -1108,7 +1109,7 @@ USER mail`, BB)
It("podman run --security-opts proc-opts=", func() {
session := podmanTest.Podman([]string{"run", "--security-opt", "proc-opts=nosuid,exec", fedoraMinimal, "findmnt", "-noOPTIONS", "/proc"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
output := session.OutputToString()
Expect(output).To(ContainSubstring("nosuid"))
Expect(output).To(Not(ContainSubstring("exec")))
@@ -1118,25 +1119,25 @@ USER mail`, BB)
SkipIfRootless("FIXME: rootless users are not allowed to mount bind-nonrecursive (Could this be a Kernel bug?")
session := podmanTest.Podman([]string{"run", "--mount", "type=bind,bind-nonrecursive,slave,src=/,target=/host", fedoraMinimal, "findmnt", "-nR", "/host"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(1))
})
It("podman run --mount type=devpts,target=/foo/bar", func() {
session := podmanTest.Podman([]string{"run", "--mount", "type=devpts,target=/foo/bar", fedoraMinimal, "stat", "-f", "-c%T", "/foo/bar"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("devpts"))
})
It("podman run --pod automatically", func() {
session := podmanTest.Podman([]string{"run", "-d", "--pod", "new:foobar", ALPINE, "nc", "-l", "-p", "8080"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--pod", "foobar", ALPINE, "/bin/sh", "-c", "echo test | nc -w 1 127.0.0.1 8080"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
check := podmanTest.Podman([]string{"pod", "ps", "--no-trunc"})
check.WaitWithDefaultTimeout()
@@ -1148,14 +1149,14 @@ USER mail`, BB)
hostname := "abc"
session := podmanTest.Podman([]string{"run", "--pod", "new:foobar", "--hostname", hostname, ALPINE, "cat", "/etc/hostname"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(hostname))
})
It("podman run --rm should work", func() {
session := podmanTest.Podman([]string{"run", "--name", "test", "--rm", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"wait", "test"})
session.WaitWithDefaultTimeout()
Expect(session).To(ExitWithError())
@@ -1191,7 +1192,7 @@ USER mail`, BB)
It("podman run readonly container should NOT mount /dev/shm read/only", func() {
session := podmanTest.Podman([]string{"run", "--read-only", ALPINE, "mount"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Not(ContainSubstring("/dev/shm type tmpfs (ro,")))
})
@@ -1199,7 +1200,7 @@ USER mail`, BB)
It("podman run readonly container should NOT mount /run noexec", func() {
session := podmanTest.Podman([]string{"run", "--read-only", ALPINE, "sh", "-c", "mount | grep \"/run \""})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Not(ContainSubstring("noexec")))
})
@@ -1280,7 +1281,7 @@ USER mail`, BB)
container := podmanTest.Podman([]string{"run", "--rm", "--cgroups=split", ALPINE, "cat", "/proc/self/cgroup"})
container.WaitWithDefaultTimeout()
- Expect(container.ExitCode()).To(Equal(0))
+ Expect(container).Should(Exit(0))
lines := container.OutputToStringArray()
cgroup := ""
@@ -1322,7 +1323,7 @@ USER mail`, BB)
ctrName := "testctr"
container := podmanTest.Podman([]string{"run", "--name", ctrName, "-d", "--cgroups=disabled", ALPINE, "top"})
container.WaitWithDefaultTimeout()
- Expect(container.ExitCode()).To(Equal(0))
+ Expect(container).Should(Exit(0))
// Get PID and get cgroups of that PID
inspectOut := podmanTest.InspectContainer(ctrName)
@@ -1354,7 +1355,7 @@ USER mail`, BB)
ctrName := "testctr"
container := podmanTest.Podman([]string{"run", "--name", ctrName, "-d", "--cgroups=enabled", ALPINE, "top"})
container.WaitWithDefaultTimeout()
- Expect(container.ExitCode()).To(Equal(0))
+ Expect(container).Should(Exit(0))
// Get PID and get cgroups of that PID
inspectOut := podmanTest.InspectContainer(ctrName)
@@ -1378,7 +1379,7 @@ USER mail`, BB)
It("podman run should fail with nonexistent authfile", func() {
session := podmanTest.Podman([]string{"run", "--authfile", "/tmp/nonexistent", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
})
It("podman run --device-cgroup-rule", func() {
@@ -1386,24 +1387,24 @@ USER mail`, BB)
deviceCgroupRule := "c 42:* rwm"
session := podmanTest.Podman([]string{"run", "--cap-add", "mknod", "--name", "test", "-d", "--device-cgroup-rule", deviceCgroupRule, ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"exec", "test", "mknod", "newDev", "c", "42", "1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman run --replace", func() {
// Make sure we error out with --name.
session := podmanTest.Podman([]string{"create", "--replace", ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
// Run and replace 5 times in a row the "same" container.
ctrName := "testCtr"
for i := 0; i < 5; i++ {
session := podmanTest.Podman([]string{"run", "--detach", "--replace", "--name", ctrName, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
}
})
@@ -1416,13 +1417,13 @@ USER mail`, BB)
}
session := podmanTest.PodmanExtraFiles([]string{"run", "--preserve-fds", "1", ALPINE, "ls"}, files)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman run --preserve-fds invalid fd", func() {
session := podmanTest.Podman([]string{"run", "--preserve-fds", "2", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
Expect(session.ErrorToString()).To(ContainSubstring("file descriptor 3 is not available"))
})
@@ -1430,7 +1431,7 @@ USER mail`, BB)
groupName := "kvm"
session := podmanTest.Podman([]string{"run", "-t", "-i", "--group-add", groupName, "--privileged", fedoraMinimal, "groups"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(strings.Contains(session.OutputToString(), groupName)).To(BeTrue())
})
@@ -1450,7 +1451,7 @@ USER mail`, BB)
badTZFile := fmt.Sprintf("../../../%s", tzFile)
session := podmanTest.Podman([]string{"run", "--tz", badTZFile, "--rm", ALPINE, "date"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
Expect(session.ErrorToString()).To(ContainSubstring("error finding timezone for container"))
err = os.Remove(tzFile)
@@ -1458,20 +1459,20 @@ USER mail`, BB)
session = podmanTest.Podman([]string{"run", "--tz", "foo", "--rm", ALPINE, "date"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
session = podmanTest.Podman([]string{"run", "--tz", "America", "--rm", ALPINE, "date"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
session = podmanTest.Podman([]string{"run", "--tz", "Pacific/Honolulu", "--rm", ALPINE, "date", "+'%H %Z'"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("HST"))
session = podmanTest.Podman([]string{"run", "--tz", "local", "--rm", ALPINE, "date", "+'%H %Z'"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
t := time.Now()
z, _ := t.Zone()
h := strconv.Itoa(t.Hour())
@@ -1485,7 +1486,7 @@ USER mail`, BB)
limit := "4321"
session := podmanTest.Podman([]string{"run", "--pids-limit", limit, "--net=none", "--rm", ALPINE, "cat", "/sys/fs/cgroup/pids.max"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(limit))
})
@@ -1496,27 +1497,27 @@ USER mail`, BB)
session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "sh", "-c", "umask"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("0022"))
session = podmanTest.Podman([]string{"run", "--umask", "0002", "--rm", ALPINE, "sh", "-c", "umask"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("0002"))
session = podmanTest.Podman([]string{"run", "--umask", "0077", "--rm", fedoraMinimal, "umask"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("0077"))
session = podmanTest.Podman([]string{"run", "--umask", "22", "--rm", ALPINE, "sh", "-c", "umask"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("0022"))
session = podmanTest.Podman([]string{"run", "--umask", "9999", "--rm", ALPINE, "sh", "-c", "umask"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
Expect(session.ErrorToString()).To(ContainSubstring("Invalid umask"))
})
@@ -1527,14 +1528,14 @@ WORKDIR /madethis`, BB)
podmanTest.BuildImage(dockerfile, "test", "false")
session := podmanTest.Podman([]string{"run", "--rm", "test", "pwd"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("/madethis"))
})
It("podman run --entrypoint does not use image command", func() {
session := podmanTest.Podman([]string{"run", "--entrypoint", "/bin/echo", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// We can't guarantee the output is completely empty, some
// nonprintables seem to work their way in.
Expect(session.OutputToString()).To(Not(ContainSubstring("/bin/sh")))
@@ -1543,42 +1544,42 @@ WORKDIR /madethis`, BB)
It("podman run a container with log-level (lower case)", func() {
session := podmanTest.Podman([]string{"--log-level=info", "run", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman run a container with log-level (upper case)", func() {
session := podmanTest.Podman([]string{"--log-level=INFO", "run", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman run a container with --pull never should fail if no local store", func() {
session := podmanTest.Podman([]string{"run", "--pull", "never", "docker.io/library/debian:latest", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
It("podman run container with --pull missing and only pull once", func() {
session := podmanTest.Podman([]string{"run", "--pull", "missing", cirros, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.ErrorToString()).To(ContainSubstring("Trying to pull"))
session = podmanTest.Podman([]string{"run", "--pull", "missing", cirros, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.ErrorToString()).ToNot(ContainSubstring("Trying to pull"))
})
It("podman run container with --pull missing should pull image multiple times", func() {
session := podmanTest.Podman([]string{"run", "--pull", "always", cirros, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.ErrorToString()).To(ContainSubstring("Trying to pull"))
session = podmanTest.Podman([]string{"run", "--pull", "always", cirros, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.ErrorToString()).To(ContainSubstring("Trying to pull"))
})
@@ -1586,7 +1587,7 @@ WORKDIR /madethis`, BB)
hostnameEnv := "test123"
session := podmanTest.Podman([]string{"run", "--hostname", "testctr", "--env", fmt.Sprintf("HOSTNAME=%s", hostnameEnv), ALPINE, "printenv", "HOSTNAME"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(hostnameEnv))
})
@@ -1598,16 +1599,16 @@ WORKDIR /madethis`, BB)
session := podmanTest.Podman([]string{"secret", "create", "mysecret", secretFilePath})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--secret", "mysecret", "--name", "secr", ALPINE, "cat", "/run/secrets/mysecret"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal(secretsString))
session = podmanTest.Podman([]string{"inspect", "secr", "--format", " {{(index .Config.Secrets 0).Name}}"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("mysecret"))
})
@@ -1620,16 +1621,16 @@ WORKDIR /madethis`, BB)
session := podmanTest.Podman([]string{"secret", "create", "mysecret", secretFilePath})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--secret", "source=mysecret,type=mount", "--name", "secr", ALPINE, "cat", "/run/secrets/mysecret"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal(secretsString))
session = podmanTest.Podman([]string{"inspect", "secr", "--format", " {{(index .Config.Secrets 0).Name}}"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("mysecret"))
})
@@ -1642,11 +1643,11 @@ WORKDIR /madethis`, BB)
session := podmanTest.Podman([]string{"secret", "create", "mysecret", secretFilePath})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--secret", "source=mysecret,type=env", "--name", "secr", ALPINE, "printenv", "mysecret"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal(secretsString))
})
@@ -1658,15 +1659,15 @@ WORKDIR /madethis`, BB)
session := podmanTest.Podman([]string{"secret", "create", "mysecret", secretFilePath})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// target with mount type should fail
session = podmanTest.Podman([]string{"run", "--secret", "source=mysecret,type=mount,target=anotherplace", "--name", "secr", ALPINE, "cat", "/run/secrets/mysecret"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
session = podmanTest.Podman([]string{"run", "--secret", "source=mysecret,type=env,target=anotherplace", "--name", "secr", ALPINE, "printenv", "anotherplace"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal(secretsString))
})
@@ -1678,19 +1679,19 @@ WORKDIR /madethis`, BB)
session := podmanTest.Podman([]string{"secret", "create", "mysecret", secretFilePath})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// check default permissions
session = podmanTest.Podman([]string{"run", "--secret", "mysecret", "--name", "secr", ALPINE, "ls", "-l", "/run/secrets/mysecret"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
output := session.OutputToString()
Expect(output).To(ContainSubstring("-r--r--r--"))
Expect(output).To(ContainSubstring("root"))
session = podmanTest.Podman([]string{"run", "--secret", "source=mysecret,type=mount,uid=1000,gid=1001,mode=777", "--name", "secr2", ALPINE, "ls", "-ln", "/run/secrets/mysecret"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
output = session.OutputToString()
Expect(output).To(ContainSubstring("-rwxrwxrwx"))
Expect(output).To(ContainSubstring("1000"))
@@ -1705,11 +1706,11 @@ WORKDIR /madethis`, BB)
session := podmanTest.Podman([]string{"secret", "create", "mysecret", secretFilePath})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--secret", "mysecret", "--name", "nonroot", "--user", "200:200", ALPINE, "cat", "/run/secrets/mysecret"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal(secretsString))
})
@@ -1721,56 +1722,56 @@ WORKDIR /madethis`, BB)
session := podmanTest.Podman([]string{"secret", "create", "mysecret", secretFilePath})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Invalid type
session = podmanTest.Podman([]string{"run", "--secret", "source=mysecret,type=other", "--name", "secr", ALPINE, "printenv", "mysecret"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
// Invalid option
session = podmanTest.Podman([]string{"run", "--secret", "source=mysecret,invalid=invalid", "--name", "secr", ALPINE, "printenv", "mysecret"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
// Option syntax not valid
session = podmanTest.Podman([]string{"run", "--secret", "source=mysecret,type", "--name", "secr", ALPINE, "printenv", "mysecret"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
// mount option with env type
session = podmanTest.Podman([]string{"run", "--secret", "source=mysecret,type=env,uid=1000", "--name", "secr", ALPINE, "printenv", "mysecret"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
// No source given
session = podmanTest.Podman([]string{"run", "--secret", "type=env", "--name", "secr", ALPINE, "printenv", "mysecret"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
})
It("podman run --requires", func() {
depName := "ctr1"
depContainer := podmanTest.Podman([]string{"create", "--name", depName, ALPINE, "top"})
depContainer.WaitWithDefaultTimeout()
- Expect(depContainer.ExitCode()).To(Equal(0))
+ Expect(depContainer).Should(Exit(0))
mainName := "ctr2"
mainContainer := podmanTest.Podman([]string{"run", "--name", mainName, "--requires", depName, "-d", ALPINE, "top"})
mainContainer.WaitWithDefaultTimeout()
- Expect(mainContainer.ExitCode()).To(Equal(0))
+ Expect(mainContainer).Should(Exit(0))
stop := podmanTest.Podman([]string{"stop", "--all"})
stop.WaitWithDefaultTimeout()
- Expect(stop.ExitCode()).To(Equal(0))
+ Expect(stop).Should(Exit(0))
start := podmanTest.Podman([]string{"start", mainName})
start.WaitWithDefaultTimeout()
- Expect(start.ExitCode()).To(Equal(0))
+ Expect(start).Should(Exit(0))
running := podmanTest.Podman([]string{"ps", "-q"})
running.WaitWithDefaultTimeout()
- Expect(running.ExitCode()).To(Equal(0))
+ Expect(running).Should(Exit(0))
Expect(len(running.OutputToStringArray())).To(Equal(2))
})
@@ -1779,7 +1780,7 @@ WORKDIR /madethis`, BB)
pidfile := tempdir + "pidfile"
session := podmanTest.Podman([]string{"run", "--pidfile", pidfile, ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
readFirstLine := func(path string) string {
content, err := ioutil.ReadFile(path)
Expect(err).To(BeNil())
diff --git a/test/e2e/run_userns_test.go b/test/e2e/run_userns_test.go
index 79ef707a2..1fe95a1bf 100644
--- a/test/e2e/run_userns_test.go
+++ b/test/e2e/run_userns_test.go
@@ -10,6 +10,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman UserNS support", func() {
@@ -45,7 +46,7 @@ var _ = Describe("Podman UserNS support", func() {
It("podman uidmapping and gidmapping", func() {
session := podmanTest.Podman([]string{"run", "--uidmap=0:100:5000", "--gidmap=0:200:5000", "alpine", "echo", "hello"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
ok, _ := session.GrepString("hello")
Expect(ok).To(BeTrue())
})
@@ -57,7 +58,7 @@ var _ = Describe("Podman UserNS support", func() {
It("podman uidmapping and gidmapping with short-opts", func() {
session := podmanTest.Podman([]string{"run", "--uidmap=0:1:5000", "--gidmap=0:200:5000", "-it", "alpine", "echo", "hello"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
ok, _ := session.GrepString("hello")
Expect(ok).To(BeTrue())
})
@@ -65,7 +66,7 @@ var _ = Describe("Podman UserNS support", func() {
It("podman uidmapping and gidmapping with a volume", func() {
session := podmanTest.Podman([]string{"run", "--uidmap=0:1:500", "--gidmap=0:200:5000", "-v", "my-foo-volume:/foo:Z", "alpine", "echo", "hello"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
ok, _ := session.GrepString("hello")
Expect(ok).To(BeTrue())
})
@@ -73,7 +74,7 @@ var _ = Describe("Podman UserNS support", func() {
It("podman uidmapping and gidmapping --net=host", func() {
session := podmanTest.Podman([]string{"run", "--net=host", "--uidmap=0:1:5000", "--gidmap=0:200:5000", "alpine", "echo", "hello"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
ok, _ := session.GrepString("hello")
Expect(ok).To(BeTrue())
})
@@ -81,7 +82,7 @@ var _ = Describe("Podman UserNS support", func() {
It("podman --userns=keep-id", func() {
session := podmanTest.Podman([]string{"run", "--userns=keep-id", "alpine", "id", "-u"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
uid := fmt.Sprintf("%d", os.Geteuid())
ok, _ := session.GrepString(uid)
Expect(ok).To(BeTrue())
@@ -90,7 +91,7 @@ var _ = Describe("Podman UserNS support", func() {
It("podman --userns=keep-id check passwd", func() {
session := podmanTest.Podman([]string{"run", "--userns=keep-id", "alpine", "id", "-un"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
u, err := user.Current()
Expect(err).To(BeNil())
ok, _ := session.GrepString(u.Name)
@@ -100,14 +101,14 @@ var _ = Describe("Podman UserNS support", func() {
It("podman --userns=keep-id root owns /usr", func() {
session := podmanTest.Podman([]string{"run", "--userns=keep-id", "alpine", "stat", "-c%u", "/usr"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("0"))
})
It("podman --userns=keep-id --user root:root", func() {
session := podmanTest.Podman([]string{"run", "--userns=keep-id", "--user", "root:root", "alpine", "id", "-u"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("0"))
})
@@ -124,16 +125,16 @@ var _ = Describe("Podman UserNS support", func() {
ctrName := "ctr-name"
session := podmanTest.Podman([]string{"run", "--userns=keep-id", "--user", "root:root", "-d", "--stop-signal", "9", "--name", ctrName, fedoraMinimal, "sleep", "600"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
exec1 := podmanTest.Podman([]string{"exec", "-t", "-i", ctrName, "cat", "/etc/passwd"})
exec1.WaitWithDefaultTimeout()
- Expect(exec1.ExitCode()).To(Equal(0))
+ Expect(exec1).Should(Exit(0))
Expect(exec1.OutputToString()).To(ContainSubstring(userName))
exec2 := podmanTest.Podman([]string{"exec", "-t", "-i", ctrName, "useradd", "testuser"})
exec2.WaitWithDefaultTimeout()
- Expect(exec2.ExitCode()).To(Equal(0))
+ Expect(exec2).Should(Exit(0))
})
It("podman --userns=auto", func() {
@@ -156,7 +157,7 @@ var _ = Describe("Podman UserNS support", func() {
for i := 0; i < 5; i++ {
session := podmanTest.Podman([]string{"run", "--userns=auto", "alpine", "cat", "/proc/self/uid_map"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
l := session.OutputToString()
Expect(strings.Contains(l, "1024")).To(BeTrue())
m[l] = l
@@ -184,22 +185,22 @@ var _ = Describe("Podman UserNS support", func() {
session := podmanTest.Podman([]string{"run", "--userns=auto:size=500", "alpine", "cat", "/proc/self/uid_map"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
ok, _ := session.GrepString("500")
session = podmanTest.Podman([]string{"run", "--userns=auto:size=3000", "alpine", "cat", "/proc/self/uid_map"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
ok, _ = session.GrepString("3000")
session = podmanTest.Podman([]string{"run", "--userns=auto", "--user=2000:3000", "alpine", "cat", "/proc/self/uid_map"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
ok, _ = session.GrepString("3001")
session = podmanTest.Podman([]string{"run", "--userns=auto", "--user=4000:1000", "alpine", "cat", "/proc/self/uid_map"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
ok, _ = session.GrepString("4001")
Expect(ok).To(BeTrue())
})
@@ -223,13 +224,13 @@ var _ = Describe("Podman UserNS support", func() {
session := podmanTest.Podman([]string{"run", "--userns=auto:uidmapping=0:0:1", "alpine", "cat", "/proc/self/uid_map"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
output := session.OutputToString()
Expect(output).To(MatchRegexp("\\s0\\s0\\s1"))
session = podmanTest.Podman([]string{"run", "--userns=auto:size=8192,uidmapping=0:0:1", "alpine", "cat", "/proc/self/uid_map"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
ok, _ := session.GrepString("8191")
Expect(ok).To(BeTrue())
})
@@ -253,13 +254,13 @@ var _ = Describe("Podman UserNS support", func() {
session := podmanTest.Podman([]string{"run", "--userns=auto:gidmapping=0:0:1", "alpine", "cat", "/proc/self/gid_map"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
output := session.OutputToString()
Expect(output).To(MatchRegexp("\\s0\\s0\\s1"))
session = podmanTest.Podman([]string{"run", "--userns=auto:size=8192,gidmapping=0:0:1", "alpine", "cat", "/proc/self/gid_map"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
ok, _ := session.GrepString("8191")
Expect(ok).To(BeTrue())
})
@@ -268,19 +269,19 @@ var _ = Describe("Podman UserNS support", func() {
ctrName := "userns-ctr"
session := podmanTest.Podman([]string{"run", "-d", "--uidmap=0:0:1", "--uidmap=1:1:4998", "--name", ctrName, "alpine", "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// runc has an issue and we also need to join the IPC namespace.
session = podmanTest.Podman([]string{"run", "--rm", "--userns=container:" + ctrName, "--ipc=container:" + ctrName, "alpine", "cat", "/proc/self/uid_map"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
ok, _ := session.GrepString("4998")
Expect(ok).To(BeTrue())
session = podmanTest.Podman([]string{"run", "--rm", "--userns=container:" + ctrName, "--net=container:" + ctrName, "alpine", "cat", "/proc/self/uid_map"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
ok, _ = session.GrepString("4998")
Expect(ok).To(BeTrue())
@@ -298,17 +299,17 @@ var _ = Describe("Podman UserNS support", func() {
for _, tt := range tests {
session := podmanTest.Podman([]string{"run", "-d", "--user", tt.arg, "--mount", "type=volume,src=" + tt.vol + ",dst=/home/user", "alpine", "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
inspectUID := podmanTest.Podman([]string{"volume", "inspect", "--format", "{{ .UID }}", tt.vol})
inspectUID.WaitWithDefaultTimeout()
- Expect(inspectUID.ExitCode()).To(Equal(0))
+ Expect(inspectUID).Should(Exit(0))
Expect(inspectUID.OutputToString()).To(Equal(tt.uid))
// Make sure we're defaulting to 0.
inspectGID := podmanTest.Podman([]string{"volume", "inspect", "--format", "{{ .GID }}", tt.vol})
inspectGID.WaitWithDefaultTimeout()
- Expect(inspectGID.ExitCode()).To(Equal(0))
+ Expect(inspectGID).Should(Exit(0))
Expect(inspectGID.OutputToString()).To(Equal(tt.gid))
}
})
diff --git a/test/e2e/run_volume_test.go b/test/e2e/run_volume_test.go
index 4be1b2009..d1f6ea80e 100644
--- a/test/e2e/run_volume_test.go
+++ b/test/e2e/run_volume_test.go
@@ -13,7 +13,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
- "github.com/onsi/gomega/gexec"
+ . "github.com/onsi/gomega/gexec"
)
// in-container mount point: using a path that is definitely not present
@@ -50,21 +50,21 @@ var _ = Describe("Podman run with volumes", func() {
session := podmanTest.Podman([]string{"run", "--rm", "-v", vol, ALPINE, "grep", dest, "/proc/self/mountinfo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
found, matches := session.GrepString(dest)
Expect(found).Should(BeTrue())
Expect(matches[0]).To(ContainSubstring("rw"))
session = podmanTest.Podman([]string{"run", "--rm", "-v", vol + ":ro", ALPINE, "grep", dest, "/proc/self/mountinfo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
found, matches = session.GrepString(dest)
Expect(found).Should(BeTrue())
Expect(matches[0]).To(ContainSubstring("ro"))
session = podmanTest.Podman([]string{"run", "--rm", "-v", vol + ":shared", ALPINE, "grep", dest, "/proc/self/mountinfo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
found, matches = session.GrepString(dest)
Expect(found).Should(BeTrue())
Expect(matches[0]).To(ContainSubstring("rw"))
@@ -73,7 +73,7 @@ var _ = Describe("Podman run with volumes", func() {
// Cached is ignored
session = podmanTest.Podman([]string{"run", "--rm", "-v", vol + ":cached", ALPINE, "grep", dest, "/proc/self/mountinfo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
found, matches = session.GrepString(dest)
Expect(found).Should(BeTrue())
Expect(matches[0]).To(ContainSubstring("rw"))
@@ -82,7 +82,7 @@ var _ = Describe("Podman run with volumes", func() {
// Delegated is ignored
session = podmanTest.Podman([]string{"run", "--rm", "-v", vol + ":delegated", ALPINE, "grep", dest, "/proc/self/mountinfo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
found, matches = session.GrepString(dest)
Expect(found).Should(BeTrue())
Expect(matches[0]).To(ContainSubstring("rw"))
@@ -99,22 +99,22 @@ var _ = Describe("Podman run with volumes", func() {
session := podmanTest.Podman([]string{"run", "--rm", "--mount", mount, ALPINE, "grep", dest, "/proc/self/mountinfo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(dest + " rw"))
session = podmanTest.Podman([]string{"run", "--rm", "--mount", mount + ",ro", ALPINE, "grep", dest, "/proc/self/mountinfo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(dest + " ro"))
session = podmanTest.Podman([]string{"run", "--rm", "--mount", mount + ",readonly", ALPINE, "grep", dest, "/proc/self/mountinfo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(dest + " ro"))
session = podmanTest.Podman([]string{"run", "--rm", "--mount", mount + ",consistency=delegated,shared", ALPINE, "grep", dest, "/proc/self/mountinfo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
found, matches := session.GrepString(dest)
Expect(found).Should(BeTrue())
Expect(matches[0]).To(ContainSubstring("rw"))
@@ -122,29 +122,29 @@ var _ = Describe("Podman run with volumes", func() {
session = podmanTest.Podman([]string{"run", "--rm", "--mount", "type=tmpfs,target=" + dest, ALPINE, "grep", dest, "/proc/self/mountinfo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(dest + " rw,nosuid,nodev,relatime - tmpfs"))
session = podmanTest.Podman([]string{"run", "--rm", "--mount", "type=tmpfs,target=/etc/ssl,tmpcopyup", ALPINE, "ls", "/etc/ssl"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("certs"))
session = podmanTest.Podman([]string{"run", "--rm", "--mount", "type=tmpfs,target=/etc/ssl,tmpcopyup,notmpcopyup", ALPINE, "ls", "/etc/ssl"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
session = podmanTest.Podman([]string{"run", "--rm", "--mount", "type=bind,src=/tmp,target=/tmp,tmpcopyup", ALPINE, "true"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
session = podmanTest.Podman([]string{"run", "--rm", "--mount", "type=bind,src=/tmp,target=/tmp,notmpcopyup", ALPINE, "true"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
session = podmanTest.Podman([]string{"run", "--rm", "--mount", "type=tmpfs,target=/etc/ssl,notmpcopyup", ALPINE, "ls", "/etc/ssl"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Not(ContainSubstring("certs")))
})
@@ -153,7 +153,7 @@ var _ = Describe("Podman run with volumes", func() {
os.Mkdir(mountPath, 0755)
session := podmanTest.Podman([]string{"run", "-v", mountPath + ":" + dest, "-v", "/tmp" + ":" + dest, ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
It("podman run with conflict between image volume and user mount succeeds", func() {
@@ -167,7 +167,7 @@ var _ = Describe("Podman run with volumes", func() {
Expect(err).To(BeNil())
session := podmanTest.Podman([]string{"run", "-v", fmt.Sprintf("%s:/data", mountPath), redis, "ls", "/data/test1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman run with mount flag and boolean options", func() {
@@ -177,12 +177,12 @@ var _ = Describe("Podman run with volumes", func() {
session := podmanTest.Podman([]string{"run", "--rm", "--mount", mount + ",ro=false", ALPINE, "grep", dest, "/proc/self/mountinfo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(dest + " rw"))
session = podmanTest.Podman([]string{"run", "--rm", "--mount", mount + ",ro=true", ALPINE, "grep", dest, "/proc/self/mountinfo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(dest + " ro"))
session = podmanTest.Podman([]string{"run", "--rm", "--mount", mount + ",ro=true,rw=false", ALPINE, "grep", dest, "/proc/self/mountinfo"})
@@ -193,7 +193,7 @@ var _ = Describe("Podman run with volumes", func() {
It("podman run with volume flag and multiple named volumes", func() {
session := podmanTest.Podman([]string{"run", "--rm", "-v", "testvol1:/testvol1", "-v", "testvol2:/testvol2", ALPINE, "grep", "/testvol", "/proc/self/mountinfo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("/testvol1"))
Expect(session.OutputToString()).To(ContainSubstring("/testvol2"))
})
@@ -205,7 +205,7 @@ var _ = Describe("Podman run with volumes", func() {
session := podmanTest.Podman([]string{"run", "--rm", "-v", mountPath + ":" + dest + ":suid,dev,exec", ALPINE, "grep", dest, "/proc/self/mountinfo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
found, matches := session.GrepString(dest)
Expect(found).Should(BeTrue())
Expect(matches[0]).To(Not(ContainSubstring("noexec")))
@@ -214,7 +214,7 @@ var _ = Describe("Podman run with volumes", func() {
session = podmanTest.Podman([]string{"run", "--rm", "--tmpfs", dest + ":suid,dev,exec", ALPINE, "grep", dest, "/proc/self/mountinfo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
found, matches = session.GrepString(dest)
Expect(found).Should(BeTrue())
Expect(matches[0]).To(Not(ContainSubstring("noexec")))
@@ -234,13 +234,13 @@ var _ = Describe("Podman run with volumes", func() {
volName := "testvol"
mkVolume := podmanTest.Podman([]string{"volume", "create", "--opt", "type=tmpfs", "--opt", "device=tmpfs", "--opt", "o=nodev", "testvol"})
mkVolume.WaitWithDefaultTimeout()
- Expect(mkVolume.ExitCode()).To(Equal(0))
+ Expect(mkVolume).Should(Exit(0))
// Volume not mounted on create
- mountCmd1, err := gexec.Start(exec.Command("mount"), GinkgoWriter, GinkgoWriter)
+ mountCmd1, err := Start(exec.Command("mount"), GinkgoWriter, GinkgoWriter)
Expect(err).To(BeNil())
mountCmd1.Wait(90)
- Expect(mountCmd1.ExitCode()).To(Equal(0))
+ Expect(mountCmd1).Should(Exit(0))
os.Stdout.Sync()
os.Stderr.Sync()
mountOut1 := strings.Join(strings.Fields(string(mountCmd1.Out.Contents())), " ")
@@ -250,13 +250,13 @@ var _ = Describe("Podman run with volumes", func() {
ctrName := "testctr"
podmanSession := podmanTest.Podman([]string{"run", "-d", "--name", ctrName, "-v", fmt.Sprintf("%s:/testvol", volName), ALPINE, "top"})
podmanSession.WaitWithDefaultTimeout()
- Expect(podmanSession.ExitCode()).To(Equal(0))
+ Expect(podmanSession).Should(Exit(0))
// Volume now mounted as container is running
- mountCmd2, err := gexec.Start(exec.Command("mount"), GinkgoWriter, GinkgoWriter)
+ mountCmd2, err := Start(exec.Command("mount"), GinkgoWriter, GinkgoWriter)
Expect(err).To(BeNil())
mountCmd2.Wait(90)
- Expect(mountCmd2.ExitCode()).To(Equal(0))
+ Expect(mountCmd2).Should(Exit(0))
os.Stdout.Sync()
os.Stderr.Sync()
mountOut2 := strings.Join(strings.Fields(string(mountCmd2.Out.Contents())), " ")
@@ -266,18 +266,18 @@ var _ = Describe("Podman run with volumes", func() {
// Stop the container to unmount
podmanStopSession := podmanTest.Podman([]string{"stop", "--time", "0", ctrName})
podmanStopSession.WaitWithDefaultTimeout()
- Expect(podmanStopSession.ExitCode()).To(Equal(0))
+ Expect(podmanStopSession).Should(Exit(0))
// We have to force cleanup so the unmount happens
podmanCleanupSession := podmanTest.Podman([]string{"container", "cleanup", ctrName})
podmanCleanupSession.WaitWithDefaultTimeout()
- Expect(podmanCleanupSession.ExitCode()).To(Equal(0))
+ Expect(podmanCleanupSession).Should(Exit(0))
// Ensure volume is unmounted
- mountCmd3, err := gexec.Start(exec.Command("mount"), GinkgoWriter, GinkgoWriter)
+ mountCmd3, err := Start(exec.Command("mount"), GinkgoWriter, GinkgoWriter)
Expect(err).To(BeNil())
mountCmd3.Wait(90)
- Expect(mountCmd3.ExitCode()).To(Equal(0))
+ Expect(mountCmd3).Should(Exit(0))
os.Stdout.Sync()
os.Stderr.Sync()
mountOut3 := strings.Join(strings.Fields(string(mountCmd3.Out.Contents())), " ")
@@ -288,21 +288,21 @@ var _ = Describe("Podman run with volumes", func() {
It("podman named volume copyup", func() {
baselineSession := podmanTest.Podman([]string{"run", "--rm", "-t", "-i", ALPINE, "ls", "/etc/apk/"})
baselineSession.WaitWithDefaultTimeout()
- Expect(baselineSession.ExitCode()).To(Equal(0))
+ Expect(baselineSession).Should(Exit(0))
baselineOutput := baselineSession.OutputToString()
inlineVolumeSession := podmanTest.Podman([]string{"run", "--rm", "-t", "-i", "-v", "testvol1:/etc/apk", ALPINE, "ls", "/etc/apk/"})
inlineVolumeSession.WaitWithDefaultTimeout()
- Expect(inlineVolumeSession.ExitCode()).To(Equal(0))
+ Expect(inlineVolumeSession).Should(Exit(0))
Expect(inlineVolumeSession.OutputToString()).To(Equal(baselineOutput))
makeVolumeSession := podmanTest.Podman([]string{"volume", "create", "testvol2"})
makeVolumeSession.WaitWithDefaultTimeout()
- Expect(makeVolumeSession.ExitCode()).To(Equal(0))
+ Expect(makeVolumeSession).Should(Exit(0))
separateVolumeSession := podmanTest.Podman([]string{"run", "--rm", "-t", "-i", "-v", "testvol2:/etc/apk", ALPINE, "ls", "/etc/apk/"})
separateVolumeSession.WaitWithDefaultTimeout()
- Expect(separateVolumeSession.ExitCode()).To(Equal(0))
+ Expect(separateVolumeSession).Should(Exit(0))
Expect(separateVolumeSession.OutputToString()).To(Equal(baselineOutput))
})
@@ -315,62 +315,62 @@ RUN sh -c "cd /etc/apk && ln -s ../../testfile"`, ALPINE)
baselineSession := podmanTest.Podman([]string{"run", "--rm", "-t", "-i", imgName, "ls", "/etc/apk/"})
baselineSession.WaitWithDefaultTimeout()
- Expect(baselineSession.ExitCode()).To(Equal(0))
+ Expect(baselineSession).Should(Exit(0))
baselineOutput := baselineSession.OutputToString()
outputSession := podmanTest.Podman([]string{"run", "-t", "-i", "-v", "/etc/apk/", imgName, "ls", "/etc/apk/"})
outputSession.WaitWithDefaultTimeout()
- Expect(outputSession.ExitCode()).To(Equal(0))
+ Expect(outputSession).Should(Exit(0))
Expect(outputSession.OutputToString()).To(Equal(baselineOutput))
})
It("podman named volume copyup empty directory", func() {
baselineSession := podmanTest.Podman([]string{"run", "--rm", "-t", "-i", ALPINE, "ls", "/srv"})
baselineSession.WaitWithDefaultTimeout()
- Expect(baselineSession.ExitCode()).To(Equal(0))
+ Expect(baselineSession).Should(Exit(0))
baselineOutput := baselineSession.OutputToString()
outputSession := podmanTest.Podman([]string{"run", "-t", "-i", "-v", "/srv", ALPINE, "ls", "/srv"})
outputSession.WaitWithDefaultTimeout()
- Expect(outputSession.ExitCode()).To(Equal(0))
+ Expect(outputSession).Should(Exit(0))
Expect(outputSession.OutputToString()).To(Equal(baselineOutput))
})
It("podman named volume copyup of /var", func() {
baselineSession := podmanTest.Podman([]string{"run", "--rm", "-t", "-i", fedoraMinimal, "ls", "/var"})
baselineSession.WaitWithDefaultTimeout()
- Expect(baselineSession.ExitCode()).To(Equal(0))
+ Expect(baselineSession).Should(Exit(0))
baselineOutput := baselineSession.OutputToString()
outputSession := podmanTest.Podman([]string{"run", "-t", "-i", "-v", "/var", fedoraMinimal, "ls", "/var"})
outputSession.WaitWithDefaultTimeout()
- Expect(outputSession.ExitCode()).To(Equal(0))
+ Expect(outputSession).Should(Exit(0))
Expect(outputSession.OutputToString()).To(Equal(baselineOutput))
})
It("podman read-only tmpfs conflict with volume", func() {
session := podmanTest.Podman([]string{"run", "--rm", "-t", "-i", "--read-only", "-v", "tmp_volume:" + dest, ALPINE, "touch", dest + "/a"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session2 := podmanTest.Podman([]string{"run", "--rm", "-t", "-i", "--read-only", "--tmpfs", dest, ALPINE, "touch", dest + "/a"})
session2.WaitWithDefaultTimeout()
- Expect(session2.ExitCode()).To(Equal(0))
+ Expect(session2).Should(Exit(0))
})
It("podman run with anonymous volume", func() {
list1 := podmanTest.Podman([]string{"volume", "list", "--quiet"})
list1.WaitWithDefaultTimeout()
- Expect(list1.ExitCode()).To(Equal(0))
+ Expect(list1).Should(Exit(0))
Expect(list1.OutputToString()).To(Equal(""))
session := podmanTest.Podman([]string{"create", "-v", "/test", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
list2 := podmanTest.Podman([]string{"volume", "list", "--quiet"})
list2.WaitWithDefaultTimeout()
- Expect(list2.ExitCode()).To(Equal(0))
+ Expect(list2).Should(Exit(0))
arr := list2.OutputToStringArray()
Expect(len(arr)).To(Equal(1))
Expect(arr[0]).To(Not(Equal("")))
@@ -379,57 +379,57 @@ RUN sh -c "cd /etc/apk && ln -s ../../testfile"`, ALPINE)
It("podman rm -v removes anonymous volume", func() {
list1 := podmanTest.Podman([]string{"volume", "list", "--quiet"})
list1.WaitWithDefaultTimeout()
- Expect(list1.ExitCode()).To(Equal(0))
+ Expect(list1).Should(Exit(0))
Expect(list1.OutputToString()).To(Equal(""))
ctrName := "testctr"
session := podmanTest.Podman([]string{"create", "--name", ctrName, "-v", "/test", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
list2 := podmanTest.Podman([]string{"volume", "list", "--quiet"})
list2.WaitWithDefaultTimeout()
- Expect(list2.ExitCode()).To(Equal(0))
+ Expect(list2).Should(Exit(0))
arr := list2.OutputToStringArray()
Expect(len(arr)).To(Equal(1))
Expect(arr[0]).To(Not(Equal("")))
remove := podmanTest.Podman([]string{"rm", "-v", ctrName})
remove.WaitWithDefaultTimeout()
- Expect(remove.ExitCode()).To(Equal(0))
+ Expect(remove).Should(Exit(0))
list3 := podmanTest.Podman([]string{"volume", "list", "--quiet"})
list3.WaitWithDefaultTimeout()
- Expect(list3.ExitCode()).To(Equal(0))
+ Expect(list3).Should(Exit(0))
Expect(list3.OutputToString()).To(Equal(""))
})
It("podman rm -v retains named volume", func() {
list1 := podmanTest.Podman([]string{"volume", "list", "--quiet"})
list1.WaitWithDefaultTimeout()
- Expect(list1.ExitCode()).To(Equal(0))
+ Expect(list1).Should(Exit(0))
Expect(list1.OutputToString()).To(Equal(""))
ctrName := "testctr"
volName := "testvol"
session := podmanTest.Podman([]string{"create", "--name", ctrName, "-v", fmt.Sprintf("%s:/test", volName), ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
list2 := podmanTest.Podman([]string{"volume", "list", "--quiet"})
list2.WaitWithDefaultTimeout()
- Expect(list2.ExitCode()).To(Equal(0))
+ Expect(list2).Should(Exit(0))
arr := list2.OutputToStringArray()
Expect(len(arr)).To(Equal(1))
Expect(arr[0]).To(Equal(volName))
remove := podmanTest.Podman([]string{"rm", "-v", ctrName})
remove.WaitWithDefaultTimeout()
- Expect(remove.ExitCode()).To(Equal(0))
+ Expect(remove).Should(Exit(0))
list3 := podmanTest.Podman([]string{"volume", "list", "--quiet"})
list3.WaitWithDefaultTimeout()
- Expect(list3.ExitCode()).To(Equal(0))
+ Expect(list3).Should(Exit(0))
arr2 := list3.OutputToStringArray()
Expect(len(arr2)).To(Equal(1))
Expect(arr2[0]).To(Equal(volName))
@@ -438,7 +438,7 @@ RUN sh -c "cd /etc/apk && ln -s ../../testfile"`, ALPINE)
It("podman run image volume is not noexec", func() {
session := podmanTest.Podman([]string{"run", "--rm", redis, "grep", "/data", "/proc/self/mountinfo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Not(ContainSubstring("noexec")))
})
@@ -446,22 +446,22 @@ RUN sh -c "cd /etc/apk && ln -s ../../testfile"`, ALPINE)
volName := "testVol"
volCreate := podmanTest.Podman([]string{"volume", "create", "--opt", "type=tmpfs", "--opt", "device=tmpfs", "--opt", "o=invalid", volName})
volCreate.WaitWithDefaultTimeout()
- Expect(volCreate.ExitCode()).To(Equal(0))
+ Expect(volCreate).Should(Exit(0))
volMount := podmanTest.Podman([]string{"run", "--rm", "-v", fmt.Sprintf("%s:/tmp", volName), ALPINE, "ls"})
volMount.WaitWithDefaultTimeout()
- Expect(volMount.ExitCode()).To(Not(Equal(0)))
+ Expect(volMount).To(ExitWithError())
})
It("Podman fix for CVE-2020-1726", func() {
volName := "testVol"
volCreate := podmanTest.Podman([]string{"volume", "create", volName})
volCreate.WaitWithDefaultTimeout()
- Expect(volCreate.ExitCode()).To(Equal(0))
+ Expect(volCreate).Should(Exit(0))
volPath := podmanTest.Podman([]string{"volume", "inspect", "--format", "{{.Mountpoint}}", volName})
volPath.WaitWithDefaultTimeout()
- Expect(volPath.ExitCode()).To(Equal(0))
+ Expect(volPath).Should(Exit(0))
path := volPath.OutputToString()
fileName := "thisIsATestFile"
@@ -471,7 +471,7 @@ RUN sh -c "cd /etc/apk && ln -s ../../testfile"`, ALPINE)
runLs := podmanTest.Podman([]string{"run", "-t", "-i", "--rm", "-v", fmt.Sprintf("%v:/etc/ssl", volName), ALPINE, "ls", "-1", "/etc/ssl"})
runLs.WaitWithDefaultTimeout()
- Expect(runLs.ExitCode()).To(Equal(0))
+ Expect(runLs).Should(Exit(0))
outputArr := runLs.OutputToStringArray()
Expect(len(outputArr)).To(Equal(1))
Expect(strings.Contains(outputArr[0], fileName)).To(BeTrue())
@@ -486,7 +486,7 @@ VOLUME /test/`, ALPINE)
ctrName := "testCtr"
create := podmanTest.Podman([]string{"create", "-v", "/tmp:/test", "--name", ctrName, image, "ls"})
create.WaitWithDefaultTimeout()
- Expect(create.ExitCode()).To(Equal(0))
+ Expect(create).Should(Exit(0))
data := podmanTest.InspectContainer(ctrName)
Expect(len(data)).To(Equal(1))
@@ -514,7 +514,7 @@ VOLUME /test/`, ALPINE)
// Make sure host directory gets mounted in to container as overlay
session := podmanTest.Podman([]string{"run", "--rm", "-v", fmt.Sprintf("%s:/run/test:O", mountPath), ALPINE, "grep", "/run/test", "/proc/self/mountinfo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
found, matches := session.GrepString("/run/test")
Expect(found).Should(BeTrue())
Expect(matches[0]).To(ContainSubstring("overlay"))
@@ -522,37 +522,37 @@ VOLUME /test/`, ALPINE)
// Make sure host files show up in the container
session = podmanTest.Podman([]string{"run", "--rm", "-v", fmt.Sprintf("%s:/run/test:O", mountPath), ALPINE, "ls", "/run/test/test1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Make sure modifications in container do not show up on host
session = podmanTest.Podman([]string{"run", "--rm", "-v", fmt.Sprintf("%s:/run/test:O", mountPath), ALPINE, "touch", "/run/test/container"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
_, err = os.Stat(filepath.Join(mountPath, "container"))
Expect(err).To(Not(BeNil()))
// Make sure modifications in container disappear when container is stopped
session = podmanTest.Podman([]string{"create", "-v", fmt.Sprintf("%s:/run/test:O", mountPath), ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"start", "-l"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"exec", "-l", "touch", "/run/test/container"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"exec", "-l", "ls", "/run/test/container"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"stop", "-l"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"start", "-l"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"exec", "-l", "ls", "/run/test/container"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
})
It("overlay volume conflicts with named volume and mounts", func() {
@@ -570,25 +570,27 @@ VOLUME /test/`, ALPINE)
session := podmanTest.Podman([]string{"volume", "create", volName})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// overlay and named volume destinations conflict
session = podmanTest.Podman([]string{"run", "--rm", "-v", fmt.Sprintf("%s:%s:O", mountPath, mountDest), "-v", fmt.Sprintf("%s:%s", volName, mountDest), ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
// overlay and bind mount destinations conflict
session = podmanTest.Podman([]string{"run", "--rm", "-v", fmt.Sprintf("%s:%s:O", mountPath, mountDest), "--mount", fmt.Sprintf("type=bind,src=%s,target=%s", mountSrc, mountDest), ALPINE})
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ session.WaitWithDefaultTimeout()
+ Expect(session).To(ExitWithError())
// overlay and tmpfs mount destinations conflict
session = podmanTest.Podman([]string{"run", "--rm", "-v", fmt.Sprintf("%s:%s:O", mountPath, mountDest), "--mount", fmt.Sprintf("type=tmpfs,target=%s", mountDest), ALPINE})
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ session.WaitWithDefaultTimeout()
+ Expect(session).To(ExitWithError())
})
It("same volume in multiple places does not deadlock", func() {
volName := "testVol1"
session := podmanTest.Podman([]string{"run", "-t", "-i", "-v", fmt.Sprintf("%s:/test1", volName), "-v", fmt.Sprintf("%s:/test2", volName), "--rm", ALPINE, "sh", "-c", "mount | grep /test"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(2))
})
@@ -625,20 +627,20 @@ VOLUME /test/`, ALPINE)
session := podmanTest.Podman([]string{"run", "--rm", "--user", "888:888", "-v", vol, ALPINE, "stat", "-c", "%u:%g", dest})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
found, _ := session.GrepString("888:888")
Expect(found).Should(BeTrue())
session = podmanTest.Podman([]string{"run", "--rm", "--user", "888:888", "--userns", "auto", "-v", vol, ALPINE, "stat", "-c", "%u:%g", dest})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
found, _ = session.GrepString("888:888")
Expect(found).Should(BeTrue())
vol = vol + ",O"
session = podmanTest.Podman([]string{"run", "--rm", "--user", "888:888", "--userns", "keep-id", "-v", vol, ALPINE, "stat", "-c", "%u:%g", dest})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
found, _ = session.GrepString("888:888")
Expect(found).Should(BeTrue())
})
@@ -654,17 +656,17 @@ USER testuser`, fedoraMinimal)
test1 := podmanTest.Podman([]string{"run", "-v", "testvol1:/test", imgName, "bash", "-c", "ls -al /test | grep -v root | grep -v total"})
test1.WaitWithDefaultTimeout()
- Expect(test1.ExitCode()).To(Equal(0))
+ Expect(test1).Should(Exit(0))
Expect(strings.Contains(test1.OutputToString(), testString)).To(BeTrue())
volName := "testvol2"
vol := podmanTest.Podman([]string{"volume", "create", volName})
vol.WaitWithDefaultTimeout()
- Expect(vol.ExitCode()).To(Equal(0))
+ Expect(vol).Should(Exit(0))
test2 := podmanTest.Podman([]string{"run", "-v", fmt.Sprintf("%s:/test", volName), imgName, "bash", "-c", "ls -al /test | grep -v root | grep -v total"})
test2.WaitWithDefaultTimeout()
- Expect(test2.ExitCode()).To(Equal(0))
+ Expect(test2).Should(Exit(0))
Expect(strings.Contains(test2.OutputToString(), testString)).To(BeTrue())
})
@@ -673,31 +675,31 @@ USER testuser`, fedoraMinimal)
volName := "testVol"
volCreate := podmanTest.Podman([]string{"volume", "create", "--opt", "o=uid=1000", volName})
volCreate.WaitWithDefaultTimeout()
- Expect(volCreate.ExitCode()).To(Equal(0))
+ Expect(volCreate).Should(Exit(0))
volMount := podmanTest.Podman([]string{"run", "--rm", "-v", fmt.Sprintf("%s:/test", volName), ALPINE, "stat", "-c", "%u", "/test"})
volMount.WaitWithDefaultTimeout()
- Expect(volMount.ExitCode()).To(Equal(0))
+ Expect(volMount).Should(Exit(0))
Expect(volMount.OutputToString()).To(Equal("1000"))
volName = "testVol2"
volCreate = podmanTest.Podman([]string{"volume", "create", "--opt", "o=gid=1000", volName})
volCreate.WaitWithDefaultTimeout()
- Expect(volCreate.ExitCode()).To(Equal(0))
+ Expect(volCreate).Should(Exit(0))
volMount = podmanTest.Podman([]string{"run", "--rm", "-v", fmt.Sprintf("%s:/test", volName), ALPINE, "stat", "-c", "%g", "/test"})
volMount.WaitWithDefaultTimeout()
- Expect(volMount.ExitCode()).To(Equal(0))
+ Expect(volMount).Should(Exit(0))
Expect(volMount.OutputToString()).To(Equal("1000"))
volName = "testVol3"
volCreate = podmanTest.Podman([]string{"volume", "create", "--opt", "o=uid=1000,gid=1000", volName})
volCreate.WaitWithDefaultTimeout()
- Expect(volCreate.ExitCode()).To(Equal(0))
+ Expect(volCreate).Should(Exit(0))
volMount = podmanTest.Podman([]string{"run", "--rm", "-v", fmt.Sprintf("%s:/test", volName), ALPINE, "stat", "-c", "%u:%g", "/test"})
volMount.WaitWithDefaultTimeout()
- Expect(volMount.ExitCode()).To(Equal(0))
+ Expect(volMount).Should(Exit(0))
Expect(volMount.OutputToString()).To(Equal("1000:1000"))
})
})
diff --git a/test/e2e/run_working_dir_test.go b/test/e2e/run_working_dir_test.go
index de0f55134..ac78110bf 100644
--- a/test/e2e/run_working_dir_test.go
+++ b/test/e2e/run_working_dir_test.go
@@ -7,6 +7,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman run", func() {
@@ -36,14 +37,14 @@ var _ = Describe("Podman run", func() {
It("podman run a container without workdir", func() {
session := podmanTest.Podman([]string{"run", ALPINE, "pwd"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("/"))
})
It("podman run a container using non existing --workdir", func() {
session := podmanTest.Podman([]string{"run", "--workdir", "/home/foobar", ALPINE, "pwd"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(126))
+ Expect(session).Should(Exit(126))
})
It("podman run a container on an image with a workdir", func() {
@@ -54,7 +55,7 @@ WORKDIR /etc/foobar`, ALPINE)
session := podmanTest.Podman([]string{"run", "test", "pwd"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("/etc/foobar"))
session = podmanTest.Podman([]string{"run", "test", "ls", "-ld", "."})
@@ -63,7 +64,7 @@ WORKDIR /etc/foobar`, ALPINE)
session = podmanTest.Podman([]string{"run", "--workdir", "/home/foobar", "test", "pwd"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("/home/foobar"))
})
})
diff --git a/test/e2e/runlabel_test.go b/test/e2e/runlabel_test.go
index 54fa7e2f6..e67b6cba1 100644
--- a/test/e2e/runlabel_test.go
+++ b/test/e2e/runlabel_test.go
@@ -7,6 +7,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var PodmanDockerfile = fmt.Sprintf(`
@@ -52,11 +53,11 @@ var _ = Describe("podman container runlabel", func() {
result := podmanTest.Podman([]string{"container", "runlabel", "RUN", image})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
result = podmanTest.Podman([]string{"rmi", image})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
})
It("podman container runlabel (ls -la)", func() {
@@ -65,11 +66,11 @@ var _ = Describe("podman container runlabel", func() {
result := podmanTest.Podman([]string{"container", "runlabel", "RUN", image})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
result = podmanTest.Podman([]string{"rmi", image})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
})
It("podman container runlabel --display", func() {
image := "podman-runlabel-test:ls"
@@ -77,12 +78,12 @@ var _ = Describe("podman container runlabel", func() {
result := podmanTest.Podman([]string{"container", "runlabel", "--display", "RUN", image})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(ContainSubstring(podmanTest.PodmanBinary + " -la"))
result = podmanTest.Podman([]string{"rmi", image})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
})
It("podman container runlabel bogus label should result in non-zero exit code", func() {
result := podmanTest.Podman([]string{"container", "runlabel", "RUN", ALPINE})
@@ -105,13 +106,13 @@ var _ = Describe("podman container runlabel", func() {
podmanTest.BuildImage(GlobalDockerfile, image, "false")
result := podmanTest.Podman([]string{"--syslog", "--log-level", "debug", "container", "runlabel", "RUN", image})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(ContainSubstring("--syslog true"))
Expect(result.OutputToString()).To(ContainSubstring("--log-level debug"))
result = podmanTest.Podman([]string{"rmi", image})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
})
It("runlabel should fail with nonexistent authfile", func() {
@@ -121,10 +122,10 @@ var _ = Describe("podman container runlabel", func() {
// runlabel should fail with nonexistent authfile
result := podmanTest.Podman([]string{"container", "runlabel", "--authfile", "/tmp/nonexistent", "RUN", image})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Not(Equal(0)))
+ Expect(result).To(ExitWithError())
result = podmanTest.Podman([]string{"rmi", image})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
})
})
diff --git a/test/e2e/save_test.go b/test/e2e/save_test.go
index 69184649f..0b3a88da3 100644
--- a/test/e2e/save_test.go
+++ b/test/e2e/save_test.go
@@ -12,6 +12,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman save", func() {
@@ -42,7 +43,7 @@ var _ = Describe("Podman save", func() {
save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE})
save.WaitWithDefaultTimeout()
- Expect(save.ExitCode()).To(Equal(0))
+ Expect(save).Should(Exit(0))
})
It("podman save oci flag", func() {
@@ -50,7 +51,7 @@ var _ = Describe("Podman save", func() {
save := podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-archive", ALPINE})
save.WaitWithDefaultTimeout()
- Expect(save.ExitCode()).To(Equal(0))
+ Expect(save).Should(Exit(0))
})
It("podman save with stdout", func() {
@@ -59,7 +60,7 @@ var _ = Describe("Podman save", func() {
save := podmanTest.Podman([]string{"save", ALPINE, ">", outfile})
save.WaitWithDefaultTimeout()
- Expect(save.ExitCode()).To(Equal(0))
+ Expect(save).Should(Exit(0))
})
It("podman save quiet flag", func() {
@@ -67,7 +68,7 @@ var _ = Describe("Podman save", func() {
save := podmanTest.Podman([]string{"save", "-q", "-o", outfile, ALPINE})
save.WaitWithDefaultTimeout()
- Expect(save.ExitCode()).To(Equal(0))
+ Expect(save).Should(Exit(0))
})
It("podman save bogus image", func() {
@@ -86,7 +87,7 @@ var _ = Describe("Podman save", func() {
save := podmanTest.Podman([]string{"save", "--format", "oci-dir", "-o", outdir, ALPINE})
save.WaitWithDefaultTimeout()
- Expect(save.ExitCode()).To(Equal(0))
+ Expect(save).Should(Exit(0))
})
It("podman save to directory with v2s2 docker format", func() {
@@ -97,7 +98,7 @@ var _ = Describe("Podman save", func() {
save := podmanTest.Podman([]string{"save", "--format", "docker-dir", "-o", outdir, ALPINE})
save.WaitWithDefaultTimeout()
- Expect(save.ExitCode()).To(Equal(0))
+ Expect(save).Should(Exit(0))
})
It("podman save to directory with docker format and compression", func() {
@@ -108,7 +109,7 @@ var _ = Describe("Podman save", func() {
save := podmanTest.Podman([]string{"save", "--compress", "--format", "docker-dir", "-o", outdir, ALPINE})
save.WaitWithDefaultTimeout()
- Expect(save.ExitCode()).To(Equal(0))
+ Expect(save).Should(Exit(0))
})
It("podman save to directory with --compress but not use docker-dir and oci-dir", func() {
@@ -120,12 +121,12 @@ var _ = Describe("Podman save", func() {
save := podmanTest.Podman([]string{"save", "--compress", "--format", "docker-archive", "-o", outdir, ALPINE})
save.WaitWithDefaultTimeout()
// should not be 0
- Expect(save.ExitCode()).ToNot(Equal(0))
+ Expect(save).To(ExitWithError())
save = podmanTest.Podman([]string{"save", "--compress", "--format", "oci-archive", "-o", outdir, ALPINE})
save.WaitWithDefaultTimeout()
// should not be 0
- Expect(save.ExitCode()).ToNot(Equal(0))
+ Expect(save).To(ExitWithError())
})
@@ -154,7 +155,7 @@ var _ = Describe("Podman save", func() {
port := 5000
session := podmanTest.Podman([]string{"run", "-d", "--name", "registry", "-p", strings.Join([]string{strconv.Itoa(port), strconv.Itoa(port)}, ":"), "quay.io/libpod/registry:2.6"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
if !WaitContainerReady(podmanTest, "registry", "listening on", 20, 1) {
Skip("Cannot start docker registry.")
}
@@ -183,19 +184,19 @@ default-docker:
session = podmanTest.Podman([]string{"tag", ALPINE, "localhost:5000/alpine"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"push", "--tls-verify=false", "--sign-by", "foo@bar.com", "localhost:5000/alpine"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"rmi", ALPINE, "localhost:5000/alpine"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"pull", "--tls-verify=false", "--signature-policy=sign/policy.json", "localhost:5000/alpine"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
outfile := filepath.Join(podmanTest.TempDir, "temp.tar")
save := podmanTest.Podman([]string{"save", "remove-signatures=true", "-o", outfile, "localhost:5000/alpine"})
@@ -207,13 +208,13 @@ default-docker:
// pull a digest reference
session := podmanTest.Podman([]string{"pull", ALPINELISTDIGEST})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// save a digest reference should exit without error.
outfile := filepath.Join(podmanTest.TempDir, "temp.tar")
save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINELISTDIGEST})
save.WaitWithDefaultTimeout()
- Expect(save.ExitCode()).To(Equal(0))
+ Expect(save).Should(Exit(0))
})
It("podman save --multi-image-archive (tagged images)", func() {
@@ -224,7 +225,7 @@ default-docker:
// Refer to images via ID instead of tag.
session := podmanTest.Podman([]string{"images", "--format", "{{.ID}}"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
ids := session.OutputToStringArray()
Expect(len(RESTORE_IMAGES), len(ids))
@@ -239,17 +240,17 @@ func multiImageSave(podmanTest *PodmanTestIntegration, images []string) {
outfile := filepath.Join(podmanTest.TempDir, "temp.tar")
session := podmanTest.Podman(append([]string{"save", "-o", outfile, "--multi-image-archive"}, images...))
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Remove all images.
session = podmanTest.Podman([]string{"rmi", "-af"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Now load the archive.
session = podmanTest.Podman([]string{"load", "-i", outfile})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Grep for each image in the `podman load` output.
for _, image := range images {
found, _ := session.GrepString(image)
@@ -260,6 +261,6 @@ func multiImageSave(podmanTest *PodmanTestIntegration, images []string) {
for _, image := range images {
session = podmanTest.Podman([]string{"image", "exists", image})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
}
}
diff --git a/test/e2e/search_test.go b/test/e2e/search_test.go
index 8c388d0ee..b0faabf6c 100644
--- a/test/e2e/search_test.go
+++ b/test/e2e/search_test.go
@@ -12,6 +12,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
type endpoint struct {
@@ -87,7 +88,7 @@ registries = ['{{.Host}}:{{.Port}}']`
It("podman search", func() {
search := podmanTest.Podman([]string{"search", "alpine"})
search.WaitWithDefaultTimeout()
- Expect(search.ExitCode()).To(Equal(0))
+ Expect(search).Should(Exit(0))
Expect(len(search.OutputToStringArray())).To(BeNumerically(">", 1))
Expect(search.LineInOutputContains("docker.io/library/alpine")).To(BeTrue())
})
@@ -95,14 +96,14 @@ registries = ['{{.Host}}:{{.Port}}']`
It("podman search single registry flag", func() {
search := podmanTest.Podman([]string{"search", "quay.io/skopeo/stable:latest"})
search.WaitWithDefaultTimeout()
- Expect(search.ExitCode()).To(Equal(0))
+ Expect(search).Should(Exit(0))
Expect(search.LineInOutputContains("quay.io/skopeo/stable")).To(BeTrue())
})
It("podman search image with description", func() {
search := podmanTest.Podman([]string{"search", "quay.io/libpod/whalesay"})
search.WaitWithDefaultTimeout()
- Expect(search.ExitCode()).To(Equal(0))
+ Expect(search).Should(Exit(0))
output := string(search.Out.Contents())
match, _ := regexp.MatchString(`(?m)^quay.io\s+quay.io/libpod/whalesay\s+Static image used for automated testing.+$`, output)
Expect(match).To(BeTrue())
@@ -111,7 +112,7 @@ registries = ['{{.Host}}:{{.Port}}']`
It("podman search format flag", func() {
search := podmanTest.Podman([]string{"search", "--format", "table {{.Index}} {{.Name}}", "alpine"})
search.WaitWithDefaultTimeout()
- Expect(search.ExitCode()).To(Equal(0))
+ Expect(search).Should(Exit(0))
Expect(len(search.OutputToStringArray())).To(BeNumerically(">", 1))
Expect(search.LineInOutputContains("docker.io/library/alpine")).To(BeTrue())
})
@@ -119,7 +120,7 @@ registries = ['{{.Host}}:{{.Port}}']`
It("podman search format json", func() {
search := podmanTest.Podman([]string{"search", "--format", "json", "alpine"})
search.WaitWithDefaultTimeout()
- Expect(search.ExitCode()).To(Equal(0))
+ Expect(search).Should(Exit(0))
Expect(search.IsJSONOutputValid()).To(BeTrue())
Expect(search.OutputToString()).To(ContainSubstring("docker.io/library/alpine"))
})
@@ -127,7 +128,7 @@ registries = ['{{.Host}}:{{.Port}}']`
It("podman search format json list tags", func() {
search := podmanTest.Podman([]string{"search", "--list-tags", "--format", "json", "alpine"})
search.WaitWithDefaultTimeout()
- Expect(search.ExitCode()).To(Equal(0))
+ Expect(search).Should(Exit(0))
Expect(search.IsJSONOutputValid()).To(BeTrue())
Expect(search.OutputToString()).To(ContainSubstring("docker.io/library/alpine"))
Expect(search.OutputToString()).To(ContainSubstring("3.10"))
@@ -137,7 +138,7 @@ registries = ['{{.Host}}:{{.Port}}']`
It("podman search no-trunc flag", func() {
search := podmanTest.Podman([]string{"search", "--no-trunc", "alpine"})
search.WaitWithDefaultTimeout()
- Expect(search.ExitCode()).To(Equal(0))
+ Expect(search).Should(Exit(0))
Expect(len(search.OutputToStringArray())).To(BeNumerically(">", 1))
Expect(search.LineInOutputContains("docker.io/library/alpine")).To(BeTrue())
Expect(search.LineInOutputContains("...")).To(BeFalse())
@@ -146,24 +147,24 @@ registries = ['{{.Host}}:{{.Port}}']`
It("podman search limit flag", func() {
search := podmanTest.Podman([]string{"search", "docker.io/alpine"})
search.WaitWithDefaultTimeout()
- Expect(search.ExitCode()).To(Equal(0))
+ Expect(search).Should(Exit(0))
Expect(len(search.OutputToStringArray())).To(Equal(26))
search = podmanTest.Podman([]string{"search", "--limit", "3", "docker.io/alpine"})
search.WaitWithDefaultTimeout()
- Expect(search.ExitCode()).To(Equal(0))
+ Expect(search).Should(Exit(0))
Expect(len(search.OutputToStringArray())).To(Equal(4))
search = podmanTest.Podman([]string{"search", "--limit", "30", "docker.io/alpine"})
search.WaitWithDefaultTimeout()
- Expect(search.ExitCode()).To(Equal(0))
+ Expect(search).Should(Exit(0))
Expect(len(search.OutputToStringArray())).To(Equal(31))
})
It("podman search with filter stars", func() {
search := podmanTest.Podman([]string{"search", "--filter", "stars=10", "--format", "{{.Stars}}", "alpine"})
search.WaitWithDefaultTimeout()
- Expect(search.ExitCode()).To(Equal(0))
+ Expect(search).Should(Exit(0))
output := search.OutputToStringArray()
for i := 0; i < len(output); i++ {
Expect(strconv.Atoi(output[i])).To(BeNumerically(">=", 10))
@@ -173,7 +174,7 @@ registries = ['{{.Host}}:{{.Port}}']`
It("podman search with filter is-official", func() {
search := podmanTest.Podman([]string{"search", "--filter", "is-official", "--format", "{{.Official}}", "alpine"})
search.WaitWithDefaultTimeout()
- Expect(search.ExitCode()).To(Equal(0))
+ Expect(search).Should(Exit(0))
output := search.OutputToStringArray()
for i := 0; i < len(output); i++ {
Expect(output[i]).To(Equal("[OK]"))
@@ -183,7 +184,7 @@ registries = ['{{.Host}}:{{.Port}}']`
It("podman search with filter is-automated", func() {
search := podmanTest.Podman([]string{"search", "--filter", "is-automated=false", "--format", "{{.Automated}}", "alpine"})
search.WaitWithDefaultTimeout()
- Expect(search.ExitCode()).To(Equal(0))
+ Expect(search).Should(Exit(0))
output := search.OutputToStringArray()
for i := 0; i < len(output); i++ {
Expect(output[i]).To(Equal(""))
@@ -201,7 +202,7 @@ registries = ['{{.Host}}:{{.Port}}']`
"-p", fmt.Sprintf("%s:5000", registryEndpoints[0].Port),
registry, "/entrypoint.sh", "/etc/docker/registry/config.yml"})
fakereg.WaitWithDefaultTimeout()
- Expect(fakereg.ExitCode()).To(Equal(0))
+ Expect(fakereg).Should(Exit(0))
if !WaitContainerReady(podmanTest, "registry", "listening on", 20, 1) {
Skip("Cannot start docker registry.")
@@ -213,7 +214,7 @@ registries = ['{{.Host}}:{{.Port}}']`
// if this test succeeded, there will be no output (there is no entry named fake/image:andtag in an empty registry)
// and the exit code will be 0
- Expect(search.ExitCode()).To(Equal(0))
+ Expect(search).Should(Exit(0))
Expect(search.OutputToString()).Should(BeEmpty())
Expect(search.ErrorToString()).Should(BeEmpty())
})
@@ -228,7 +229,7 @@ registries = ['{{.Host}}:{{.Port}}']`
"-p", fmt.Sprintf("%s:5000", registryEndpoints[3].Port), registry,
"/entrypoint.sh", "/etc/docker/registry/config.yml"})
registry.WaitWithDefaultTimeout()
- Expect(registry.ExitCode()).To(Equal(0))
+ Expect(registry).Should(Exit(0))
if !WaitContainerReady(podmanTest, "registry3", "listening on", 20, 1) {
Skip("Cannot start docker registry.")
@@ -238,17 +239,17 @@ registries = ['{{.Host}}:{{.Port}}']`
image := fmt.Sprintf("%s/my-alpine", registryEndpoints[3].Address())
push := podmanTest.Podman([]string{"push", "--tls-verify=false", "--remove-signatures", ALPINE, image})
push.WaitWithDefaultTimeout()
- Expect(push.ExitCode()).To(Equal(0))
+ Expect(push).Should(Exit(0))
search := podmanTest.Podman([]string{"search", image, "--tls-verify=false"})
search.WaitWithDefaultTimeout()
- Expect(search.ExitCode()).To(Equal(0))
+ Expect(search).Should(Exit(0))
Expect(search.OutputToString()).ShouldNot(BeEmpty())
// podman search v2 registry with empty query
searchEmpty := podmanTest.Podman([]string{"search", fmt.Sprintf("%s/", registryEndpoints[3].Address()), "--tls-verify=false"})
searchEmpty.WaitWithDefaultTimeout()
- Expect(searchEmpty.ExitCode()).To(BeZero())
+ Expect(searchEmpty).Should(Exit(0))
Expect(len(searchEmpty.OutputToStringArray())).To(BeNumerically(">=", 1))
match, _ := search.GrepString("my-alpine")
Expect(match).Should(BeTrue())
@@ -264,7 +265,7 @@ registries = ['{{.Host}}:{{.Port}}']`
registry := podmanTest.Podman([]string{"run", "-d", "-p", fmt.Sprintf("%s:5000", registryEndpoints[4].Port),
"--name", "registry4", registry, "/entrypoint.sh", "/etc/docker/registry/config.yml"})
registry.WaitWithDefaultTimeout()
- Expect(registry.ExitCode()).To(Equal(0))
+ Expect(registry).Should(Exit(0))
if !WaitContainerReady(podmanTest, "registry4", "listening on", 20, 1) {
Skip("Cannot start docker registry.")
@@ -274,7 +275,7 @@ registries = ['{{.Host}}:{{.Port}}']`
image := fmt.Sprintf("%s/my-alpine", registryEndpoints[4].Address())
push := podmanTest.Podman([]string{"push", "--tls-verify=false", "--remove-signatures", ALPINE, image})
push.WaitWithDefaultTimeout()
- Expect(push.ExitCode()).To(Equal(0))
+ Expect(push).Should(Exit(0))
// registries.conf set up
var buffer bytes.Buffer
@@ -289,7 +290,7 @@ registries = ['{{.Host}}:{{.Port}}']`
search := podmanTest.Podman([]string{"search", image})
search.WaitWithDefaultTimeout()
- Expect(search.ExitCode()).To(Equal(0))
+ Expect(search).Should(Exit(0))
match, _ := search.GrepString("my-alpine")
Expect(match).Should(BeTrue())
Expect(search.ErrorToString()).Should(BeEmpty())
@@ -307,7 +308,7 @@ registries = ['{{.Host}}:{{.Port}}']`
registry := podmanTest.Podman([]string{"run", "-d", "-p", fmt.Sprintf("%s:5000", registryEndpoints[5].Port),
"--name", "registry5", registry})
registry.WaitWithDefaultTimeout()
- Expect(registry.ExitCode()).To(Equal(0))
+ Expect(registry).Should(Exit(0))
if !WaitContainerReady(podmanTest, "registry5", "listening on", 20, 1) {
Skip("Cannot start docker registry.")
@@ -317,7 +318,7 @@ registries = ['{{.Host}}:{{.Port}}']`
image := fmt.Sprintf("%s/my-alpine", registryEndpoints[5].Address())
push := podmanTest.Podman([]string{"push", "--tls-verify=false", "--remove-signatures", ALPINE, image})
push.WaitWithDefaultTimeout()
- Expect(push.ExitCode()).To(Equal(0))
+ Expect(push).Should(Exit(0))
var buffer bytes.Buffer
registryFileTmpl.Execute(&buffer, registryEndpoints[5])
@@ -327,7 +328,7 @@ registries = ['{{.Host}}:{{.Port}}']`
search := podmanTest.Podman([]string{"search", image, "--tls-verify=true"})
search.WaitWithDefaultTimeout()
- Expect(search.ExitCode()).To(Equal(125))
+ Expect(search).Should(Exit(125))
Expect(search.OutputToString()).Should(BeEmpty())
match, _ := search.ErrorGrepString("error")
Expect(match).Should(BeTrue())
@@ -345,7 +346,7 @@ registries = ['{{.Host}}:{{.Port}}']`
registry := podmanTest.Podman([]string{"run", "-d", "-p", fmt.Sprintf("%s:5000", registryEndpoints[6].Port),
"--name", "registry6", registry})
registry.WaitWithDefaultTimeout()
- Expect(registry.ExitCode()).To(Equal(0))
+ Expect(registry).Should(Exit(0))
if !WaitContainerReady(podmanTest, "registry6", "listening on", 20, 1) {
Skip("Cannot start docker registry.")
@@ -355,7 +356,7 @@ registries = ['{{.Host}}:{{.Port}}']`
image := fmt.Sprintf("%s/my-alpine", registryEndpoints[6].Address())
push := podmanTest.Podman([]string{"push", "--tls-verify=false", "--remove-signatures", ALPINE, image})
push.WaitWithDefaultTimeout()
- Expect(push.ExitCode()).To(Equal(0))
+ Expect(push).Should(Exit(0))
var buffer bytes.Buffer
registryFileBadTmpl.Execute(&buffer, registryEndpoints[6])
@@ -370,7 +371,7 @@ registries = ['{{.Host}}:{{.Port}}']`
search := podmanTest.Podman([]string{"search", image})
search.WaitWithDefaultTimeout()
- Expect(search.ExitCode()).To(Equal(125))
+ Expect(search).Should(Exit(125))
Expect(search.OutputToString()).Should(BeEmpty())
match, _ := search.ErrorGrepString("error")
Expect(match).Should(BeTrue())
@@ -391,7 +392,7 @@ registries = ['{{.Host}}:{{.Port}}']`
registryLocal := podmanTest.Podman([]string{"run", "-d", "--net=host", "-p", fmt.Sprintf("%s:5000", registryEndpoints[7].Port),
"--name", "registry7", registry})
registryLocal.WaitWithDefaultTimeout()
- Expect(registryLocal.ExitCode()).To(Equal(0))
+ Expect(registryLocal).Should(Exit(0))
if !WaitContainerReady(podmanTest, "registry7", "listening on", 20, 1) {
Skip("Cannot start docker registry.")
@@ -399,7 +400,7 @@ registries = ['{{.Host}}:{{.Port}}']`
registryLocal = podmanTest.Podman([]string{"run", "-d", "-p", "6000:5000", "--name", "registry8", registry})
registryLocal.WaitWithDefaultTimeout()
- Expect(registryLocal.ExitCode()).To(Equal(0))
+ Expect(registryLocal).Should(Exit(0))
if !WaitContainerReady(podmanTest, "registry8", "listening on", 20, 1) {
Skip("Cannot start docker registry.")
@@ -408,7 +409,7 @@ registries = ['{{.Host}}:{{.Port}}']`
podmanTest.RestoreArtifact(ALPINE)
push := podmanTest.Podman([]string{"push", "--tls-verify=false", "--remove-signatures", ALPINE, "localhost:6000/my-alpine"})
push.WaitWithDefaultTimeout()
- Expect(push.ExitCode()).To(Equal(0))
+ Expect(push).Should(Exit(0))
// registries.conf set up
var buffer bytes.Buffer
@@ -424,7 +425,7 @@ registries = ['{{.Host}}:{{.Port}}']`
search := podmanTest.Podman([]string{"search", "my-alpine"})
search.WaitWithDefaultTimeout()
- Expect(search.ExitCode()).To(Equal(125))
+ Expect(search).Should(Exit(125))
Expect(search.OutputToString()).Should(BeEmpty())
match, _ := search.ErrorGrepString("error")
Expect(match).Should(BeTrue())
@@ -437,35 +438,35 @@ registries = ['{{.Host}}:{{.Port}}']`
It("podman search fail with nonexistent --authfile", func() {
search := podmanTest.Podman([]string{"search", "--authfile", "/tmp/nonexistent", ALPINE})
search.WaitWithDefaultTimeout()
- Expect(search.ExitCode()).To(Not(Equal(0)))
+ Expect(search).To(ExitWithError())
})
It("podman search with wildcards", func() {
search := podmanTest.Podman([]string{"search", "--limit", "30", "registry.redhat.io/*"})
search.WaitWithDefaultTimeout()
- Expect(search.ExitCode()).To(Equal(0))
+ Expect(search).Should(Exit(0))
Expect(len(search.OutputToStringArray())).To(Equal(31))
search = podmanTest.Podman([]string{"search", "registry.redhat.io/*openshift*"})
search.WaitWithDefaultTimeout()
- Expect(search.ExitCode()).To(Equal(0))
+ Expect(search).Should(Exit(0))
Expect(len(search.OutputToStringArray()) > 1).To(BeTrue())
})
It("podman search repository tags", func() {
search := podmanTest.Podman([]string{"search", "--list-tags", "--limit", "30", "docker.io/library/alpine"})
search.WaitWithDefaultTimeout()
- Expect(search.ExitCode()).To(Equal(0))
+ Expect(search).Should(Exit(0))
Expect(len(search.OutputToStringArray())).To(Equal(31))
search = podmanTest.Podman([]string{"search", "--list-tags", "docker.io/library/alpine"})
search.WaitWithDefaultTimeout()
- Expect(search.ExitCode()).To(Equal(0))
+ Expect(search).Should(Exit(0))
Expect(len(search.OutputToStringArray()) > 2).To(BeTrue())
search = podmanTest.Podman([]string{"search", "--filter=is-official", "--list-tags", "docker.io/library/alpine"})
search.WaitWithDefaultTimeout()
- Expect(search.ExitCode()).To(Not(Equal(0)))
+ Expect(search).To(ExitWithError())
search = podmanTest.Podman([]string{"search", "--list-tags", "docker.io/library/"})
search.WaitWithDefaultTimeout()
@@ -475,7 +476,7 @@ registries = ['{{.Host}}:{{.Port}}']`
It("podman search with limit over 100", func() {
search := podmanTest.Podman([]string{"search", "--limit", "130", "registry.redhat.io/rhel"})
search.WaitWithDefaultTimeout()
- Expect(search.ExitCode()).To(Equal(0))
+ Expect(search).Should(Exit(0))
Expect(len(search.OutputToStringArray())).To(Equal(131))
})
})
diff --git a/test/e2e/secret_test.go b/test/e2e/secret_test.go
index 392129784..8bbc889d7 100644
--- a/test/e2e/secret_test.go
+++ b/test/e2e/secret_test.go
@@ -8,6 +8,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman secret", func() {
@@ -42,15 +43,15 @@ var _ = Describe("Podman secret", func() {
session := podmanTest.Podman([]string{"secret", "create", "--driver-opts", "opt1=val", "a", secretFilePath})
session.WaitWithDefaultTimeout()
secrID := session.OutputToString()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
inspect := podmanTest.Podman([]string{"secret", "inspect", "--format", "{{.ID}}", secrID})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(Equal(secrID))
inspect = podmanTest.Podman([]string{"secret", "inspect", "--format", "{{.Spec.Driver.Options}}", secrID})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring("opt1:val"))
})
@@ -61,7 +62,7 @@ var _ = Describe("Podman secret", func() {
session := podmanTest.Podman([]string{"secret", "create", "?!", secretFilePath})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
})
It("podman secret inspect", func() {
@@ -72,11 +73,11 @@ var _ = Describe("Podman secret", func() {
session := podmanTest.Podman([]string{"secret", "create", "a", secretFilePath})
session.WaitWithDefaultTimeout()
secrID := session.OutputToString()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
inspect := podmanTest.Podman([]string{"secret", "inspect", secrID})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.IsJSONOutputValid()).To(BeTrue())
})
@@ -88,11 +89,11 @@ var _ = Describe("Podman secret", func() {
session := podmanTest.Podman([]string{"secret", "create", "a", secretFilePath})
session.WaitWithDefaultTimeout()
secrID := session.OutputToString()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
inspect := podmanTest.Podman([]string{"secret", "inspect", "--format", "{{.ID}}", secrID})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(Equal(secrID))
})
@@ -104,16 +105,16 @@ var _ = Describe("Podman secret", func() {
session := podmanTest.Podman([]string{"secret", "create", "a", secretFilePath})
session.WaitWithDefaultTimeout()
secrID := session.OutputToString()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session2 := podmanTest.Podman([]string{"secret", "create", "b", secretFilePath})
session2.WaitWithDefaultTimeout()
secrID2 := session2.OutputToString()
- Expect(session2.ExitCode()).To(Equal(0))
+ Expect(session2).Should(Exit(0))
inspect := podmanTest.Podman([]string{"secret", "inspect", secrID, secrID2})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.IsJSONOutputValid()).To(BeTrue())
})
@@ -124,7 +125,7 @@ var _ = Describe("Podman secret", func() {
inspect := podmanTest.Podman([]string{"secret", "inspect", "bogus"})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Not(Equal(0)))
+ Expect(inspect).To(ExitWithError())
})
@@ -135,11 +136,11 @@ var _ = Describe("Podman secret", func() {
session := podmanTest.Podman([]string{"secret", "create", "a", secretFilePath})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
list := podmanTest.Podman([]string{"secret", "ls"})
list.WaitWithDefaultTimeout()
- Expect(list.ExitCode()).To(Equal(0))
+ Expect(list).Should(Exit(0))
Expect(len(list.OutputToStringArray())).To(Equal(2))
})
@@ -151,12 +152,12 @@ var _ = Describe("Podman secret", func() {
session := podmanTest.Podman([]string{"secret", "create", "a", secretFilePath})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
list := podmanTest.Podman([]string{"secret", "ls", "--format", "table {{.Name}}"})
list.WaitWithDefaultTimeout()
- Expect(list.ExitCode()).To(Equal(0))
+ Expect(list).Should(Exit(0))
Expect(len(list.OutputToStringArray())).To(Equal(2), list.OutputToString())
})
@@ -168,16 +169,16 @@ var _ = Describe("Podman secret", func() {
session := podmanTest.Podman([]string{"secret", "create", "a", secretFilePath})
session.WaitWithDefaultTimeout()
secrID := session.OutputToString()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
removed := podmanTest.Podman([]string{"secret", "rm", "a"})
removed.WaitWithDefaultTimeout()
- Expect(removed.ExitCode()).To(Equal(0))
+ Expect(removed).Should(Exit(0))
Expect(removed.OutputToString()).To(Equal(secrID))
session = podmanTest.Podman([]string{"secret", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(1))
})
@@ -188,18 +189,18 @@ var _ = Describe("Podman secret", func() {
session := podmanTest.Podman([]string{"secret", "create", "a", secretFilePath})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"secret", "create", "b", secretFilePath})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
removed := podmanTest.Podman([]string{"secret", "rm", "-a"})
removed.WaitWithDefaultTimeout()
- Expect(removed.ExitCode()).To(Equal(0))
+ Expect(removed).Should(Exit(0))
session = podmanTest.Podman([]string{"secret", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(1))
})
@@ -208,7 +209,7 @@ var _ = Describe("Podman secret", func() {
session := podmanTest.Podman([]string{"secret", "create", "--env", "a", "MYENVVAR"})
session.WaitWithDefaultTimeout()
secrID := session.OutputToString()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
os.Setenv("MYENVVAR", "somedata")
if IsRemote() {
@@ -218,11 +219,11 @@ var _ = Describe("Podman secret", func() {
session = podmanTest.Podman([]string{"secret", "create", "--env", "a", "MYENVVAR"})
session.WaitWithDefaultTimeout()
secrID = session.OutputToString()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
inspect := podmanTest.Podman([]string{"secret", "inspect", "--format", "{{.ID}}", secrID})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(Equal(secrID))
})
diff --git a/test/e2e/start_test.go b/test/e2e/start_test.go
index cb2db0810..7799055d9 100644
--- a/test/e2e/start_test.go
+++ b/test/e2e/start_test.go
@@ -39,79 +39,82 @@ var _ = Describe("Podman start", func() {
It("podman start bogus container", func() {
session := podmanTest.Podman([]string{"start", "123"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
It("podman start single container by id", func() {
session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
session = podmanTest.Podman([]string{"start", cid})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman start --rm removed on failure", func() {
session := podmanTest.Podman([]string{"create", "--name=test", "--rm", ALPINE, "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"start", "test"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
session = podmanTest.Podman([]string{"container", "exists", "test"})
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ session.WaitWithDefaultTimeout()
+ Expect(session).To(ExitWithError())
})
It("podman start --rm --attach removed on failure", func() {
+ Skip("FIXME: #10935, race condition removing container")
session := podmanTest.Podman([]string{"create", "--rm", ALPINE, "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
session = podmanTest.Podman([]string{"start", "--attach", cid})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
session = podmanTest.Podman([]string{"container", "exists", cid})
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ session.WaitWithDefaultTimeout()
+ Expect(session).To(ExitWithError())
})
It("podman container start single container by id", func() {
session := podmanTest.Podman([]string{"container", "create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
session = podmanTest.Podman([]string{"container", "start", cid})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal(cid))
})
It("podman container start single container by short id", func() {
session := podmanTest.Podman([]string{"container", "create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
shortID := cid[0:10]
session = podmanTest.Podman([]string{"container", "start", shortID})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal(shortID))
})
It("podman container start single container by short id", func() {
session := podmanTest.Podman([]string{"container", "create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
shortID := cid[0:10]
session = podmanTest.Podman([]string{"container", "start", shortID})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal(shortID))
session = podmanTest.Podman([]string{"stop", shortID})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal(shortID))
})
@@ -119,10 +122,10 @@ var _ = Describe("Podman start", func() {
name := "foobar99"
session := podmanTest.Podman([]string{"create", "--name", name, ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"start", name})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
if podmanTest.RemoteTest {
Skip("Container-start name check doesn't work on remote client. It always returns the full ID.")
}
@@ -132,12 +135,12 @@ var _ = Describe("Podman start", func() {
It("podman start single container with attach and test the signal", func() {
session := podmanTest.Podman([]string{"create", "--entrypoint", "sh", ALPINE, "-c", "exit 1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
session = podmanTest.Podman([]string{"start", "--attach", cid})
session.WaitWithDefaultTimeout()
// It should forward the signal
- Expect(session.ExitCode()).To(Equal(1))
+ Expect(session).Should(Exit(1))
})
It("podman start multiple containers", func() {
@@ -149,7 +152,7 @@ var _ = Describe("Podman start", func() {
cid2 := session2.OutputToString()
session = podmanTest.Podman([]string{"start", cid1, cid2})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman start multiple containers with bogus", func() {
@@ -158,25 +161,25 @@ var _ = Describe("Podman start", func() {
cid1 := session.OutputToString()
session = podmanTest.Podman([]string{"start", cid1, "doesnotexist"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
It("podman multiple containers -- attach should fail", func() {
session := podmanTest.Podman([]string{"create", "--name", "foobar1", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"create", "--name", "foobar2", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"start", "-a", "foobar1", "foobar2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
It("podman failed to start with --rm should delete the container", func() {
session := podmanTest.Podman([]string{"create", "--name", "test1", "-it", "--rm", ALPINE, "foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
start := podmanTest.Podman([]string{"start", "test1"})
start.WaitWithDefaultTimeout()
@@ -215,12 +218,12 @@ var _ = Describe("Podman start", func() {
pidfile := tempdir + "pidfile"
session := podmanTest.Podman([]string{"create", "--pidfile", pidfile, ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
session = podmanTest.Podman([]string{"start", cid})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
readFirstLine := func(path string) string {
content, err := ioutil.ReadFile(path)
Expect(err).To(BeNil())
diff --git a/test/e2e/stats_test.go b/test/e2e/stats_test.go
index 7ab3dabc9..e32d515a0 100644
--- a/test/e2e/stats_test.go
+++ b/test/e2e/stats_test.go
@@ -11,6 +11,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
// TODO: we need to check the output. Currently, we only check the exit codes
@@ -43,62 +44,62 @@ var _ = Describe("Podman stats", func() {
It("podman stats with bogus container", func() {
session := podmanTest.Podman([]string{"stats", "--no-stream", "123"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
It("podman stats on a running container", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
session = podmanTest.Podman([]string{"stats", "--no-stream", cid})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman stats on all containers", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"stats", "--no-stream", "-a"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman stats on all running containers", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"stats", "--no-stream"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman stats only output cids", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"stats", "--all", "--no-stream", "--format", "\"{{.ID}}\""})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman stats only output CPU data", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"stats", "--all", "--no-stream", "--format", "\"{{.ID}} {{.UpTime}} {{.AVGCPU}}\""})
session.WaitWithDefaultTimeout()
Expect(session.LineInOutputContains("UpTime")).To(BeTrue())
Expect(session.LineInOutputContains("AVGCPU")).To(BeTrue())
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman stats with json output", func() {
var found bool
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
for i := 0; i < 5; i++ {
ps := podmanTest.Podman([]string{"ps", "-q"})
ps.WaitWithDefaultTimeout()
@@ -111,42 +112,42 @@ var _ = Describe("Podman stats", func() {
Expect(found).To(BeTrue())
stats := podmanTest.Podman([]string{"stats", "--all", "--no-stream", "--format", "json"})
stats.WaitWithDefaultTimeout()
- Expect(stats.ExitCode()).To(Equal(0))
+ Expect(stats).Should(Exit(0))
Expect(stats.IsJSONOutputValid()).To(BeTrue())
})
It("podman stats on a container with no net ns", func() {
session := podmanTest.Podman([]string{"run", "-d", "--net", "none", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"stats", "--no-stream", "-a"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman stats on a container that joined another's net ns", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
session = podmanTest.Podman([]string{"run", "-d", "--net", fmt.Sprintf("container:%s", cid), ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"stats", "--no-stream", "-a"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman stats on container with forced slirp4netns", func() {
// This will force the slirp4netns net mode to be tested as root
session := podmanTest.Podman([]string{"run", "-d", "--net", "slirp4netns", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"stats", "--no-stream", "-a"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
// Regression test for #8265
@@ -160,19 +161,19 @@ var _ = Describe("Podman stats", func() {
session := podmanTest.Podman([]string{"run", "-d", "--name", ctrNoLimit0, ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "-d", "--name", ctrNoLimit1, ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "-d", "--name", ctrWithLimit, "--memory", "50m", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"stats", "--no-stream", "--format", "{{.MemLimit}}", ctrNoLimit0, ctrNoLimit1, ctrWithLimit})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// We have three containers. The unlimited ones need to have
// the same limit, the limited one a lower one.
diff --git a/test/e2e/stop_test.go b/test/e2e/stop_test.go
index d6d58c94c..a984bf6d0 100644
--- a/test/e2e/stop_test.go
+++ b/test/e2e/stop_test.go
@@ -8,6 +8,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman stop", func() {
@@ -37,18 +38,18 @@ var _ = Describe("Podman stop", func() {
It("podman stop bogus container", func() {
session := podmanTest.Podman([]string{"stop", "foobar"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
It("podman stop --ignore bogus container", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
session = podmanTest.Podman([]string{"stop", "--ignore", "foobar", cid})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
output := session.OutputToString()
Expect(output).To(ContainSubstring(cid))
})
@@ -56,84 +57,84 @@ var _ = Describe("Podman stop", func() {
It("podman stop container by id", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
session = podmanTest.Podman([]string{"stop", cid})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
finalCtrs := podmanTest.Podman([]string{"ps", "-q"})
finalCtrs.WaitWithDefaultTimeout()
- Expect(finalCtrs.ExitCode()).To(Equal(0))
+ Expect(finalCtrs).Should(Exit(0))
Expect(strings.TrimSpace(finalCtrs.OutputToString())).To(Equal(""))
})
It("podman stop container by name", func() {
session := podmanTest.RunTopContainer("test1")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"stop", "test1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
finalCtrs := podmanTest.Podman([]string{"ps", "-q"})
finalCtrs.WaitWithDefaultTimeout()
- Expect(finalCtrs.ExitCode()).To(Equal(0))
+ Expect(finalCtrs).Should(Exit(0))
Expect(strings.TrimSpace(finalCtrs.OutputToString())).To(Equal(""))
})
It("podman container stop by name", func() {
session := podmanTest.RunTopContainer("test1")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"container", "stop", "test1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
finalCtrs := podmanTest.Podman([]string{"ps", "-q"})
finalCtrs.WaitWithDefaultTimeout()
- Expect(finalCtrs.ExitCode()).To(Equal(0))
+ Expect(finalCtrs).Should(Exit(0))
Expect(strings.TrimSpace(finalCtrs.OutputToString())).To(Equal(""))
})
It("podman stop stopped container", func() {
session := podmanTest.RunTopContainer("test1")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session2 := podmanTest.Podman([]string{"stop", "test1"})
session2.WaitWithDefaultTimeout()
- Expect(session2.ExitCode()).To(Equal(0))
+ Expect(session2).Should(Exit(0))
session3 := podmanTest.Podman([]string{"stop", "test1"})
session3.WaitWithDefaultTimeout()
- Expect(session3.ExitCode()).To(Equal(0))
+ Expect(session3).Should(Exit(0))
finalCtrs := podmanTest.Podman([]string{"ps", "-q"})
finalCtrs.WaitWithDefaultTimeout()
- Expect(finalCtrs.ExitCode()).To(Equal(0))
+ Expect(finalCtrs).Should(Exit(0))
Expect(strings.TrimSpace(finalCtrs.OutputToString())).To(Equal(""))
})
It("podman stop all containers -t", func() {
session := podmanTest.RunTopContainer("test1")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid1 := session.OutputToString()
session = podmanTest.RunTopContainer("test2")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid2 := session.OutputToString()
session = podmanTest.RunTopContainer("test3")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid3 := session.OutputToString()
session = podmanTest.Podman([]string{"stop", "-a", "-t", "1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
output := session.OutputToString()
Expect(output).To(ContainSubstring(cid1))
Expect(output).To(ContainSubstring(cid2))
@@ -141,42 +142,42 @@ var _ = Describe("Podman stop", func() {
finalCtrs := podmanTest.Podman([]string{"ps", "-q"})
finalCtrs.WaitWithDefaultTimeout()
- Expect(finalCtrs.ExitCode()).To(Equal(0))
+ Expect(finalCtrs).Should(Exit(0))
Expect(strings.TrimSpace(finalCtrs.OutputToString())).To(Equal(""))
})
It("podman stop container --time", func() {
session := podmanTest.RunTopContainer("test4")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"stop", "--time", "0", "test4"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
output := session.OutputToString()
Expect(output).To(ContainSubstring("test4"))
finalCtrs := podmanTest.Podman([]string{"ps", "-q"})
finalCtrs.WaitWithDefaultTimeout()
- Expect(finalCtrs.ExitCode()).To(Equal(0))
+ Expect(finalCtrs).Should(Exit(0))
Expect(strings.TrimSpace(finalCtrs.OutputToString())).To(Equal(""))
})
It("podman stop container --timeout", func() {
session := podmanTest.Podman([]string{"run", "-d", "--name", "test5", ALPINE, "sleep", "100"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"stop", "--timeout", "0", "test5"})
// Without timeout container stops in 10 seconds
// If not stopped in 5 seconds, then --timeout did not work
session.Wait(5)
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
output := session.OutputToString()
Expect(output).To(ContainSubstring("test5"))
finalCtrs := podmanTest.Podman([]string{"ps", "-q"})
finalCtrs.WaitWithDefaultTimeout()
- Expect(finalCtrs.ExitCode()).To(Equal(0))
+ Expect(finalCtrs).Should(Exit(0))
Expect(strings.TrimSpace(finalCtrs.OutputToString())).To(Equal(""))
})
@@ -184,52 +185,52 @@ var _ = Describe("Podman stop", func() {
SkipIfRemote("--latest flag n/a")
session := podmanTest.RunTopContainer("test1")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"stop", "-l", "-t", "1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
finalCtrs := podmanTest.Podman([]string{"ps", "-q"})
finalCtrs.WaitWithDefaultTimeout()
- Expect(finalCtrs.ExitCode()).To(Equal(0))
+ Expect(finalCtrs).Should(Exit(0))
Expect(strings.TrimSpace(finalCtrs.OutputToString())).To(Equal(""))
})
It("podman stop all containers with one stopped", func() {
session := podmanTest.RunTopContainer("test1")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session2 := podmanTest.RunTopContainer("test2")
session2.WaitWithDefaultTimeout()
- Expect(session2.ExitCode()).To(Equal(0))
+ Expect(session2).Should(Exit(0))
cid := "-l"
if IsRemote() {
cid = "test2"
}
session3 := podmanTest.Podman([]string{"stop", cid, "-t", "1"})
session3.WaitWithDefaultTimeout()
- Expect(session3.ExitCode()).To(Equal(0))
+ Expect(session3).Should(Exit(0))
session4 := podmanTest.Podman([]string{"stop", "-a", "-t", "1"})
session4.WaitWithDefaultTimeout()
- Expect(session4.ExitCode()).To(Equal(0))
+ Expect(session4).Should(Exit(0))
finalCtrs := podmanTest.Podman([]string{"ps", "-q"})
finalCtrs.WaitWithDefaultTimeout()
- Expect(finalCtrs.ExitCode()).To(Equal(0))
+ Expect(finalCtrs).Should(Exit(0))
Expect(strings.TrimSpace(finalCtrs.OutputToString())).To(Equal(""))
})
It("podman stop all containers with one created", func() {
session := podmanTest.RunTopContainer("test1")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session2 := podmanTest.Podman([]string{"create", ALPINE, "/bin/sh"})
session2.WaitWithDefaultTimeout()
- Expect(session2.ExitCode()).To(Equal(0))
+ Expect(session2).Should(Exit(0))
session3 := podmanTest.Podman([]string{"stop", "-a", "-t", "1"})
session3.WaitWithDefaultTimeout()
- Expect(session3.ExitCode()).To(Equal(0))
+ Expect(session3).Should(Exit(0))
finalCtrs := podmanTest.Podman([]string{"ps", "-q"})
finalCtrs.WaitWithDefaultTimeout()
- Expect(finalCtrs.ExitCode()).To(Equal(0))
+ Expect(finalCtrs).Should(Exit(0))
Expect(strings.TrimSpace(finalCtrs.OutputToString())).To(Equal(""))
})
@@ -243,16 +244,16 @@ var _ = Describe("Podman stop", func() {
session := podmanTest.Podman([]string{"create", "--cidfile", tmpFile, ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToStringArray()[0]
session = podmanTest.Podman([]string{"start", cid})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"stop", "--cidfile", tmpFile})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
output := result.OutputToString()
Expect(output).To(ContainSubstring(cid))
})
@@ -268,19 +269,19 @@ var _ = Describe("Podman stop", func() {
session := podmanTest.Podman([]string{"run", "--cidfile", tmpFile1, "-d", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid1 := session.OutputToStringArray()[0]
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
session = podmanTest.Podman([]string{"run", "--cidfile", tmpFile2, "-d", ALPINE, "top"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid2 := session.OutputToStringArray()[0]
Expect(podmanTest.NumberOfContainers()).To(Equal(2))
result := podmanTest.Podman([]string{"stop", "--cidfile", tmpFile1, "--cidfile", tmpFile2})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
output := result.OutputToString()
Expect(output).To(ContainSubstring(cid1))
Expect(output).To(ContainSubstring(cid2))
@@ -292,52 +293,52 @@ var _ = Describe("Podman stop", func() {
result := podmanTest.Podman([]string{"stop", "--cidfile", "foobar", "--latest"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(125))
+ Expect(result).Should(Exit(125))
result = podmanTest.Podman([]string{"stop", "--cidfile", "foobar", "--all"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(125))
+ Expect(result).Should(Exit(125))
result = podmanTest.Podman([]string{"stop", "--cidfile", "foobar", "--all", "--latest"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(125))
+ Expect(result).Should(Exit(125))
result = podmanTest.Podman([]string{"stop", "--latest", "--all"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(125))
+ Expect(result).Should(Exit(125))
})
It("podman stop --all", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
session = podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(2))
session = podmanTest.Podman([]string{"stop", "--all"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
It("podman stop --ignore", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
session = podmanTest.Podman([]string{"stop", "bogus", cid})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
session = podmanTest.Podman([]string{"stop", "--ignore", "bogus", cid})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
})
diff --git a/test/e2e/system_df_test.go b/test/e2e/system_df_test.go
index 9aee85ca3..4dc1f3591 100644
--- a/test/e2e/system_df_test.go
+++ b/test/e2e/system_df_test.go
@@ -9,6 +9,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("podman system df", func() {
@@ -38,24 +39,24 @@ var _ = Describe("podman system df", func() {
It("podman system df", func() {
session := podmanTest.Podman([]string{"create", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "create", "data"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"create", "-v", "data:/data", "--name", "container1", BB})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"images", "-q"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
totImages := strconv.Itoa(len(session.OutputToStringArray()))
session = podmanTest.Podman([]string{"system", "df"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(4))
images := strings.Fields(session.OutputToStringArray()[1])
containers := strings.Fields(session.OutputToStringArray()[2])
@@ -69,14 +70,14 @@ var _ = Describe("podman system df", func() {
podmanTest.AddImageToRWStore(ALPINE)
session := podmanTest.Podman([]string{"create", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"image", "untag", ALPINE})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"system", "df"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
})
diff --git a/test/e2e/system_reset_test.go b/test/e2e/system_reset_test.go
index fcfcdaf85..102526a46 100644
--- a/test/e2e/system_reset_test.go
+++ b/test/e2e/system_reset_test.go
@@ -7,6 +7,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("podman system reset", func() {
@@ -39,25 +40,25 @@ var _ = Describe("podman system reset", func() {
session := podmanTest.Podman([]string{"rmi", "--force", "--all"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"images", "-n"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
l := len(session.OutputToStringArray())
podmanTest.AddImageToRWStore(ALPINE)
session = podmanTest.Podman([]string{"volume", "create", "data"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"create", "-v", "data:/data", ALPINE, "echo", "hello"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"system", "reset", "-f"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// If remote then the API service should have exited
// On local tests this is a noop
@@ -65,17 +66,17 @@ var _ = Describe("podman system reset", func() {
session = podmanTest.Podman([]string{"images", "-n"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(l))
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(0))
session = podmanTest.Podman([]string{"container", "ls", "-q"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(0))
})
})
diff --git a/test/e2e/systemd_test.go b/test/e2e/systemd_test.go
index 8dc14d5f7..bb51d6ac2 100644
--- a/test/e2e/systemd_test.go
+++ b/test/e2e/systemd_test.go
@@ -10,6 +10,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman systemd", func() {
@@ -57,21 +58,21 @@ WantedBy=multi-user.target
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))
+ Expect(stop).Should(Exit(0))
}()
create := podmanTest.Podman([]string{"create", "--name", "redis", redis})
create.WaitWithDefaultTimeout()
- Expect(create.ExitCode()).To(Equal(0))
+ Expect(create).Should(Exit(0))
enable := SystemExec("bash", []string{"-c", "systemctl daemon-reload"})
- Expect(enable.ExitCode()).To(Equal(0))
+ Expect(enable).Should(Exit(0))
start := SystemExec("bash", []string{"-c", "systemctl start redis"})
- Expect(start.ExitCode()).To(Equal(0))
+ Expect(start).Should(Exit(0))
logs := SystemExec("bash", []string{"-c", "journalctl -n 20 -u redis"})
- Expect(logs.ExitCode()).To(Equal(0))
+ Expect(logs).Should(Exit(0))
status := SystemExec("bash", []string{"-c", "systemctl status redis"})
Expect(status.OutputToString()).To(ContainSubstring("active (running)"))
@@ -81,19 +82,19 @@ WantedBy=multi-user.target
ctrName := "testSystemd"
run := podmanTest.Podman([]string{"run", "--name", ctrName, "-t", "-i", "-d", ubi_init, "/sbin/init"})
run.WaitWithDefaultTimeout()
- Expect(run.ExitCode()).To(Equal(0))
+ Expect(run).Should(Exit(0))
ctrID := run.OutputToString()
logs := podmanTest.Podman([]string{"logs", ctrName})
logs.WaitWithDefaultTimeout()
- Expect(logs.ExitCode()).To(Equal(0))
+ Expect(logs).Should(Exit(0))
// Give container 10 seconds to start
started := false
for i := 0; i < 10; i++ {
runningCtrs := podmanTest.Podman([]string{"ps", "-q", "--no-trunc"})
runningCtrs.WaitWithDefaultTimeout()
- Expect(runningCtrs.ExitCode()).To(Equal(0))
+ Expect(runningCtrs).Should(Exit(0))
if strings.Contains(runningCtrs.OutputToString(), ctrID) {
started = true
@@ -107,12 +108,12 @@ WantedBy=multi-user.target
systemctl := podmanTest.Podman([]string{"exec", "-t", "-i", ctrName, "systemctl", "status", "--no-pager"})
systemctl.WaitWithDefaultTimeout()
- Expect(systemctl.ExitCode()).To(Equal(0))
+ Expect(systemctl).Should(Exit(0))
Expect(strings.Contains(systemctl.OutputToString(), "State:")).To(BeTrue())
result := podmanTest.Podman([]string{"inspect", ctrName})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
conData := result.InspectContainerToJSON()
Expect(len(conData)).To(Equal(1))
Expect(conData[0].Config.SystemdMode).To(BeTrue())
@@ -120,7 +121,7 @@ WantedBy=multi-user.target
if CGROUPSV2 || !rootless.IsRootless() {
stats := podmanTest.Podman([]string{"stats", "--no-stream", ctrName})
stats.WaitWithDefaultTimeout()
- Expect(stats.ExitCode()).To(Equal(0))
+ Expect(stats).Should(Exit(0))
}
})
@@ -128,11 +129,11 @@ WantedBy=multi-user.target
ctrName := "testCtr"
run := podmanTest.Podman([]string{"create", "--name", ctrName, "--entrypoint", "/sbin/init", ubi_init})
run.WaitWithDefaultTimeout()
- Expect(run.ExitCode()).To(Equal(0))
+ Expect(run).Should(Exit(0))
result := podmanTest.Podman([]string{"inspect", ctrName})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
conData := result.InspectContainerToJSON()
Expect(len(conData)).To(Equal(1))
Expect(conData[0].Config.SystemdMode).To(BeTrue())
@@ -142,11 +143,11 @@ WantedBy=multi-user.target
ctrName := "testCtrUidMap"
run := podmanTest.Podman([]string{"run", "-d", "--uidmap=0:1:1000", "--name", ctrName, ALPINE, "top"})
run.WaitWithDefaultTimeout()
- Expect(run.ExitCode()).To(Equal(0))
+ Expect(run).Should(Exit(0))
session := podmanTest.Podman([]string{"inspect", "--format", "{{.ConmonPidFile}}", ctrName})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
pidFile := strings.TrimSuffix(session.OutputToString(), "\n")
_, err := ioutil.ReadFile(pidFile)
@@ -157,11 +158,11 @@ WantedBy=multi-user.target
ctrName := "testCtr"
run := podmanTest.Podman([]string{"create", "--name", ctrName, "--systemd", "always", ALPINE})
run.WaitWithDefaultTimeout()
- Expect(run.ExitCode()).To(Equal(0))
+ Expect(run).Should(Exit(0))
result := podmanTest.Podman([]string{"inspect", ctrName})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
conData := result.InspectContainerToJSON()
Expect(len(conData)).To(Equal(1))
Expect(conData[0].Config.SystemdMode).To(BeTrue())
@@ -170,7 +171,7 @@ WantedBy=multi-user.target
It("podman run --systemd container should NOT mount /run noexec", func() {
session := podmanTest.Podman([]string{"run", "--systemd", "always", ALPINE, "sh", "-c", "mount | grep \"/run \""})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Not(ContainSubstring("noexec")))
})
diff --git a/test/e2e/tag_test.go b/test/e2e/tag_test.go
index 83b6d023d..b835d3776 100644
--- a/test/e2e/tag_test.go
+++ b/test/e2e/tag_test.go
@@ -6,6 +6,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman tag", func() {
@@ -35,11 +36,11 @@ var _ = Describe("Podman tag", func() {
It("podman tag shortname:latest", func() {
session := podmanTest.Podman([]string{"tag", ALPINE, "foobar:latest"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
results := podmanTest.Podman([]string{"inspect", "foobar:latest"})
results.WaitWithDefaultTimeout()
- Expect(results.ExitCode()).To(Equal(0))
+ Expect(results).Should(Exit(0))
inspectData := results.InspectImageJSON()
Expect(StringInSlice("quay.io/libpod/alpine:latest", inspectData[0].RepoTags)).To(BeTrue())
Expect(StringInSlice("localhost/foobar:latest", inspectData[0].RepoTags)).To(BeTrue())
@@ -48,11 +49,11 @@ var _ = Describe("Podman tag", func() {
It("podman tag shortname", func() {
session := podmanTest.Podman([]string{"tag", ALPINE, "foobar"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
results := podmanTest.Podman([]string{"inspect", "foobar:latest"})
results.WaitWithDefaultTimeout()
- Expect(results.ExitCode()).To(Equal(0))
+ Expect(results).Should(Exit(0))
inspectData := results.InspectImageJSON()
Expect(StringInSlice("quay.io/libpod/alpine:latest", inspectData[0].RepoTags)).To(BeTrue())
Expect(StringInSlice("localhost/foobar:latest", inspectData[0].RepoTags)).To(BeTrue())
@@ -61,11 +62,11 @@ var _ = Describe("Podman tag", func() {
It("podman tag shortname:tag", func() {
session := podmanTest.Podman([]string{"tag", ALPINE, "foobar:new"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
results := podmanTest.Podman([]string{"inspect", "foobar:new"})
results.WaitWithDefaultTimeout()
- Expect(results.ExitCode()).To(Equal(0))
+ Expect(results).Should(Exit(0))
inspectData := results.InspectImageJSON()
Expect(StringInSlice("quay.io/libpod/alpine:latest", inspectData[0].RepoTags)).To(BeTrue())
Expect(StringInSlice("localhost/foobar:new", inspectData[0].RepoTags)).To(BeTrue())
@@ -74,14 +75,14 @@ var _ = Describe("Podman tag", func() {
It("podman tag shortname image no tag", func() {
session := podmanTest.Podman([]string{"tag", ALPINE, "foobar"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
results := podmanTest.Podman([]string{"tag", "foobar", "barfoo"})
results.WaitWithDefaultTimeout()
- Expect(results.ExitCode()).To(Equal(0))
+ Expect(results).Should(Exit(0))
verify := podmanTest.Podman([]string{"inspect", "barfoo"})
verify.WaitWithDefaultTimeout()
- Expect(verify.ExitCode()).To(Equal(0))
+ Expect(verify).Should(Exit(0))
})
})
diff --git a/test/e2e/toolbox_test.go b/test/e2e/toolbox_test.go
index 16300bebc..e1fe44675 100644
--- a/test/e2e/toolbox_test.go
+++ b/test/e2e/toolbox_test.go
@@ -39,6 +39,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Toolbox-specific testing", func() {
@@ -70,7 +71,7 @@ var _ = Describe("Toolbox-specific testing", func() {
session = podmanTest.Podman([]string{"run", "--dns", "none", ALPINE, "sh", "-c",
"rm -f /etc/resolv.conf; touch -d '1970-01-01 00:02:03' /etc/resolv.conf; stat -c %s:%Y /etc/resolv.conf"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("0:123"))
})
@@ -80,7 +81,7 @@ var _ = Describe("Toolbox-specific testing", func() {
session = podmanTest.Podman([]string{"run", "--no-hosts", ALPINE, "sh", "-c",
"rm -f /etc/hosts; touch -d '1970-01-01 00:02:03' /etc/hosts; stat -c %s:%Y /etc/hosts"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("0:123"))
})
@@ -100,16 +101,16 @@ var _ = Describe("Toolbox-specific testing", func() {
session = podmanTest.Podman([]string{"create", "--name", "test", "--ulimit", "host", ALPINE,
"sleep", "1000"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"start", "test"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"exec", "test", "sh", "-c",
"ulimit -H -n"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
containerHardLimit, err = strconv.Atoi(strings.Trim(session.OutputToString(), "\n"))
Expect(err).To(BeNil())
Expect(containerHardLimit).To(BeNumerically(">=", rlimit.Max))
@@ -141,16 +142,16 @@ var _ = Describe("Toolbox-specific testing", func() {
session = podmanTest.Podman([]string{"create", "--name", "test", "--ipc=host", "--pid=host", ALPINE,
"sleep", "1000"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"start", "test"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"exec", "test",
"df", "/dev/shm"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
lines = session.OutputToStringArray()
fields = strings.Fields(lines[len(lines)-1])
containerShmSize, err = strconv.Atoi(fields[1])
@@ -168,7 +169,7 @@ var _ = Describe("Toolbox-specific testing", func() {
session = podmanTest.Podman([]string{"run", "--userns=keep-id", "--user", "root:root", ALPINE,
"id"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("uid=0(root) gid=0(root)"))
})
@@ -185,12 +186,12 @@ var _ = Describe("Toolbox-specific testing", func() {
session = podmanTest.Podman([]string{"create", "--name", "test", "--userns=keep-id", ALPINE,
"sleep", "1000"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(err).To(BeNil())
session = podmanTest.Podman([]string{"start", "test"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
expectedOutput := fmt.Sprintf("uid=%s(%s) gid=%s(%s)",
currentUser.Uid, currentUser.Username,
@@ -199,7 +200,7 @@ var _ = Describe("Toolbox-specific testing", func() {
session = podmanTest.Podman([]string{"exec", "test",
"id"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(expectedOutput))
})
@@ -218,11 +219,11 @@ var _ = Describe("Toolbox-specific testing", func() {
session = podmanTest.Podman([]string{"create", "--log-driver", "k8s-file", "--name", "test", "--userns=keep-id", "--user", "root:root", fedoraToolbox, "sh", "-c",
fmt.Sprintf("%s; %s; echo READY; sleep 1000", useradd, passwd)})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"start", "test"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(WaitContainerReady(podmanTest, "test", "READY", 5, 1)).To(BeTrue())
@@ -231,14 +232,14 @@ var _ = Describe("Toolbox-specific testing", func() {
session = podmanTest.Podman([]string{"exec", "test", "cat", "/etc/passwd"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(expectedOutput))
expectedOutput = "passwd: Note: deleting a password also unlocks the password."
session = podmanTest.Podman([]string{"logs", "test"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.ErrorToString()).To(ContainSubstring(expectedOutput))
})
@@ -253,22 +254,22 @@ var _ = Describe("Toolbox-specific testing", func() {
session = podmanTest.Podman([]string{"create", "--log-driver", "k8s-file", "--name", "test", "--userns=keep-id", "--user", "root:root", fedoraToolbox, "sh", "-c",
fmt.Sprintf("%s; echo READY; sleep 1000", groupadd)})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"start", "test"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(WaitContainerReady(podmanTest, "test", "READY", 5, 1)).To(BeTrue())
session = podmanTest.Podman([]string{"exec", "test", "cat", "/etc/group"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(groupName))
session = podmanTest.Podman([]string{"logs", "test"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("READY"))
})
@@ -297,11 +298,11 @@ var _ = Describe("Toolbox-specific testing", func() {
session = podmanTest.Podman([]string{"create", "--log-driver", "k8s-file", "--name", "test", "--userns=keep-id", "--user", "root:root", fedoraToolbox, "sh", "-c",
fmt.Sprintf("%s; %s; %s; echo READY; sleep 1000", useradd, groupadd, usermod)})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"start", "test"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(WaitContainerReady(podmanTest, "test", "READY", 5, 1)).To(BeTrue())
@@ -310,12 +311,12 @@ var _ = Describe("Toolbox-specific testing", func() {
session = podmanTest.Podman([]string{"exec", "test", "cat", "/etc/passwd"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(expectedUser))
session = podmanTest.Podman([]string{"logs", "test"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("READY"))
})
@@ -325,12 +326,12 @@ var _ = Describe("Toolbox-specific testing", func() {
session = podmanTest.Podman([]string{"run", "--privileged", "--userns=keep-id", "--user", "root:root", ALPINE,
"mount", "-t", "tmpfs", "tmpfs", "/tmp"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "--privileged", "--userns=keep-id", "--user", "root:root", ALPINE,
"mount", "--rbind", "/tmp", "/var/tmp"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman create + start - with all needed switches for create - sleep as entry-point", func() {
@@ -355,17 +356,17 @@ var _ = Describe("Toolbox-specific testing", func() {
"--user", "root:root",
fedoraToolbox, "sh", "-c", "echo READY; sleep 1000"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"start", "test"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(WaitContainerReady(podmanTest, "test", "READY", 5, 1)).To(BeTrue())
session = podmanTest.Podman([]string{"logs", "test"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("READY"))
})
@@ -377,7 +378,7 @@ var _ = Describe("Toolbox-specific testing", func() {
session = podmanTest.Podman([]string{"run", "-v", fmt.Sprintf("%s:%s", currentUser.HomeDir, currentUser.HomeDir), "--userns=keep-id", fedoraToolbox, "sh", "-c", "echo $HOME"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(currentUser.HomeDir))
if rootless.IsRootless() {
@@ -388,7 +389,7 @@ var _ = Describe("Toolbox-specific testing", func() {
"--volume", volumeArg,
fedoraToolbox, "sh", "-c", "echo $HOME"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(currentUser.HomeDir))
}
})
diff --git a/test/e2e/top_test.go b/test/e2e/top_test.go
index d7105b17a..3cf6244b6 100644
--- a/test/e2e/top_test.go
+++ b/test/e2e/top_test.go
@@ -6,6 +6,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman top", func() {
@@ -35,13 +36,13 @@ var _ = Describe("Podman top", func() {
It("podman top without container name or id", func() {
result := podmanTest.Podman([]string{"top"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(125))
+ Expect(result).Should(Exit(125))
})
It("podman top on bogus container", func() {
result := podmanTest.Podman([]string{"top", "1234"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(125))
+ Expect(result).Should(Exit(125))
})
It("podman top on non-running container", func() {
@@ -49,68 +50,68 @@ var _ = Describe("Podman top", func() {
Expect(ec).To(Equal(0))
result := podmanTest.Podman([]string{"top", cid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(125))
+ Expect(result).Should(Exit(125))
})
It("podman top on container", func() {
session := podmanTest.Podman([]string{"run", "--name", "test", "-d", ALPINE, "top", "-d", "2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"top", "test"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).To(BeNumerically(">", 1))
})
It("podman container top on container", func() {
session := podmanTest.Podman([]string{"container", "run", "--name", "test", "-d", ALPINE, "top", "-d", "2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"container", "top", "test"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).To(BeNumerically(">", 1))
})
It("podman top with options", func() {
session := podmanTest.Podman([]string{"run", "-d", ALPINE, "top", "-d", "2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"top", session.OutputToString(), "pid", "%C", "args"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).To(BeNumerically(">", 1))
})
It("podman top with ps(1) options", func() {
session := podmanTest.Podman([]string{"run", "-d", ALPINE, "top", "-d", "2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"top", session.OutputToString(), "aux"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).To(BeNumerically(">", 1))
})
It("podman top with comma-separated options", func() {
session := podmanTest.Podman([]string{"run", "-d", ALPINE, "top", "-d", "2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"top", session.OutputToString(), "user,pid,comm"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).To(BeNumerically(">", 1))
})
It("podman top on container invalid options", func() {
top := podmanTest.RunTopContainer("")
top.WaitWithDefaultTimeout()
- Expect(top.ExitCode()).To(Equal(0))
+ Expect(top).Should(Exit(0))
cid := top.OutputToString()
// We need to pass -eo to force executing ps in the Alpine container.
@@ -119,7 +120,7 @@ var _ = Describe("Podman top", func() {
// the wrong input and still print the -ef output instead.
result := podmanTest.Podman([]string{"top", cid, "-eo", "invalid"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(125))
+ Expect(result).Should(Exit(125))
})
})
diff --git a/test/e2e/tree_test.go b/test/e2e/tree_test.go
index 33c69554b..492dc50b2 100644
--- a/test/e2e/tree_test.go
+++ b/test/e2e/tree_test.go
@@ -7,6 +7,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman image tree", func() {
@@ -45,16 +46,16 @@ ENV foo=bar
session := podmanTest.Podman([]string{"image", "tree", "test:latest"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"image", "tree", "--whatrequires", "quay.io/libpod/cirros:latest"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"rmi", "test:latest"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"rmi", "quay.io/libpod/cirros:latest"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
})
diff --git a/test/e2e/trust_test.go b/test/e2e/trust_test.go
index ae7b987ae..7f97f280a 100644
--- a/test/e2e/trust_test.go
+++ b/test/e2e/trust_test.go
@@ -9,6 +9,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman trust", func() {
@@ -43,7 +44,7 @@ var _ = Describe("Podman trust", func() {
}
session := podmanTest.Podman([]string{"image", "trust", "show", "--registrypath", filepath.Dir(path), "--policypath", filepath.Join(filepath.Dir(path), "policy.json")})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
outArray := session.OutputToStringArray()
Expect(len(outArray)).To(Equal(3))
@@ -61,7 +62,7 @@ var _ = Describe("Podman trust", func() {
}
session := podmanTest.Podman([]string{"image", "trust", "set", "--policypath", filepath.Join(filepath.Dir(path), "trust_set_test.json"), "-t", "accept", "default"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
var teststruct map[string][]map[string]string
policyContent, err := ioutil.ReadFile(filepath.Join(filepath.Dir(path), "trust_set_test.json"))
if err != nil {
@@ -77,7 +78,7 @@ var _ = Describe("Podman trust", func() {
It("podman image trust show --json", func() {
session := podmanTest.Podman([]string{"image", "trust", "show", "--json"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.IsJSONOutputValid()).To(BeTrue())
var teststruct []map[string]string
json.Unmarshal(session.Out.Contents(), &teststruct)
@@ -90,7 +91,7 @@ var _ = Describe("Podman trust", func() {
It("podman image trust show --raw", func() {
session := podmanTest.Podman([]string{"image", "trust", "show", "--raw"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.IsJSONOutputValid()).To(BeTrue())
Expect(session.OutputToString()).To(ContainSubstring("default"))
Expect(session.OutputToString()).To(ContainSubstring("insecureAcceptAnything"))
diff --git a/test/e2e/unshare_test.go b/test/e2e/unshare_test.go
index 24ab98916..eacdda68a 100644
--- a/test/e2e/unshare_test.go
+++ b/test/e2e/unshare_test.go
@@ -6,6 +6,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman unshare", func() {
@@ -45,7 +46,7 @@ var _ = Describe("Podman unshare", func() {
userNS, _ := os.Readlink("/proc/self/ns/user")
session := podmanTest.Podman([]string{"unshare", "readlink", "/proc/self/ns/user"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
ok, _ := session.GrepString(userNS)
Expect(ok).To(BeFalse())
})
@@ -53,7 +54,7 @@ var _ = Describe("Podman unshare", func() {
It("podman unshare --rootles-cni", func() {
session := podmanTest.Podman([]string{"unshare", "--rootless-cni", "ip", "addr"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("tap0"))
})
})
diff --git a/test/e2e/untag_test.go b/test/e2e/untag_test.go
index d0d271715..b247ad5da 100644
--- a/test/e2e/untag_test.go
+++ b/test/e2e/untag_test.go
@@ -6,6 +6,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman untag", func() {
@@ -39,25 +40,25 @@ var _ = Describe("Podman untag", func() {
cmd = append(cmd, tags...)
session := podmanTest.Podman(cmd)
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Make sure that all tags exists.
for _, t := range tags {
session = podmanTest.Podman([]string{"image", "exists", t})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
}
// No arguments -> remove all tags.
session = podmanTest.Podman([]string{"untag", cirros})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// Make sure that none of tags exists anymore.
for _, t := range tags {
session = podmanTest.Podman([]string{"image", "exists", t})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(1))
+ Expect(session).Should(Exit(1))
}
})
@@ -78,19 +79,19 @@ var _ = Describe("Podman untag", func() {
for _, tt := range tests {
session := podmanTest.Podman([]string{"tag", cirros, tt.tag})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"image", "exists", tt.normalized})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"untag", cirros, tt.tag})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"image", "exists", tt.normalized})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(1))
+ Expect(session).Should(Exit(1))
}
})
diff --git a/test/e2e/volume_create_test.go b/test/e2e/volume_create_test.go
index ab65146eb..51005d177 100644
--- a/test/e2e/volume_create_test.go
+++ b/test/e2e/volume_create_test.go
@@ -7,6 +7,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman volume create", func() {
@@ -37,7 +38,7 @@ var _ = Describe("Podman volume create", func() {
session := podmanTest.Podman([]string{"volume", "create"})
session.WaitWithDefaultTimeout()
volName := session.OutputToString()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
check := podmanTest.Podman([]string{"volume", "ls", "-q"})
check.WaitWithDefaultTimeout()
@@ -50,7 +51,7 @@ var _ = Describe("Podman volume create", func() {
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
session.WaitWithDefaultTimeout()
volName := session.OutputToString()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
check := podmanTest.Podman([]string{"volume", "ls", "-q"})
check.WaitWithDefaultTimeout()
@@ -71,16 +72,16 @@ var _ = Describe("Podman volume create", func() {
gid := "4000"
session := podmanTest.Podman([]string{"volume", "create", "--opt", fmt.Sprintf("o=uid=%s,gid=%s", uid, gid), volName})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
inspectUID := podmanTest.Podman([]string{"volume", "inspect", "--format", "{{ .UID }}", volName})
inspectUID.WaitWithDefaultTimeout()
- Expect(inspectUID.ExitCode()).To(Equal(0))
+ Expect(inspectUID).Should(Exit(0))
Expect(inspectUID.OutputToString()).To(Equal(uid))
inspectGID := podmanTest.Podman([]string{"volume", "inspect", "--format", "{{ .GID }}", volName})
inspectGID.WaitWithDefaultTimeout()
- Expect(inspectGID.ExitCode()).To(Equal(0))
+ Expect(inspectGID).Should(Exit(0))
Expect(inspectGID.OutputToString()).To(Equal(gid))
// options should containt `uid=3000,gid=4000:3000:4000`
@@ -88,7 +89,7 @@ var _ = Describe("Podman volume create", func() {
optionStrFormatExpect := fmt.Sprintf(`uid=%s,gid=%s:%s:%s`, uid, gid, uid, gid)
inspectOpts := podmanTest.Podman([]string{"volume", "inspect", "--format", optionFormat, volName})
inspectOpts.WaitWithDefaultTimeout()
- Expect(inspectOpts.ExitCode()).To(Equal(0))
+ Expect(inspectOpts).Should(Exit(0))
Expect(inspectOpts.OutputToString()).To(Equal(optionStrFormatExpect))
})
})
diff --git a/test/e2e/volume_exists_test.go b/test/e2e/volume_exists_test.go
index edbeb2c69..2118eb307 100644
--- a/test/e2e/volume_exists_test.go
+++ b/test/e2e/volume_exists_test.go
@@ -7,6 +7,7 @@ import (
"github.com/containers/storage/pkg/stringid"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman volume exists", func() {
@@ -37,14 +38,14 @@ var _ = Describe("Podman volume exists", func() {
vol := "vol" + stringid.GenerateNonCryptoID()
session := podmanTest.Podman([]string{"volume", "create", vol})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "exists", vol})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "exists", stringid.GenerateNonCryptoID()})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(1))
+ Expect(session).Should(Exit(1))
})
})
diff --git a/test/e2e/volume_inspect_test.go b/test/e2e/volume_inspect_test.go
index 05aaf1025..db95ba675 100644
--- a/test/e2e/volume_inspect_test.go
+++ b/test/e2e/volume_inspect_test.go
@@ -7,6 +7,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman volume inspect", func() {
@@ -37,11 +38,11 @@ var _ = Describe("Podman volume inspect", func() {
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
session.WaitWithDefaultTimeout()
volName := session.OutputToString()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "inspect", volName})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.IsJSONOutputValid()).To(BeTrue())
})
@@ -49,11 +50,11 @@ var _ = Describe("Podman volume inspect", func() {
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
session.WaitWithDefaultTimeout()
volName := session.OutputToString()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "inspect", "--format", "{{.Name}}", volName})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal(volName))
})
@@ -61,16 +62,16 @@ var _ = Describe("Podman volume inspect", func() {
session := podmanTest.Podman([]string{"volume", "create", "myvol1"})
session.WaitWithDefaultTimeout()
volName1 := session.OutputToString()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "create", "myvol2"})
session.WaitWithDefaultTimeout()
volName2 := session.OutputToString()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "inspect", "--format", "{{.Name}}", "--all"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(2))
Expect(session.OutputToStringArray()[0]).To(Equal(volName1))
Expect(session.OutputToStringArray()[1]).To(Equal(volName2))
@@ -80,11 +81,11 @@ var _ = Describe("Podman volume inspect", func() {
volName := "testvol"
session := podmanTest.Podman([]string{"volume", "create", "--opt", "type=tmpfs", volName})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
inspect := podmanTest.Podman([]string{"volume", "inspect", volName})
inspect.WaitWithDefaultTimeout()
- Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect).Should(Exit(0))
Expect(strings.Contains(inspect.OutputToString(), "tmpfs")).To(BeTrue())
})
})
diff --git a/test/e2e/volume_ls_test.go b/test/e2e/volume_ls_test.go
index cb5ecbcc3..ff3551ad9 100644
--- a/test/e2e/volume_ls_test.go
+++ b/test/e2e/volume_ls_test.go
@@ -37,29 +37,29 @@ var _ = Describe("Podman volume ls", func() {
It("podman ls volume", func() {
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(2))
})
It("podman ls volume with JSON format", func() {
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "ls", "--format", "json"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.IsJSONOutputValid()).To(BeTrue())
})
It("podman ls volume with Go template", func() {
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "ls", "--format", "table {{.Name}} {{.Driver}} {{.Scope}}"})
session.WaitWithDefaultTimeout()
@@ -72,32 +72,32 @@ var _ = Describe("Podman volume ls", func() {
session := podmanTest.Podman([]string{"volume", "create", "--label", "foo=bar", "myvol"})
volName := session.OutputToString()
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "create"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "label=foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(2))
Expect(session.OutputToStringArray()[1]).To(ContainSubstring(volName))
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "label=foo=foo"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(0))
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "label=foo=bar"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(2))
Expect(session.OutputToStringArray()[1]).To(ContainSubstring(volName))
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "label=foo=baz"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(0))
})
@@ -105,52 +105,52 @@ var _ = Describe("Podman volume ls", func() {
volName1 := "volume1"
session := podmanTest.Podman([]string{"volume", "create", volName1})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
volName2 := "volume2"
session2 := podmanTest.Podman([]string{"volume", "create", volName2})
session2.WaitWithDefaultTimeout()
- Expect(session2.ExitCode()).To(Equal(0))
+ Expect(session2).Should(Exit(0))
ctr := podmanTest.Podman([]string{"create", "-v", fmt.Sprintf("%s:/test", volName2), ALPINE, "sh"})
ctr.WaitWithDefaultTimeout()
- Expect(ctr.ExitCode()).To(Equal(0))
+ Expect(ctr).Should(Exit(0))
lsNoDangling := podmanTest.Podman([]string{"volume", "ls", "--filter", "dangling=false", "--quiet"})
lsNoDangling.WaitWithDefaultTimeout()
- Expect(lsNoDangling.ExitCode()).To(Equal(0))
+ Expect(lsNoDangling).Should(Exit(0))
Expect(lsNoDangling.OutputToString()).To(ContainSubstring(volName2))
lsDangling := podmanTest.Podman([]string{"volume", "ls", "--filter", "dangling=true", "--quiet"})
lsDangling.WaitWithDefaultTimeout()
- Expect(lsDangling.ExitCode()).To(Equal(0))
+ Expect(lsDangling).Should(Exit(0))
Expect(lsDangling.OutputToString()).To(ContainSubstring(volName1))
})
It("podman ls volume with multiple --filter flag", func() {
session := podmanTest.Podman([]string{"volume", "create", "--label", "foo=bar", "myvol"})
volName := session.OutputToString()
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "create", "--label", "foo2=bar2", "anothervol"})
anotherVol := session.OutputToString()
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "create"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "label=foo", "--filter", "label=foo2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(3))
Expect(session.OutputToStringArray()[1]).To(ContainSubstring(volName))
Expect(session.OutputToStringArray()[2]).To(ContainSubstring(anotherVol))
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "label=foo=bar", "--filter", "label=foo2=bar2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(3))
Expect(session.OutputToStringArray()[1]).To(ContainSubstring(volName))
Expect(session.OutputToStringArray()[2]).To(ContainSubstring(anotherVol))
diff --git a/test/e2e/volume_plugin_test.go b/test/e2e/volume_plugin_test.go
index 183050e8c..cdf635b14 100644
--- a/test/e2e/volume_plugin_test.go
+++ b/test/e2e/volume_plugin_test.go
@@ -8,6 +8,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman volume plugins", func() {
@@ -41,13 +42,13 @@ var _ = Describe("Podman volume plugins", func() {
It("volume create with nonexistent plugin errors", func() {
session := podmanTest.Podman([]string{"volume", "create", "--driver", "notexist", "test_volume_name"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
})
It("volume create with not-running plugin does not error", func() {
session := podmanTest.Podman([]string{"volume", "create", "--driver", "testvol0", "test_volume_name"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Not(Equal(0)))
+ Expect(session).To(ExitWithError())
})
It("volume create and remove with running plugin succeeds", func() {
@@ -60,27 +61,27 @@ var _ = Describe("Podman volume plugins", func() {
pluginName := "testvol1"
plugin := podmanTest.Podman([]string{"run", "--security-opt", "label=disable", "-v", "/run/docker/plugins:/run/docker/plugins", "-v", fmt.Sprintf("%v:%v", pluginStatePath, pluginStatePath), "-d", volumeTest, "--sock-name", pluginName, "--path", pluginStatePath})
plugin.WaitWithDefaultTimeout()
- Expect(plugin.ExitCode()).To(Equal(0))
+ Expect(plugin).Should(Exit(0))
volName := "testVolume1"
create := podmanTest.Podman([]string{"volume", "create", "--driver", pluginName, volName})
create.WaitWithDefaultTimeout()
- Expect(create.ExitCode()).To(Equal(0))
+ Expect(create).Should(Exit(0))
ls1 := podmanTest.Podman([]string{"volume", "ls", "-q"})
ls1.WaitWithDefaultTimeout()
- Expect(ls1.ExitCode()).To(Equal(0))
+ Expect(ls1).Should(Exit(0))
arrOutput := ls1.OutputToStringArray()
Expect(len(arrOutput)).To(Equal(1))
Expect(arrOutput[0]).To(ContainSubstring(volName))
remove := podmanTest.Podman([]string{"volume", "rm", volName})
remove.WaitWithDefaultTimeout()
- Expect(remove.ExitCode()).To(Equal(0))
+ Expect(remove).Should(Exit(0))
ls2 := podmanTest.Podman([]string{"volume", "ls", "-q"})
ls2.WaitWithDefaultTimeout()
- Expect(ls2.ExitCode()).To(Equal(0))
+ Expect(ls2).Should(Exit(0))
Expect(len(ls2.OutputToStringArray())).To(Equal(0))
})
@@ -94,16 +95,16 @@ var _ = Describe("Podman volume plugins", func() {
pluginName := "testvol2"
plugin := podmanTest.Podman([]string{"run", "--security-opt", "label=disable", "-v", "/run/docker/plugins:/run/docker/plugins", "-v", fmt.Sprintf("%v:%v", pluginStatePath, pluginStatePath), "-d", volumeTest, "--sock-name", pluginName, "--path", pluginStatePath})
plugin.WaitWithDefaultTimeout()
- Expect(plugin.ExitCode()).To(Equal(0))
+ Expect(plugin).Should(Exit(0))
volName := "testVolume1"
create := podmanTest.Podman([]string{"volume", "create", "--driver", pluginName, volName})
create.WaitWithDefaultTimeout()
- Expect(create.ExitCode()).To(Equal(0))
+ Expect(create).Should(Exit(0))
volInspect := podmanTest.Podman([]string{"volume", "inspect", "--format", "{{ .Driver }}", volName})
volInspect.WaitWithDefaultTimeout()
- Expect(volInspect.ExitCode()).To(Equal(0))
+ Expect(volInspect).Should(Exit(0))
Expect(volInspect.OutputToString()).To(ContainSubstring(pluginName))
})
@@ -118,33 +119,33 @@ var _ = Describe("Podman volume plugins", func() {
ctrName := "pluginCtr"
plugin := podmanTest.Podman([]string{"run", "--name", ctrName, "--security-opt", "label=disable", "-v", "/run/docker/plugins:/run/docker/plugins", "-v", fmt.Sprintf("%v:%v", pluginStatePath, pluginStatePath), "-d", volumeTest, "--sock-name", pluginName, "--path", pluginStatePath})
plugin.WaitWithDefaultTimeout()
- Expect(plugin.ExitCode()).To(Equal(0))
+ Expect(plugin).Should(Exit(0))
volName := "testVolume1"
create := podmanTest.Podman([]string{"volume", "create", "--driver", pluginName, volName})
create.WaitWithDefaultTimeout()
- Expect(create.ExitCode()).To(Equal(0))
+ Expect(create).Should(Exit(0))
ls1 := podmanTest.Podman([]string{"volume", "ls", "-q"})
ls1.WaitWithDefaultTimeout()
- Expect(ls1.ExitCode()).To(Equal(0))
+ Expect(ls1).Should(Exit(0))
arrOutput := ls1.OutputToStringArray()
Expect(len(arrOutput)).To(Equal(1))
Expect(arrOutput[0]).To(ContainSubstring(volName))
stop := podmanTest.Podman([]string{"stop", "--timeout", "0", ctrName})
stop.WaitWithDefaultTimeout()
- Expect(stop.ExitCode()).To(Equal(0))
+ Expect(stop).Should(Exit(0))
// Remove should exit non-zero because missing plugin
remove := podmanTest.Podman([]string{"volume", "rm", volName})
remove.WaitWithDefaultTimeout()
- Expect(remove.ExitCode()).To(Not(Equal(0)))
+ Expect(remove).To(ExitWithError())
// But the volume should still be gone
ls2 := podmanTest.Podman([]string{"volume", "ls", "-q"})
ls2.WaitWithDefaultTimeout()
- Expect(ls2.ExitCode()).To(Equal(0))
+ Expect(ls2).Should(Exit(0))
Expect(len(ls2.OutputToStringArray())).To(Equal(0))
})
@@ -158,20 +159,20 @@ var _ = Describe("Podman volume plugins", func() {
pluginName := "testvol4"
plugin := podmanTest.Podman([]string{"run", "--security-opt", "label=disable", "-v", "/run/docker/plugins:/run/docker/plugins", "-v", fmt.Sprintf("%v:%v", pluginStatePath, pluginStatePath), "-d", volumeTest, "--sock-name", pluginName, "--path", pluginStatePath})
plugin.WaitWithDefaultTimeout()
- Expect(plugin.ExitCode()).To(Equal(0))
+ Expect(plugin).Should(Exit(0))
volName := "testVolume1"
create := podmanTest.Podman([]string{"volume", "create", "--driver", pluginName, volName})
create.WaitWithDefaultTimeout()
- Expect(create.ExitCode()).To(Equal(0))
+ Expect(create).Should(Exit(0))
ctr1 := podmanTest.Podman([]string{"run", "--security-opt", "label=disable", "-v", fmt.Sprintf("%v:/test", volName), ALPINE, "sh", "-c", "touch /test/testfile && echo helloworld > /test/testfile"})
ctr1.WaitWithDefaultTimeout()
- Expect(ctr1.ExitCode()).To(Equal(0))
+ Expect(ctr1).Should(Exit(0))
ctr2 := podmanTest.Podman([]string{"run", "--security-opt", "label=disable", "-v", fmt.Sprintf("%v:/test", volName), ALPINE, "cat", "/test/testfile"})
ctr2.WaitWithDefaultTimeout()
- Expect(ctr2.ExitCode()).To(Equal(0))
+ Expect(ctr2).Should(Exit(0))
Expect(ctr2.OutputToString()).To(ContainSubstring("helloworld"))
// HACK: `volume rm -f` is timing out trying to remove containers using the volume.
@@ -179,6 +180,6 @@ var _ = Describe("Podman volume plugins", func() {
// TODO: fix this when I get back
rmAll := podmanTest.Podman([]string{"rm", "-af"})
rmAll.WaitWithDefaultTimeout()
- Expect(rmAll.ExitCode()).To(Equal(0))
+ Expect(rmAll).Should(Exit(0))
})
})
diff --git a/test/e2e/volume_prune_test.go b/test/e2e/volume_prune_test.go
index 1d4e64ec7..68a257110 100644
--- a/test/e2e/volume_prune_test.go
+++ b/test/e2e/volume_prune_test.go
@@ -6,6 +6,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman volume prune", func() {
@@ -35,28 +36,28 @@ var _ = Describe("Podman volume prune", func() {
It("podman prune volume", func() {
session := podmanTest.Podman([]string{"volume", "create"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "create"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"create", "-v", "myvol:/myvol", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(4))
session = podmanTest.Podman([]string{"volume", "prune", "--force"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(2))
podmanTest.Cleanup()
@@ -65,58 +66,58 @@ var _ = Describe("Podman volume prune", func() {
It("podman prune volume --filter", func() {
session := podmanTest.Podman([]string{"volume", "create", "--label", "label1=value1", "myvol1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "create", "--label", "sharedlabel1=slv1", "myvol2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "create", "--label", "sharedlabel1=slv2", "myvol3"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "create", "--label", "sharedlabel1", "myvol4"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"create", "-v", "myvol5:/myvol5", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"create", "-v", "myvol6:/myvol6", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(7))
session = podmanTest.Podman([]string{"volume", "prune", "--force", "--filter", "label=label1=value1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(6))
session = podmanTest.Podman([]string{"volume", "prune", "--force", "--filter", "label=sharedlabel1=slv1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(5))
session = podmanTest.Podman([]string{"volume", "prune", "--force", "--filter", "label=sharedlabel1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(3))
podmanTest.Cleanup()
@@ -125,28 +126,28 @@ var _ = Describe("Podman volume prune", func() {
It("podman system prune --volume", func() {
session := podmanTest.Podman([]string{"volume", "create"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "create"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"create", "-v", "myvol:/myvol", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(4))
session = podmanTest.Podman([]string{"system", "prune", "--force", "--volumes"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(0))
podmanTest.Cleanup()
diff --git a/test/e2e/volume_rm_test.go b/test/e2e/volume_rm_test.go
index 883a503c4..b979444bc 100644
--- a/test/e2e/volume_rm_test.go
+++ b/test/e2e/volume_rm_test.go
@@ -6,6 +6,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman volume rm", func() {
@@ -35,15 +36,15 @@ var _ = Describe("Podman volume rm", func() {
It("podman volume rm", func() {
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "rm", "myvol"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(0))
})
@@ -51,20 +52,20 @@ var _ = Describe("Podman volume rm", func() {
session := podmanTest.Podman([]string{"create", "-v", "myvol:/myvol", ALPINE, "ls"})
cid := session.OutputToString()
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "rm", "myvol"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(2))
+ Expect(session).Should(Exit(2))
Expect(session.ErrorToString()).To(ContainSubstring(cid))
session = podmanTest.Podman([]string{"volume", "rm", "-f", "myvol"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(0))
podmanTest.Cleanup()
@@ -73,51 +74,51 @@ var _ = Describe("Podman volume rm", func() {
It("podman volume remove bogus", func() {
session := podmanTest.Podman([]string{"volume", "rm", "bogus"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(1))
+ Expect(session).Should(Exit(1))
})
It("podman rm with --all flag", func() {
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "create"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "rm", "-a"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(0))
})
It("podman volume rm by partial name", func() {
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "rm", "myv"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(0))
})
It("podman volume rm by nonunique partial name", func() {
session := podmanTest.Podman([]string{"volume", "create", "myvol1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "create", "myvol2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "rm", "myv"})
session.WaitWithDefaultTimeout()
@@ -125,7 +126,7 @@ var _ = Describe("Podman volume rm", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray()) >= 2).To(BeTrue())
})
})
diff --git a/test/e2e/wait_test.go b/test/e2e/wait_test.go
index 71df28ca8..96bc8dbde 100644
--- a/test/e2e/wait_test.go
+++ b/test/e2e/wait_test.go
@@ -6,6 +6,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman wait", func() {
@@ -35,7 +36,7 @@ var _ = Describe("Podman wait", func() {
It("podman wait on bogus container", func() {
session := podmanTest.Podman([]string{"wait", "1234"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
@@ -43,91 +44,91 @@ var _ = Describe("Podman wait", func() {
session := podmanTest.Podman([]string{"run", "-d", ALPINE, "ls"})
session.Wait(10)
cid := session.OutputToString()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"wait", cid})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman wait on a sleeping container", func() {
session := podmanTest.Podman([]string{"run", "-d", ALPINE, "sleep", "1"})
session.Wait(20)
cid := session.OutputToString()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"wait", cid})
session.Wait(20)
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman wait on latest container", func() {
session := podmanTest.Podman([]string{"run", "-d", ALPINE, "sleep", "1"})
session.Wait(20)
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
if IsRemote() {
session = podmanTest.Podman([]string{"wait", session.OutputToString()})
} else {
session = podmanTest.Podman([]string{"wait", "-l"})
}
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman container wait on latest container", func() {
session := podmanTest.Podman([]string{"container", "run", "-d", ALPINE, "sleep", "1"})
session.Wait(20)
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
if IsRemote() {
session = podmanTest.Podman([]string{"container", "wait", session.OutputToString()})
} else {
session = podmanTest.Podman([]string{"container", "wait", "-l"})
}
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman container wait on latest container with --interval flag", func() {
session := podmanTest.Podman([]string{"container", "run", "-d", ALPINE, "sleep", "1"})
session.Wait(20)
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"container", "wait", "-i", "5000", session.OutputToString()})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman container wait on latest container with --interval flag", func() {
session := podmanTest.Podman([]string{"container", "run", "-d", ALPINE, "sleep", "1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"container", "wait", "--interval", "1s", session.OutputToString()})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
})
It("podman container wait on container with bogus --interval", func() {
session := podmanTest.Podman([]string{"container", "run", "-d", ALPINE, "sleep", "1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"container", "wait", "--interval", "100days", session.OutputToString()})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(125))
+ Expect(session).Should(Exit(125))
})
It("podman wait on three containers", func() {
session := podmanTest.Podman([]string{"run", "-d", ALPINE, "sleep", "1"})
session.Wait(20)
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid1 := session.OutputToString()
session = podmanTest.Podman([]string{"run", "-d", ALPINE, "sleep", "1"})
session.Wait(20)
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid2 := session.OutputToString()
session = podmanTest.Podman([]string{"run", "-d", ALPINE, "sleep", "1"})
session.Wait(20)
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid3 := session.OutputToString()
session = podmanTest.Podman([]string{"wait", cid1, cid2, cid3})
session.Wait(20)
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(session.OutputToStringArray()).To(Equal([]string{"0", "0", "0"}))
})
})
diff --git a/test/python/docker/compat/test_containers.py b/test/python/docker/compat/test_containers.py
index 511ab1451..38ac5b59f 100644
--- a/test/python/docker/compat/test_containers.py
+++ b/test/python/docker/compat/test_containers.py
@@ -7,6 +7,7 @@ from typing import IO, Optional
from docker import DockerClient, errors
from docker.models.containers import Container
+from docker.models.images import Image
from test.python.docker import Podman
from test.python.docker.compat import common, constant
@@ -237,3 +238,16 @@ class TestContainers(unittest.TestCase):
if ctr is not None:
ctr.stop()
ctr.remove()
+
+ def test_mount_preexisting_dir(self):
+ dockerfile = (B'FROM quay.io/libpod/alpine:latest\n'
+ B'USER root\n'
+ B'RUN mkdir -p /workspace\n'
+ B'RUN chown 1042:1043 /workspace')
+ img: Image
+ img, out = self.client.images.build(fileobj=io.BytesIO(dockerfile))
+ ctr: Container = self.client.containers.create(image=img.id, detach=True, command="top",
+ volumes=["test_mount_preexisting_dir_vol:/workspace"])
+ ctr.start()
+ ret, out = ctr.exec_run(["stat", "-c", "%u:%g", "/workspace"])
+ self.assertTrue(out.startswith(b'1042:1043'), "assert correct uid/gid")
diff --git a/test/system/070-build.bats b/test/system/070-build.bats
index c45a661fe..06ff0c9e2 100644
--- a/test/system/070-build.bats
+++ b/test/system/070-build.bats
@@ -509,6 +509,40 @@ EOF
done
}
+# Regression test for #9867
+# Make sure that if you exclude everything in context dir, that
+# the Containerfile/Dockerfile in the context dir are used
+@test "podman build with ignore '*'" {
+ local tmpdir=$PODMAN_TMPDIR/build-test-$(random_string 10)
+ mkdir -p $tmpdir
+
+ cat >$tmpdir/Containerfile <<EOF
+FROM scratch
+EOF
+
+cat >$tmpdir/.dockerignore <<EOF
+*
+EOF
+
+ run_podman build -t build_test $tmpdir
+
+ # Rename Containerfile to Dockerfile
+ mv $tmpdir/Containerfile $tmpdir/Dockerfile
+
+ run_podman build -t build_test $tmpdir
+
+ # Rename Dockerfile to foofile
+ mv $tmpdir/Dockerfile $tmpdir/foofile
+
+ run_podman 125 build -t build_test $tmpdir
+ is "$output" ".*Dockerfile: no such file or directory"
+
+ run_podman build -t build_test -f $tmpdir/foofile $tmpdir
+
+ # Clean up
+ run_podman rmi -f build_test
+}
+
@test "podman build - stdin test" {
# Random workdir, and random string to verify build output
workdir=/$(random_string 10)
@@ -817,7 +851,7 @@ EOF
run_podman rmi -f build_test
}
-@test "podman build -f test " {
+@test "podman build -f test" {
tmpdir=$PODMAN_TMPDIR/build-test
subdir=$tmpdir/subdir
mkdir -p $subdir
@@ -843,6 +877,44 @@ EOF
run_podman rmi -f build_test
}
+@test "podman build .dockerignore failure test" {
+ tmpdir=$PODMAN_TMPDIR/build-test
+ subdir=$tmpdir/subdir
+ mkdir -p $subdir
+
+ cat >$tmpdir/.dockerignore <<EOF
+*
+subdir
+!*/sub1*
+EOF
+ cat >$tmpdir/Containerfile <<EOF
+FROM $IMAGE
+COPY ./ ./
+COPY subdir ./
+EOF
+ run_podman 125 build -t build_test $tmpdir
+ is "$output" ".*Error: error building at STEP \"COPY subdir ./\"" ".dockerignore was ignored"
+}
+
+@test "podman build .containerignore and .dockerignore test" {
+ tmpdir=$PODMAN_TMPDIR/build-test
+ mkdir -p $tmpdir
+ touch $tmpdir/test1 $tmpdir/test2
+ cat >$tmpdir/.containerignore <<EOF
+test2*
+EOF
+ cat >$tmpdir/.dockerignore <<EOF
+test1*
+EOF
+ cat >$tmpdir/Containerfile <<EOF
+FROM $IMAGE
+COPY ./ /tmp/test/
+RUN ls /tmp/test/
+EOF
+ run_podman build -t build_test $tmpdir
+ is "$output" ".*test1" "test1 should exists in the final image"
+}
+
function teardown() {
# A timeout or other error in 'build' can leave behind stale images
# that podman can't even see and which will cascade into subsequent
diff --git a/test/system/075-exec.bats b/test/system/075-exec.bats
index badf44c49..3e8c3c1ea 100644
--- a/test/system/075-exec.bats
+++ b/test/system/075-exec.bats
@@ -59,8 +59,6 @@ load helpers
# Issue #4785 - piping to exec statement - fixed in #4818
# Issue #5046 - piping to exec truncates results (actually a conmon issue)
@test "podman exec - cat from stdin" {
- skip_if_remote "FIXME: pending #7360"
-
run_podman run -d $IMAGE sh -c 'while [ ! -e /stop ]; do sleep 0.1;done'
cid="$output"
diff --git a/test/system/250-systemd.bats b/test/system/250-systemd.bats
index 4ea192009..aafe385c8 100644
--- a/test/system/250-systemd.bats
+++ b/test/system/250-systemd.bats
@@ -119,7 +119,7 @@ function service_cleanup() {
# Run auto-update and check that it restarted the container
run_podman commit --change "CMD=/bin/bash" $cname $IMAGE
run_podman auto-update
- is $output $SERVICE_NAME "autoupdate local restarted container"
+ is "$output" ".*$SERVICE_NAME.*" "autoupdate local restarted container"
# All good. Stop service, clean up.
service_cleanup
diff --git a/test/system/255-auto-update.bats b/test/system/255-auto-update.bats
index 3713243d5..5e2d66af9 100644
--- a/test/system/255-auto-update.bats
+++ b/test/system/255-auto-update.bats
@@ -121,8 +121,13 @@ function _confirm_update() {
generate_service alpine image
_wait_service_ready container-$cname.service
- run_podman auto-update
+ run_podman auto-update --dry-run --format "{{.Unit}},{{.Image}},{{.Updated}},{{.Policy}}"
+ is "$output" ".*container-$cname.service,quay.io/libpod/alpine:latest,pending,registry.*" "Image update is pending."
+
+ run_podman auto-update --format "{{.Unit}},{{.Image}},{{.Updated}},{{.Policy}}"
is "$output" "Trying to pull.*" "Image is updated."
+ is "$output" ".*container-$cname.service,quay.io/libpod/alpine:latest,true,registry.*" "Image is updated."
+
_confirm_update $cname $ori_image
}
@@ -151,10 +156,18 @@ function _confirm_update() {
@test "podman auto-update - label io.containers.autoupdate=local" {
generate_service localtest local
- podman commit --change CMD=/bin/bash $cname quay.io/libpod/localtest:latest
+ image=quay.io/libpod/localtest:latest
+ podman commit --change CMD=/bin/bash $cname $image
+ podman image inspect --format "{{.ID}}" $image
+ imageID="$output"
_wait_service_ready container-$cname.service
- run_podman auto-update
+ run_podman auto-update --dry-run --format "{{.Unit}},{{.Image}},{{.Updated}},{{.Policy}}"
+ is "$output" ".*container-$cname.service,quay.io/libpod/localtest:latest,pending,local.*" "Image update is pending."
+
+ run_podman auto-update --format "{{.Unit}},{{.Image}},{{.Updated}},{{.Policy}}"
+ is "$output" ".*container-$cname.service,quay.io/libpod/localtest:latest,true,local.*" "Image is updated."
+
_confirm_update $cname $ori_image
}
diff --git a/test/system/500-networking.bats b/test/system/500-networking.bats
index d55a786f7..4feb57807 100644
--- a/test/system/500-networking.bats
+++ b/test/system/500-networking.bats
@@ -20,7 +20,6 @@ load helpers
# Copied from tsweeney's https://github.com/containers/podman/issues/4827
@test "podman networking: port on localhost" {
- skip_if_remote "FIXME: reevaluate this one after #7360 is fixed"
random_1=$(random_string 30)
random_2=$(random_string 30)
diff --git a/vendor/github.com/Microsoft/hcsshim/errors.go b/vendor/github.com/Microsoft/hcsshim/errors.go
index 794308673..f367022e7 100644
--- a/vendor/github.com/Microsoft/hcsshim/errors.go
+++ b/vendor/github.com/Microsoft/hcsshim/errors.go
@@ -59,7 +59,7 @@ var (
// ErrVmcomputeOperationInvalidState is an error encountered when the compute system is not in a valid state for the requested operation
ErrVmcomputeOperationInvalidState = hcs.ErrVmcomputeOperationInvalidState
- // ErrProcNotFound is an error encountered when the the process cannot be found
+ // ErrProcNotFound is an error encountered when a procedure look up fails.
ErrProcNotFound = hcs.ErrProcNotFound
// ErrVmcomputeOperationAccessIsDenied is an error which can be encountered when enumerating compute systems in RS1/RS2
@@ -159,7 +159,7 @@ func (e *ProcessError) Error() string {
// IsNotExist checks if an error is caused by the Container or Process not existing.
// Note: Currently, ErrElementNotFound can mean that a Process has either
// already exited, or does not exist. Both IsAlreadyStopped and IsNotExist
-// will currently return true when the error is ErrElementNotFound or ErrProcNotFound.
+// will currently return true when the error is ErrElementNotFound.
func IsNotExist(err error) bool {
if _, ok := err.(EndpointNotFoundError); ok {
return true
@@ -192,7 +192,7 @@ func IsTimeout(err error) bool {
// a Container or Process being already stopped.
// Note: Currently, ErrElementNotFound can mean that a Process has either
// already exited, or does not exist. Both IsAlreadyStopped and IsNotExist
-// will currently return true when the error is ErrElementNotFound or ErrProcNotFound.
+// will currently return true when the error is ErrElementNotFound.
func IsAlreadyStopped(err error) bool {
return hcs.IsAlreadyStopped(getInnerError(err))
}
diff --git a/vendor/github.com/Microsoft/hcsshim/internal/hcs/errors.go b/vendor/github.com/Microsoft/hcsshim/internal/hcs/errors.go
index 7696e4b48..644f0ab71 100644
--- a/vendor/github.com/Microsoft/hcsshim/internal/hcs/errors.go
+++ b/vendor/github.com/Microsoft/hcsshim/internal/hcs/errors.go
@@ -60,7 +60,7 @@ var (
// ErrVmcomputeOperationInvalidState is an error encountered when the compute system is not in a valid state for the requested operation
ErrVmcomputeOperationInvalidState = syscall.Errno(0xc0370105)
- // ErrProcNotFound is an error encountered when the the process cannot be found
+ // ErrProcNotFound is an error encountered when a procedure look up fails.
ErrProcNotFound = syscall.Errno(0x7f)
// ErrVmcomputeOperationAccessIsDenied is an error which can be encountered when enumerating compute systems in RS1/RS2
@@ -242,12 +242,11 @@ func makeProcessError(process *Process, op string, err error, events []ErrorEven
// IsNotExist checks if an error is caused by the Container or Process not existing.
// Note: Currently, ErrElementNotFound can mean that a Process has either
// already exited, or does not exist. Both IsAlreadyStopped and IsNotExist
-// will currently return true when the error is ErrElementNotFound or ErrProcNotFound.
+// will currently return true when the error is ErrElementNotFound.
func IsNotExist(err error) bool {
err = getInnerError(err)
return err == ErrComputeSystemDoesNotExist ||
- err == ErrElementNotFound ||
- err == ErrProcNotFound
+ err == ErrElementNotFound
}
// IsAlreadyClosed checks if an error is caused by the Container or Process having been
@@ -278,12 +277,11 @@ func IsTimeout(err error) bool {
// a Container or Process being already stopped.
// Note: Currently, ErrElementNotFound can mean that a Process has either
// already exited, or does not exist. Both IsAlreadyStopped and IsNotExist
-// will currently return true when the error is ErrElementNotFound or ErrProcNotFound.
+// will currently return true when the error is ErrElementNotFound.
func IsAlreadyStopped(err error) bool {
err = getInnerError(err)
return err == ErrVmcomputeAlreadyStopped ||
- err == ErrElementNotFound ||
- err == ErrProcNotFound
+ err == ErrElementNotFound
}
// IsNotSupported returns a boolean indicating whether the error is caused by
diff --git a/vendor/github.com/containers/storage/VERSION b/vendor/github.com/containers/storage/VERSION
index 949ff3202..5d245052c 100644
--- a/vendor/github.com/containers/storage/VERSION
+++ b/vendor/github.com/containers/storage/VERSION
@@ -1 +1 @@
-1.32.5
+1.32.6
diff --git a/vendor/github.com/containers/storage/go.mod b/vendor/github.com/containers/storage/go.mod
index 93b6b337c..d46000ace 100644
--- a/vendor/github.com/containers/storage/go.mod
+++ b/vendor/github.com/containers/storage/go.mod
@@ -5,7 +5,7 @@ module github.com/containers/storage
require (
github.com/BurntSushi/toml v0.3.1
github.com/Microsoft/go-winio v0.5.0
- github.com/Microsoft/hcsshim v0.8.17
+ github.com/Microsoft/hcsshim v0.8.20
github.com/docker/go-units v0.4.0
github.com/google/go-intervals v0.0.2
github.com/hashicorp/go-multierror v1.1.1
diff --git a/vendor/github.com/containers/storage/go.sum b/vendor/github.com/containers/storage/go.sum
index e826328ef..081da00e4 100644
--- a/vendor/github.com/containers/storage/go.sum
+++ b/vendor/github.com/containers/storage/go.sum
@@ -54,8 +54,8 @@ github.com/Microsoft/hcsshim v0.8.9/go.mod h1:5692vkUqntj1idxauYlpoINNKeqCiG6Sg3
github.com/Microsoft/hcsshim v0.8.14/go.mod h1:NtVKoYxQuTLx6gEq0L96c9Ju4JbRJ4nY2ow3VK6a9Lg=
github.com/Microsoft/hcsshim v0.8.15/go.mod h1:x38A4YbHbdxJtc0sF6oIz+RG0npwSCAvn69iY6URG00=
github.com/Microsoft/hcsshim v0.8.16/go.mod h1:o5/SZqmR7x9JNKsW3pu+nqHm0MF8vbA+VxGOoXdC600=
-github.com/Microsoft/hcsshim v0.8.17 h1:yFHH5bghP9ij5Y34PPaMOE8g//oXZ0uJQeMENVo2zcI=
-github.com/Microsoft/hcsshim v0.8.17/go.mod h1:+w2gRZ5ReXQhFOrvSQeNfhrYB/dg3oDwTOcER2fw4I4=
+github.com/Microsoft/hcsshim v0.8.20 h1:ZTwcx3NS8n07kPf/JZ1qwU6vnjhVPMUWlXBF8r9UxrE=
+github.com/Microsoft/hcsshim v0.8.20/go.mod h1:+w2gRZ5ReXQhFOrvSQeNfhrYB/dg3oDwTOcER2fw4I4=
github.com/Microsoft/hcsshim/test v0.0.0-20201218223536-d3e5debf77da/go.mod h1:5hlzMzRKMLyo42nCZ9oml8AdTlq/0cvIaBv6tK1RehU=
github.com/Microsoft/hcsshim/test v0.0.0-20210227013316-43a75bb4edd3/go.mod h1:mw7qgWloBUl75W/gVH3cQszUg1+gUITj7D6NY7ywVnY=
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
diff --git a/vendor/github.com/containers/storage/pkg/fileutils/fileutils.go b/vendor/github.com/containers/storage/pkg/fileutils/fileutils.go
index b3998fb35..5be98165e 100644
--- a/vendor/github.com/containers/storage/pkg/fileutils/fileutils.go
+++ b/vendor/github.com/containers/storage/pkg/fileutils/fileutils.go
@@ -38,7 +38,7 @@ func NewPatternMatcher(patterns []string) (*PatternMatcher, error) {
return nil, errors.New("illegal exclusion pattern: \"!\"")
}
newp.exclusion = true
- p = p[1:]
+ p = strings.TrimPrefix(filepath.Clean(p[1:]), "/")
pm.exclusions = true
}
// Do some syntax checking on the pattern.
diff --git a/vendor/github.com/containers/storage/pkg/lockfile/lockfile_unix.go b/vendor/github.com/containers/storage/pkg/lockfile/lockfile_unix.go
index f0e46b6b6..b224e7b5c 100644
--- a/vendor/github.com/containers/storage/pkg/lockfile/lockfile_unix.go
+++ b/vendor/github.com/containers/storage/pkg/lockfile/lockfile_unix.go
@@ -5,6 +5,7 @@ package lockfile
import (
"fmt"
"os"
+ "path/filepath"
"sync"
"time"
@@ -33,11 +34,30 @@ type lockfile struct {
// descriptor. Note that the path is opened read-only when ro is set. If ro
// is unset, openLock will open the path read-write and create the file if
// necessary.
-func openLock(path string, ro bool) (int, error) {
+func openLock(path string, ro bool) (fd int, err error) {
if ro {
- return unix.Open(path, os.O_RDONLY|unix.O_CLOEXEC, 0)
+ fd, err = unix.Open(path, os.O_RDONLY|unix.O_CLOEXEC, 0)
+ } else {
+ fd, err = unix.Open(path,
+ os.O_RDWR|unix.O_CLOEXEC|os.O_CREATE,
+ unix.S_IRUSR|unix.S_IWUSR|unix.S_IRGRP|unix.S_IROTH,
+ )
+ }
+
+ if err == nil {
+ return
+ }
+
+ // the directory of the lockfile seems to be removed, try to create it
+ if os.IsNotExist(err) {
+ if err := os.MkdirAll(filepath.Dir(path), 0700); err != nil {
+ return fd, errors.Wrap(err, "creating locker directory")
+ }
+
+ return openLock(path, ro)
}
- return unix.Open(path, os.O_RDWR|unix.O_CLOEXEC|os.O_CREATE, unix.S_IRUSR|unix.S_IWUSR|unix.S_IRGRP|unix.S_IROTH)
+
+ return
}
// createLockerForPath returns a Locker object, possibly (depending on the platform)
diff --git a/vendor/github.com/containers/storage/types/options.go b/vendor/github.com/containers/storage/types/options.go
index c0e3ea637..f9bf7e6b6 100644
--- a/vendor/github.com/containers/storage/types/options.go
+++ b/vendor/github.com/containers/storage/types/options.go
@@ -2,7 +2,6 @@ package types
import (
"fmt"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -272,21 +271,21 @@ func ReloadConfigurationFileIfNeeded(configFile string, storeOptions *StoreOptio
// ReloadConfigurationFile parses the specified configuration file and overrides
// the configuration in storeOptions.
func ReloadConfigurationFile(configFile string, storeOptions *StoreOptions) {
- data, err := ioutil.ReadFile(configFile)
- if err != nil {
+ config := new(tomlConfig)
+
+ meta, err := toml.DecodeFile(configFile, &config)
+ if err == nil {
+ keys := meta.Undecoded()
+ if len(keys) > 0 {
+ logrus.Warningf("Failed to decode the keys %q from %q.", keys, configFile)
+ }
+ } else {
if !os.IsNotExist(err) {
fmt.Printf("Failed to read %s %v\n", configFile, err.Error())
return
}
}
- config := new(tomlConfig)
-
- if _, err := toml.Decode(string(data), config); err != nil {
- fmt.Printf("Failed to parse %s %v\n", configFile, err.Error())
- return
- }
-
// Clear storeOptions of previos settings
*storeOptions = StoreOptions{}
if config.Storage.Driver != "" {
diff --git a/vendor/github.com/containers/storage/types/storage_broken.conf b/vendor/github.com/containers/storage/types/storage_broken.conf
new file mode 100644
index 000000000..3bca1d978
--- /dev/null
+++ b/vendor/github.com/containers/storage/types/storage_broken.conf
@@ -0,0 +1,18 @@
+# This file is is a TEST configuration file for all tools
+# that use the containers/storage library.
+# See man 5 containers-storage.conf for more information
+# The "container storage" table contains all of the server options.
+foo = "bar"
+
+[storage]
+
+# Default Storage Driver
+driver = ""
+
+# Temporary storage location
+runroot = "/run/containers/test"
+
+[storage.options]
+# Primary Read/Write location of container storage
+graphroot = "/var/lib/containers/storage"
+
diff --git a/vendor/github.com/containers/storage/types/utils.go b/vendor/github.com/containers/storage/types/utils.go
index 4d62b151a..03ddd5ad9 100644
--- a/vendor/github.com/containers/storage/types/utils.go
+++ b/vendor/github.com/containers/storage/types/utils.go
@@ -2,7 +2,6 @@ package types
import (
"fmt"
- "io/ioutil"
"os"
"path/filepath"
"strconv"
@@ -75,12 +74,9 @@ func getRootlessRuntimeDirIsolated(env rootlessRuntimeDirEnvironment) (string, e
return runtimeDir, nil
}
- initCommand, err := ioutil.ReadFile(env.getProcCommandFile())
- if err != nil || string(initCommand) == "systemd" {
- runUserDir := env.getRunUserDir()
- if isRootlessRuntimeDirOwner(runUserDir, env) {
- return runUserDir, nil
- }
+ runUserDir := env.getRunUserDir()
+ if isRootlessRuntimeDirOwner(runUserDir, env) {
+ return runUserDir, nil
}
tmpPerUserDir := env.getTmpPerUserDir()
diff --git a/vendor/github.com/google/uuid/null.go b/vendor/github.com/google/uuid/null.go
new file mode 100644
index 000000000..d7fcbf286
--- /dev/null
+++ b/vendor/github.com/google/uuid/null.go
@@ -0,0 +1,118 @@
+// Copyright 2021 Google Inc. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package uuid
+
+import (
+ "bytes"
+ "database/sql/driver"
+ "encoding/json"
+ "fmt"
+)
+
+var jsonNull = []byte("null")
+
+// NullUUID represents a UUID that may be null.
+// NullUUID implements the SQL driver.Scanner interface so
+// it can be used as a scan destination:
+//
+// var u uuid.NullUUID
+// err := db.QueryRow("SELECT name FROM foo WHERE id=?", id).Scan(&u)
+// ...
+// if u.Valid {
+// // use u.UUID
+// } else {
+// // NULL value
+// }
+//
+type NullUUID struct {
+ UUID UUID
+ Valid bool // Valid is true if UUID is not NULL
+}
+
+// Scan implements the SQL driver.Scanner interface.
+func (nu *NullUUID) Scan(value interface{}) error {
+ if value == nil {
+ nu.UUID, nu.Valid = Nil, false
+ return nil
+ }
+
+ err := nu.UUID.Scan(value)
+ if err != nil {
+ nu.Valid = false
+ return err
+ }
+
+ nu.Valid = true
+ return nil
+}
+
+// Value implements the driver Valuer interface.
+func (nu NullUUID) Value() (driver.Value, error) {
+ if !nu.Valid {
+ return nil, nil
+ }
+ // Delegate to UUID Value function
+ return nu.UUID.Value()
+}
+
+// MarshalBinary implements encoding.BinaryMarshaler.
+func (nu NullUUID) MarshalBinary() ([]byte, error) {
+ if nu.Valid {
+ return nu.UUID[:], nil
+ }
+
+ return []byte(nil), nil
+}
+
+// UnmarshalBinary implements encoding.BinaryUnmarshaler.
+func (nu *NullUUID) UnmarshalBinary(data []byte) error {
+ if len(data) != 16 {
+ return fmt.Errorf("invalid UUID (got %d bytes)", len(data))
+ }
+ copy(nu.UUID[:], data)
+ nu.Valid = true
+ return nil
+}
+
+// MarshalText implements encoding.TextMarshaler.
+func (nu NullUUID) MarshalText() ([]byte, error) {
+ if nu.Valid {
+ return nu.UUID.MarshalText()
+ }
+
+ return jsonNull, nil
+}
+
+// UnmarshalText implements encoding.TextUnmarshaler.
+func (nu *NullUUID) UnmarshalText(data []byte) error {
+ id, err := ParseBytes(data)
+ if err != nil {
+ nu.Valid = false
+ return err
+ }
+ nu.UUID = id
+ nu.Valid = true
+ return nil
+}
+
+// MarshalJSON implements json.Marshaler.
+func (nu NullUUID) MarshalJSON() ([]byte, error) {
+ if nu.Valid {
+ return json.Marshal(nu.UUID)
+ }
+
+ return jsonNull, nil
+}
+
+// UnmarshalJSON implements json.Unmarshaler.
+func (nu *NullUUID) UnmarshalJSON(data []byte) error {
+ if bytes.Equal(data, jsonNull) {
+ *nu = NullUUID{}
+ return nil // valid null UUID
+ }
+ err := json.Unmarshal(data, &nu.UUID)
+ nu.Valid = err == nil
+ return err
+}
diff --git a/vendor/github.com/google/uuid/uuid.go b/vendor/github.com/google/uuid/uuid.go
index 60d26bb50..a57207aeb 100644
--- a/vendor/github.com/google/uuid/uuid.go
+++ b/vendor/github.com/google/uuid/uuid.go
@@ -12,6 +12,7 @@ import (
"fmt"
"io"
"strings"
+ "sync"
)
// A UUID is a 128 bit (16 byte) Universal Unique IDentifier as defined in RFC
@@ -33,7 +34,15 @@ const (
Future // Reserved for future definition.
)
-var rander = rand.Reader // random function
+const randPoolSize = 16 * 16
+
+var (
+ rander = rand.Reader // random function
+ poolEnabled = false
+ poolMu sync.Mutex
+ poolPos = randPoolSize // protected with poolMu
+ pool [randPoolSize]byte // protected with poolMu
+)
type invalidLengthError struct{ len int }
@@ -41,6 +50,12 @@ func (err invalidLengthError) Error() string {
return fmt.Sprintf("invalid UUID length: %d", err.len)
}
+// IsInvalidLengthError is matcher function for custom error invalidLengthError
+func IsInvalidLengthError(err error) bool {
+ _, ok := err.(invalidLengthError)
+ return ok
+}
+
// Parse decodes s into a UUID or returns an error. Both the standard UUID
// forms of xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and
// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx are decoded as well as the
@@ -249,3 +264,31 @@ func SetRand(r io.Reader) {
}
rander = r
}
+
+// EnableRandPool enables internal randomness pool used for Random
+// (Version 4) UUID generation. The pool contains random bytes read from
+// the random number generator on demand in batches. Enabling the pool
+// may improve the UUID generation throughput significantly.
+//
+// Since the pool is stored on the Go heap, this feature may be a bad fit
+// for security sensitive applications.
+//
+// Both EnableRandPool and DisableRandPool are not thread-safe and should
+// only be called when there is no possibility that New or any other
+// UUID Version 4 generation function will be called concurrently.
+func EnableRandPool() {
+ poolEnabled = true
+}
+
+// DisableRandPool disables the randomness pool if it was previously
+// enabled with EnableRandPool.
+//
+// Both EnableRandPool and DisableRandPool are not thread-safe and should
+// only be called when there is no possibility that New or any other
+// UUID Version 4 generation function will be called concurrently.
+func DisableRandPool() {
+ poolEnabled = false
+ defer poolMu.Unlock()
+ poolMu.Lock()
+ poolPos = randPoolSize
+}
diff --git a/vendor/github.com/google/uuid/version4.go b/vendor/github.com/google/uuid/version4.go
index 86160fbd0..7697802e4 100644
--- a/vendor/github.com/google/uuid/version4.go
+++ b/vendor/github.com/google/uuid/version4.go
@@ -27,6 +27,8 @@ func NewString() string {
// The strength of the UUIDs is based on the strength of the crypto/rand
// package.
//
+// Uses the randomness pool if it was enabled with EnableRandPool.
+//
// A note about uniqueness derived from the UUID Wikipedia entry:
//
// Randomly generated UUIDs have 122 random bits. One's annual risk of being
@@ -35,7 +37,10 @@ func NewString() string {
// equivalent to the odds of creating a few tens of trillions of UUIDs in a
// year and having one duplicate.
func NewRandom() (UUID, error) {
- return NewRandomFromReader(rander)
+ if !poolEnabled {
+ return NewRandomFromReader(rander)
+ }
+ return newRandomFromPool()
}
// NewRandomFromReader returns a UUID based on bytes read from a given io.Reader.
@@ -49,3 +54,23 @@ func NewRandomFromReader(r io.Reader) (UUID, error) {
uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10
return uuid, nil
}
+
+func newRandomFromPool() (UUID, error) {
+ var uuid UUID
+ poolMu.Lock()
+ if poolPos == randPoolSize {
+ _, err := io.ReadFull(rander, pool[:])
+ if err != nil {
+ poolMu.Unlock()
+ return Nil, err
+ }
+ poolPos = 0
+ }
+ copy(uuid[:], pool[poolPos:(poolPos+16)])
+ poolPos += 16
+ poolMu.Unlock()
+
+ uuid[6] = (uuid[6] & 0x0f) | 0x40 // Version 4
+ uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10
+ return uuid, nil
+}
diff --git a/vendor/github.com/onsi/gomega/CHANGELOG.md b/vendor/github.com/onsi/gomega/CHANGELOG.md
index 4783c0d43..f2181a8cc 100644
--- a/vendor/github.com/onsi/gomega/CHANGELOG.md
+++ b/vendor/github.com/onsi/gomega/CHANGELOG.md
@@ -1,3 +1,20 @@
+## 1.14.0
+
+### Features
+- gmeasure.SamplingConfig now suppers a MinSamplingInterval [e94dbca]
+- Eventually and Consistently support functions that make assertions [2f04e6e]
+ - Eventually and Consistently now allow their passed-in functions to make assertions.
+ These assertions must pass or the function is considered to have failed and is retried.
+ - Eventually and Consistently can now take functions with no return values. These implicitly return nil
+ if they contain no failed assertion. Otherwise they return an error wrapping the first assertion failure. This allows
+ these functions to be used with the Succeed() matcher.
+ - Introduce InterceptGomegaFailure - an analogue to InterceptGomegaFailures - that captures the first assertion failure
+ and halts execution in its passed-in callback.
+
+### Fixes
+- Call Verify GHTTPWithGomega receiver funcs (#454) [496e6fd]
+- Build a binary with an expected name (#446) [7356360]
+
## 1.13.0
### Features
diff --git a/vendor/github.com/onsi/gomega/README.md b/vendor/github.com/onsi/gomega/README.md
index 76aa6b558..d45a8c4e5 100644
--- a/vendor/github.com/onsi/gomega/README.md
+++ b/vendor/github.com/onsi/gomega/README.md
@@ -1,6 +1,6 @@
![Gomega: Ginkgo's Preferred Matcher Library](http://onsi.github.io/gomega/images/gomega.png)
-[![Build Status](https://travis-ci.org/onsi/gomega.svg?branch=master)](https://travis-ci.org/onsi/gomega)
+[![test](https://github.com/onsi/gomega/actions/workflows/test.yml/badge.svg)](https://github.com/onsi/gomega/actions/workflows/test.yml)
Jump straight to the [docs](http://onsi.github.io/gomega/) to learn about Gomega, including a list of [all available matchers](http://onsi.github.io/gomega/#provided-matchers).
diff --git a/vendor/github.com/onsi/gomega/gexec/build.go b/vendor/github.com/onsi/gomega/gexec/build.go
index c7aba62b7..576fc8ee4 100644
--- a/vendor/github.com/onsi/gomega/gexec/build.go
+++ b/vendor/github.com/onsi/gomega/gexec/build.go
@@ -3,8 +3,6 @@
package gexec
import (
- "crypto/md5"
- "encoding/hex"
"errors"
"fmt"
"go/build"
@@ -197,9 +195,7 @@ func newExecutablePath(gopath, packagePath string, suffixes ...string) (string,
return "", errors.New("$GOPATH not provided when building " + packagePath)
}
- hash := md5.Sum([]byte(packagePath))
- filename := fmt.Sprintf("%s-%x%s", path.Base(packagePath), hex.EncodeToString(hash[:]), strings.Join(suffixes, ""))
- executable := filepath.Join(tmpDir, filename)
+ executable := filepath.Join(tmpDir, path.Base(packagePath))
if runtime.GOOS == "windows" {
executable += ".exe"
diff --git a/vendor/github.com/onsi/gomega/go.mod b/vendor/github.com/onsi/gomega/go.mod
index f74d9ea10..62b8f396c 100644
--- a/vendor/github.com/onsi/gomega/go.mod
+++ b/vendor/github.com/onsi/gomega/go.mod
@@ -4,7 +4,7 @@ go 1.14
require (
github.com/golang/protobuf v1.5.2
- github.com/onsi/ginkgo v1.16.2
+ github.com/onsi/ginkgo v1.16.4
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781
gopkg.in/yaml.v2 v2.4.0
)
diff --git a/vendor/github.com/onsi/gomega/go.sum b/vendor/github.com/onsi/gomega/go.sum
index 1ae731a5c..177d5e876 100644
--- a/vendor/github.com/onsi/gomega/go.sum
+++ b/vendor/github.com/onsi/gomega/go.sum
@@ -3,6 +3,7 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
+github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I=
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
@@ -25,8 +26,8 @@ github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
-github.com/onsi/ginkgo v1.16.2 h1:HFB2fbVIlhIfCfOW81bZFbiC/RvnpXSdhbF2/DJr134=
-github.com/onsi/ginkgo v1.16.2/go.mod h1:CObGmKUOKaSC0RjmoAK7tKyn4Azo5P2IWuoMnvwxz1E=
+github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc=
+github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
@@ -66,6 +67,7 @@ golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e h1:4nW4NLDYnU28ojHaHO8OVxFHk/aQ33U01a9cjED+pzE=
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
diff --git a/vendor/github.com/onsi/gomega/gomega_dsl.go b/vendor/github.com/onsi/gomega/gomega_dsl.go
index a05b34b27..67f6e45c1 100644
--- a/vendor/github.com/onsi/gomega/gomega_dsl.go
+++ b/vendor/github.com/onsi/gomega/gomega_dsl.go
@@ -14,6 +14,7 @@ Gomega is MIT-Licensed
package gomega
import (
+ "errors"
"fmt"
"reflect"
"time"
@@ -24,7 +25,7 @@ import (
"github.com/onsi/gomega/types"
)
-const GOMEGA_VERSION = "1.13.0"
+const GOMEGA_VERSION = "1.14.0"
const nilFailHandlerPanic = `You are trying to make an assertion, but Gomega's fail handler is nil.
If you're using Ginkgo then you probably forgot to put your assertion in an It().
@@ -91,10 +92,8 @@ func RegisterTestingT(t types.GomegaTestingT) {
// InterceptGomegaFailures runs a given callback and returns an array of
// failure messages generated by any Gomega assertions within the callback.
-//
-// This is accomplished by temporarily replacing the *global* fail handler
-// with a fail handler that simply annotates failures. The original fail handler
-// is reset when InterceptGomegaFailures returns.
+// Exeuction continues after the first failure allowing users to collect all failures
+// in the callback.
//
// This is most useful when testing custom matchers, but can also be used to check
// on a value using a Gomega assertion without causing a test failure.
@@ -104,11 +103,39 @@ func InterceptGomegaFailures(f func()) []string {
RegisterFailHandler(func(message string, callerSkip ...int) {
failures = append(failures, message)
})
+ defer func() {
+ RegisterFailHandler(originalHandler)
+ }()
f()
- RegisterFailHandler(originalHandler)
return failures
}
+// InterceptGomegaFailure runs a given callback and returns the first
+// failure message generated by any Gomega assertions within the callback, wrapped in an error.
+//
+// The callback ceases execution as soon as the first failed assertion occurs, however Gomega
+// does not register a failure with the FailHandler registered via RegisterFailHandler - it is up
+// to the user to decide what to do with the returned error
+func InterceptGomegaFailure(f func()) (err error) {
+ originalHandler := globalFailWrapper.Fail
+ RegisterFailHandler(func(message string, callerSkip ...int) {
+ err = errors.New(message)
+ panic("stop execution")
+ })
+
+ defer func() {
+ RegisterFailHandler(originalHandler)
+ if e := recover(); e != nil {
+ if err == nil {
+ panic(e)
+ }
+ }
+ }()
+
+ f()
+ return err
+}
+
// Ω wraps an actual value allowing assertions to be made on it:
// Ω("foo").Should(Equal("foo"))
//
@@ -177,7 +204,7 @@ func ExpectWithOffset(offset int, actual interface{}, extra ...interface{}) Asse
// Both intervals can either be specified as time.Duration, parsable duration strings or as floats/integers. In the
// last case they are interpreted as seconds.
//
-// If Eventually is passed an actual that is a function taking no arguments and returning at least one value,
+// If Eventually is passed an actual that is a function taking no arguments,
// then Eventually will call the function periodically and try the matcher against the function's first return value.
//
// Example:
@@ -202,6 +229,34 @@ func ExpectWithOffset(offset int, actual interface{}, extra ...interface{}) Asse
//
// Will pass only if the the returned error is nil and the returned string passes the matcher.
//
+// Eventually allows you to make assertions in the pased-in function. The function is assumed to have failed and will be retried if any assertion in the function fails.
+// For example:
+//
+// Eventually(func() Widget {
+// resp, err := http.Get(url)
+// Expect(err).NotTo(HaveOccurred())
+// defer resp.Body.Close()
+// Expect(resp.SatusCode).To(Equal(http.StatusOK))
+// var widget Widget
+// Expect(json.NewDecoder(resp.Body).Decode(&widget)).To(Succeed())
+// return widget
+// }).Should(Equal(expectedWidget))
+//
+// will keep trying the passed-in function until all its assertsions pass (i.e. the http request succeeds) _and_ the returned object satisfies the passed-in matcher.
+//
+// Functions passed to Eventually typically have a return value. However you are allowed to pass in a function with no return value. Eventually assumes such a function
+// is making assertions and will turn it into a function that returns an error if any assertion fails, or nil if no assertion fails. This allows you to use the Succeed() matcher
+// to express that a complex operation should eventually succeed. For example:
+//
+// Eventually(func() {
+// model, err := db.Find("foo")
+// Expect(err).NotTo(HaveOccurred())
+// Expect(model.Reticulated()).To(BeTrue())
+// Expect(model.Save()).To(Succeed())
+// }).Should(Succeed())
+//
+// will rerun the function until all its assertions pass.
+//
// Eventually's default timeout is 1 second, and its default polling interval is 10ms
func Eventually(actual interface{}, intervals ...interface{}) AsyncAssertion {
return EventuallyWithOffset(0, actual, intervals...)
@@ -235,13 +290,18 @@ func EventuallyWithOffset(offset int, actual interface{}, intervals ...interface
// Both intervals can either be specified as time.Duration, parsable duration strings or as floats/integers. In the
// last case they are interpreted as seconds.
//
-// If Consistently is passed an actual that is a function taking no arguments and returning at least one value,
-// then Consistently will call the function periodically and try the matcher against the function's first return value.
+// If Consistently is passed an actual that is a function taking no arguments.
+//
+// If the function returns one value, then Consistently will call the function periodically and try the matcher against the function's first return value.
//
// If the function returns more than one value, then Consistently will pass the first value to the matcher and
// assert that all other values are nil/zero.
// This allows you to pass Consistently a function that returns a value and an error - a common pattern in Go.
//
+// Like Eventually, Consistently allows you to make assertions in the function. If any assertion fails Consistently will fail. In addition,
+// Consistently also allows you to pass in a function with no return value. In this case Consistently can be paired with the Succeed() matcher to assert
+// that no assertions in the function fail.
+//
// Consistently is useful in cases where you want to assert that something *does not happen* over a period of time.
// For example, you want to assert that a goroutine does *not* send data down a channel. In this case, you could:
//
@@ -350,7 +410,7 @@ type OmegaMatcher types.GomegaMatcher
//
// Use `NewWithT` to instantiate a `WithT`
type WithT struct {
- t types.GomegaTestingT
+ failWrapper *types.GomegaFailWrapper
}
// GomegaWithT is deprecated in favor of gomega.WithT, which does not stutter.
@@ -367,7 +427,7 @@ type GomegaWithT = WithT
// }
func NewWithT(t types.GomegaTestingT) *WithT {
return &WithT{
- t: t,
+ failWrapper: testingtsupport.BuildTestingTGomegaFailWrapper(t),
}
}
@@ -378,7 +438,7 @@ func NewGomegaWithT(t types.GomegaTestingT) *GomegaWithT {
// ExpectWithOffset is used to make assertions. See documentation for ExpectWithOffset.
func (g *WithT) ExpectWithOffset(offset int, actual interface{}, extra ...interface{}) Assertion {
- return assertion.New(actual, testingtsupport.BuildTestingTGomegaFailWrapper(g.t), offset, extra...)
+ return assertion.New(actual, g.failWrapper, offset, extra...)
}
// EventuallyWithOffset is used to make asynchronous assertions. See documentation for EventuallyWithOffset.
@@ -391,7 +451,7 @@ func (g *WithT) EventuallyWithOffset(offset int, actual interface{}, intervals .
if len(intervals) > 1 {
pollingInterval = toDuration(intervals[1])
}
- return asyncassertion.New(asyncassertion.AsyncAssertionTypeEventually, actual, testingtsupport.BuildTestingTGomegaFailWrapper(g.t), timeoutInterval, pollingInterval, offset)
+ return asyncassertion.New(asyncassertion.AsyncAssertionTypeEventually, actual, g.failWrapper, timeoutInterval, pollingInterval, offset)
}
// ConsistentlyWithOffset is used to make asynchronous assertions. See documentation for ConsistentlyWithOffset.
@@ -404,7 +464,7 @@ func (g *WithT) ConsistentlyWithOffset(offset int, actual interface{}, intervals
if len(intervals) > 1 {
pollingInterval = toDuration(intervals[1])
}
- return asyncassertion.New(asyncassertion.AsyncAssertionTypeConsistently, actual, testingtsupport.BuildTestingTGomegaFailWrapper(g.t), timeoutInterval, pollingInterval, offset)
+ return asyncassertion.New(asyncassertion.AsyncAssertionTypeConsistently, actual, g.failWrapper, timeoutInterval, pollingInterval, offset)
}
// Expect is used to make assertions. See documentation for Expect.
diff --git a/vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion.go b/vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion.go
index 5204836bf..6aa02bc5d 100644
--- a/vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion.go
+++ b/vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion.go
@@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"reflect"
+ "runtime"
"time"
"github.com/onsi/gomega/internal/oraclematcher"
@@ -31,8 +32,8 @@ type AsyncAssertion struct {
func New(asyncType AsyncAssertionType, actualInput interface{}, failWrapper *types.GomegaFailWrapper, timeoutInterval time.Duration, pollingInterval time.Duration, offset int) *AsyncAssertion {
actualType := reflect.TypeOf(actualInput)
if actualType.Kind() == reflect.Func {
- if actualType.NumIn() != 0 || actualType.NumOut() == 0 {
- panic("Expected a function with no arguments and one or more return values.")
+ if actualType.NumIn() != 0 {
+ panic("Expected a function with no arguments and zero or more return values.")
}
}
@@ -70,13 +71,49 @@ func (assertion *AsyncAssertion) buildDescription(optionalDescription ...interfa
func (assertion *AsyncAssertion) actualInputIsAFunction() bool {
actualType := reflect.TypeOf(assertion.actualInput)
- return actualType.Kind() == reflect.Func && actualType.NumIn() == 0 && actualType.NumOut() > 0
+ return actualType.Kind() == reflect.Func && actualType.NumIn() == 0
}
func (assertion *AsyncAssertion) pollActual() (interface{}, error) {
- if assertion.actualInputIsAFunction() {
- values := reflect.ValueOf(assertion.actualInput).Call([]reflect.Value{})
+ if !assertion.actualInputIsAFunction() {
+ return assertion.actualInput, nil
+ }
+ var capturedAssertionFailure string
+ var values []reflect.Value
+
+ numOut := reflect.TypeOf(assertion.actualInput).NumOut()
+
+ func() {
+ originalHandler := assertion.failWrapper.Fail
+ assertion.failWrapper.Fail = func(message string, callerSkip ...int) {
+ skip := 0
+ if len(callerSkip) > 0 {
+ skip = callerSkip[0]
+ }
+ _, file, line, _ := runtime.Caller(skip + 1)
+ capturedAssertionFailure = fmt.Sprintf("Assertion in callback at %s:%d failed:\n%s", file, line, message)
+ panic("stop execution")
+ }
+
+ defer func() {
+ assertion.failWrapper.Fail = originalHandler
+ if e := recover(); e != nil && capturedAssertionFailure == "" {
+ panic(e)
+ }
+ }()
+
+ values = reflect.ValueOf(assertion.actualInput).Call([]reflect.Value{})
+ }()
+
+ if capturedAssertionFailure != "" {
+ if numOut == 0 {
+ return errors.New(capturedAssertionFailure), nil
+ } else {
+ return nil, errors.New(capturedAssertionFailure)
+ }
+ }
+ if numOut > 0 {
extras := []interface{}{}
for _, value := range values[1:] {
extras = append(extras, value.Interface())
@@ -91,7 +128,7 @@ func (assertion *AsyncAssertion) pollActual() (interface{}, error) {
return values[0].Interface(), nil
}
- return assertion.actualInput, nil
+ return nil, nil
}
func (assertion *AsyncAssertion) matcherMayChange(matcher types.GomegaMatcher, value interface{}) bool {
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 6c0f001a9..c29cfe8cc 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -9,7 +9,7 @@ github.com/Microsoft/go-winio/backuptar
github.com/Microsoft/go-winio/pkg/guid
github.com/Microsoft/go-winio/pkg/security
github.com/Microsoft/go-winio/vhd
-# github.com/Microsoft/hcsshim v0.8.17
+# github.com/Microsoft/hcsshim v0.8.20
github.com/Microsoft/hcsshim
github.com/Microsoft/hcsshim/computestorage
github.com/Microsoft/hcsshim/internal/cow
@@ -197,7 +197,7 @@ github.com/containers/psgo/internal/dev
github.com/containers/psgo/internal/host
github.com/containers/psgo/internal/proc
github.com/containers/psgo/internal/process
-# github.com/containers/storage v1.32.5
+# github.com/containers/storage v1.32.6
github.com/containers/storage
github.com/containers/storage/drivers
github.com/containers/storage/drivers/aufs
@@ -370,7 +370,7 @@ github.com/google/go-intervals/intervalset
github.com/google/gofuzz
# github.com/google/shlex v0.0.0-20181106134648-c34317bd91bf
github.com/google/shlex
-# github.com/google/uuid v1.2.0
+# github.com/google/uuid v1.3.0
github.com/google/uuid
# github.com/gorilla/mux v1.8.0
github.com/gorilla/mux
@@ -482,7 +482,7 @@ github.com/onsi/ginkgo/reporters/stenographer
github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable
github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty
github.com/onsi/ginkgo/types
-# github.com/onsi/gomega v1.13.0
+# github.com/onsi/gomega v1.14.0
github.com/onsi/gomega
github.com/onsi/gomega/format
github.com/onsi/gomega/gbytes