summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/images/history.go36
-rw-r--r--cmd/podman/images/list.go33
-rw-r--r--cmd/podman/images/mount.go15
-rw-r--r--cmd/podman/images/search.go35
-rw-r--r--cmd/podman/images/trust_show.go27
-rw-r--r--cmd/podman/inspect/inspect.go4
-rw-r--r--cmd/podman/machine/list.go14
-rw-r--r--cmd/podman/networks/list.go16
-rw-r--r--cmd/podman/pods/inspect.go2
-rw-r--r--cmd/podman/pods/ps.go3
-rw-r--r--cmd/podman/pods/stats.go8
-rw-r--r--cmd/podman/secrets/list.go5
-rw-r--r--cmd/podman/system/connection/list.go9
-rw-r--r--cmd/podman/system/version.go2
-rw-r--r--cmd/podman/volumes/list.go9
-rwxr-xr-xcontrib/cirrus/logformatter34
-rwxr-xr-xcontrib/cirrus/logformatter.t72
-rw-r--r--docs/source/markdown/podman-unshare.1.md5
-rw-r--r--docs/tutorials/remote_client.md10
-rw-r--r--libpod/kube.go65
-rw-r--r--libpod/networking_linux.go26
-rw-r--r--pkg/api/handlers/compat/images.go12
-rw-r--r--pkg/api/handlers/compat/images_push.go10
-rw-r--r--pkg/bindings/images/build.go5
-rw-r--r--pkg/domain/infra/abi/generate.go12
-rw-r--r--pkg/domain/infra/abi/system.go7
-rw-r--r--test/apiv2/10-images.at7
-rw-r--r--test/e2e/build_test.go8
-rw-r--r--test/e2e/checkpoint_test.go8
-rw-r--r--test/e2e/commit_test.go4
-rw-r--r--test/e2e/common_test.go61
-rw-r--r--test/e2e/container_create_volume_test.go10
-rw-r--r--test/e2e/create_test.go36
-rw-r--r--test/e2e/diff_test.go12
-rw-r--r--test/e2e/events_test.go4
-rw-r--r--test/e2e/exec_test.go4
-rw-r--r--test/e2e/generate_kube_test.go30
-rw-r--r--test/e2e/healthcheck_run_test.go2
-rw-r--r--test/e2e/history_test.go2
-rw-r--r--test/e2e/image_scp_test.go2
-rw-r--r--test/e2e/images_test.go35
-rw-r--r--test/e2e/inspect_test.go36
-rw-r--r--test/e2e/libpod_suite_remote_test.go21
-rw-r--r--test/e2e/libpod_suite_test.go12
-rw-r--r--test/e2e/logs_test.go24
-rw-r--r--test/e2e/mount_test.go2
-rw-r--r--test/e2e/network_test.go12
-rw-r--r--test/e2e/pause_test.go6
-rw-r--r--test/e2e/play_build_test.go12
-rw-r--r--test/e2e/play_kube_test.go14
-rw-r--r--test/e2e/pod_create_test.go10
-rw-r--r--test/e2e/pod_infra_container_test.go20
-rw-r--r--test/e2e/pod_inspect_test.go2
-rw-r--r--test/e2e/pod_pod_namespaces_test.go4
-rw-r--r--test/e2e/pod_prune_test.go4
-rw-r--r--test/e2e/pod_ps_test.go6
-rw-r--r--test/e2e/pod_rm_test.go2
-rw-r--r--test/e2e/pod_top_test.go4
-rw-r--r--test/e2e/prune_test.go38
-rw-r--r--test/e2e/ps_test.go56
-rw-r--r--test/e2e/pull_test.go14
-rw-r--r--test/e2e/rmi_test.go14
-rw-r--r--test/e2e/run_entrypoint_test.go8
-rw-r--r--test/e2e/run_env_test.go2
-rw-r--r--test/e2e/run_networking_test.go140
-rw-r--r--test/e2e/run_privileged_test.go2
-rw-r--r--test/e2e/run_test.go12
-rw-r--r--test/e2e/run_userns_test.go2
-rw-r--r--test/e2e/run_volume_test.go16
-rw-r--r--test/e2e/search_test.go8
-rw-r--r--test/e2e/secret_test.go8
-rw-r--r--test/e2e/stats_test.go2
-rw-r--r--test/e2e/system_connection_test.go2
-rw-r--r--test/e2e/system_df_test.go2
-rw-r--r--test/e2e/system_reset_test.go6
-rw-r--r--test/e2e/systemd_test.go6
-rw-r--r--test/e2e/trust_test.go6
-rw-r--r--test/e2e/volume_create_test.go4
-rw-r--r--test/e2e/volume_inspect_test.go2
-rw-r--r--test/e2e/volume_ls_test.go22
-rw-r--r--test/e2e/volume_plugin_test.go8
-rw-r--r--test/e2e/volume_prune_test.go22
-rw-r--r--test/e2e/volume_rm_test.go8
-rw-r--r--test/system/010-images.bats2
-rw-r--r--test/system/110-history.bats8
-rw-r--r--test/utils/utils.go1
86 files changed, 724 insertions, 589 deletions
diff --git a/cmd/podman/images/history.go b/cmd/podman/images/history.go
index cc7b1b4eb..ac693a87b 100644
--- a/cmd/podman/images/history.go
+++ b/cmd/podman/images/history.go
@@ -1,7 +1,6 @@
package images
import (
- "context"
"fmt"
"os"
"strings"
@@ -79,7 +78,7 @@ func historyFlags(cmd *cobra.Command) {
}
func history(cmd *cobra.Command, args []string) error {
- results, err := registry.ImageEngine().History(context.Background(), args[0], entities.ImageHistoryOptions{})
+ results, err := registry.ImageEngine().History(registry.Context(), args[0], entities.ImageHistoryOptions{})
if err != nil {
return err
}
@@ -111,37 +110,32 @@ func history(cmd *cobra.Command, args []string) error {
hr = append(hr, historyReporter{l})
}
- hdrs := report.Headers(historyReporter{}, map[string]string{
- "CreatedBy": "CREATED BY",
- })
+ rpt := report.New(os.Stdout, cmd.Name())
+ defer rpt.Flush()
- // Defaults
- row := "{{.ID}}\t{{.Created}}\t{{.CreatedBy}}\t{{.Size}}\t{{.Comment}}\n"
switch {
- case cmd.Flags().Changed("format"):
- row = report.NormalizeFormat(opts.format)
case opts.quiet:
- row = "{{.ID}}\n"
+ rpt, err = rpt.Parse(report.OriginUser, "{{range .}}{{.ID}}\n{{end -}}")
+ case cmd.Flags().Changed("format"):
+ rpt, err = rpt.Parse(report.OriginUser, cmd.Flag("format").Value.String())
+ default:
+ format := "{{range .}}{{.ID}}\t{{.Created}}\t{{.CreatedBy}}\t{{.Size}}\t{{.Comment}}\n{{end -}}"
+ rpt, err = rpt.Parse(report.OriginPodman, format)
}
- format := report.EnforceRange(row)
-
- tmpl, err := report.NewTemplate("history").Parse(format)
if err != nil {
return err
}
- w, err := report.NewWriterDefault(os.Stdout)
- if err != nil {
- return err
- }
- defer w.Flush()
+ if rpt.RenderHeaders {
+ hdrs := report.Headers(historyReporter{}, map[string]string{
+ "CreatedBy": "CREATED BY",
+ })
- if !opts.quiet && !cmd.Flags().Changed("format") {
- if err := tmpl.Execute(w, hdrs); err != nil {
+ if err := rpt.Execute(hdrs); err != nil {
return errors.Wrapf(err, "failed to write report column headers")
}
}
- return tmpl.Execute(w, hr)
+ return rpt.Execute(hr)
}
type historyReporter struct {
diff --git a/cmd/podman/images/list.go b/cmd/podman/images/list.go
index 01286daf2..61514daa7 100644
--- a/cmd/podman/images/list.go
+++ b/cmd/podman/images/list.go
@@ -117,7 +117,7 @@ func images(cmd *cobra.Command, args []string) error {
listOptions.Filter = append(listOptions.Filter, "reference="+args[0])
}
- if cmd.Flag("sort").Changed && !sortFields.Contains(listFlag.sort) {
+ if cmd.Flags().Changed("sort") && !sortFields.Contains(listFlag.sort) {
return fmt.Errorf("\"%s\" is not a valid field for sorting. Choose from: %s",
listFlag.sort, sortFields.String())
}
@@ -140,7 +140,7 @@ func images(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("format") && !report.HasTable(listFlag.format) {
listFlag.noHeading = true
}
- return writeTemplate(imgs)
+ return writeTemplate(cmd, imgs)
}
}
@@ -186,38 +186,31 @@ func writeJSON(images []imageReporter) error {
return nil
}
-func writeTemplate(imgs []imageReporter) error {
+func writeTemplate(cmd *cobra.Command, imgs []imageReporter) error {
hdrs := report.Headers(imageReporter{}, map[string]string{
"ID": "IMAGE ID",
"ReadOnly": "R/O",
})
- var format string
- if listFlag.format == "" {
- format = lsFormatFromFlags(listFlag)
- } else {
- format = report.NormalizeFormat(listFlag.format)
- format = report.EnforceRange(format)
- }
+ rpt := report.New(os.Stdout, cmd.Name())
+ defer rpt.Flush()
- tmpl, err := report.NewTemplate("list").Parse(format)
- if err != nil {
- return err
+ var err error
+ if cmd.Flags().Changed("format") {
+ rpt, err = rpt.Parse(report.OriginUser, cmd.Flag("format").Value.String())
+ } else {
+ rpt, err = rpt.Parse(report.OriginPodman, lsFormatFromFlags(listFlag))
}
-
- w, err := report.NewWriterDefault(os.Stdout)
if err != nil {
return err
}
- defer w.Flush()
- if !listFlag.noHeading {
- if err := tmpl.Execute(w, hdrs); err != nil {
+ if rpt.RenderHeaders && !listFlag.noHeading {
+ if err := rpt.Execute(hdrs); err != nil {
return err
}
}
-
- return tmpl.Execute(w, imgs)
+ return rpt.Execute(imgs)
}
func sortImages(imageS []*entities.ImageSummary) ([]imageReporter, error) {
diff --git a/cmd/podman/images/mount.go b/cmd/podman/images/mount.go
index 89c00cb70..cdeb9eecf 100644
--- a/cmd/podman/images/mount.go
+++ b/cmd/podman/images/mount.go
@@ -87,7 +87,7 @@ func mount(cmd *cobra.Command, args []string) error {
case report.IsJSON(mountOpts.Format):
return printJSON(reports)
case mountOpts.Format == "":
- break // default format
+ break // see default format below
default:
return errors.Errorf("unknown --format argument: %q", mountOpts.Format)
}
@@ -97,19 +97,12 @@ func mount(cmd *cobra.Command, args []string) error {
mrs = append(mrs, mountReporter{r})
}
- row := "{{range . }}{{.ID}}\t{{.Path}}\n{{end -}}"
- tmpl, err := report.NewTemplate("mounts").Parse(row)
+ rpt, err := report.New(os.Stdout, cmd.Name()).Parse(report.OriginPodman, "{{range . }}{{.ID}}\t{{.Path}}\n{{end -}}")
if err != nil {
return err
}
-
- w, err := report.NewWriterDefault(os.Stdout)
- if err != nil {
- return err
- }
- defer w.Flush()
-
- return tmpl.Execute(w, mrs)
+ defer rpt.Flush()
+ return rpt.Execute(mrs)
}
func printJSON(reports []*entities.ImageMountReport) error {
diff --git a/cmd/podman/images/search.go b/cmd/podman/images/search.go
index c9a4793aa..0791ac02c 100644
--- a/cmd/podman/images/search.go
+++ b/cmd/podman/images/search.go
@@ -149,9 +149,9 @@ func imageSearch(cmd *cobra.Command, args []string) error {
searchReport[i].Description = d
}
- hdrs := report.Headers(entities.ImageSearchReport{}, nil)
- renderHeaders := true
- var row string
+ rpt := report.New(os.Stdout, cmd.Name())
+ defer rpt.Flush()
+
switch {
case searchOptions.ListTags:
if len(searchOptions.Filters) != 0 {
@@ -161,39 +161,30 @@ func imageSearch(cmd *cobra.Command, args []string) error {
listTagsEntries := buildListTagsJSON(searchReport)
return printArbitraryJSON(listTagsEntries)
}
- row = "{{.Name}}\t{{.Tag}}\n"
+ rpt, err = rpt.Parse(report.OriginPodman, "{{range .}}{{.Name}}\t{{.Tag}}\n{{end -}}")
case isJSON:
return printArbitraryJSON(searchReport)
case cmd.Flags().Changed("format"):
- renderHeaders = report.HasTable(searchOptions.Format)
- row = report.NormalizeFormat(searchOptions.Format)
+ rpt, err = rpt.Parse(report.OriginUser, searchOptions.Format)
default:
- row = "{{.Name}}\t{{.Description}}"
+ row := "{{.Name}}\t{{.Description}}"
if searchOptions.Compatible {
row += "\t{{.Stars}}\t{{.Official}}\t{{.Automated}}"
}
- row += "\n"
+ row = "{{range . }}" + row + "\n{{end -}}"
+ rpt, err = rpt.Parse(report.OriginPodman, row)
}
- format := report.EnforceRange(row)
-
- tmpl, err := report.NewTemplate("search").Parse(format)
if err != nil {
return err
}
- w, err := report.NewWriterDefault(os.Stdout)
- if err != nil {
- return err
- }
- defer w.Flush()
-
- if renderHeaders {
- if err := tmpl.Execute(w, hdrs); err != nil {
- return errors.Wrapf(err, "failed to write search column headers")
+ if rpt.RenderHeaders {
+ hdrs := report.Headers(entities.ImageSearchReport{}, nil)
+ if err := rpt.Execute(hdrs); err != nil {
+ return errors.Wrapf(err, "failed to write report column headers")
}
}
-
- return tmpl.Execute(w, searchReport)
+ return rpt.Execute(searchReport)
}
func printArbitraryJSON(v interface{}) error {
diff --git a/cmd/podman/images/trust_show.go b/cmd/podman/images/trust_show.go
index c0e56f504..04ea24ca5 100644
--- a/cmd/podman/images/trust_show.go
+++ b/cmd/podman/images/trust_show.go
@@ -48,11 +48,12 @@ func showTrust(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
- if showTrustOptions.Raw {
+
+ switch {
+ case showTrustOptions.Raw:
fmt.Println(string(trust.Raw))
return nil
- }
- if showTrustOptions.JSON {
+ case showTrustOptions.JSON:
b, err := json.MarshalIndent(trust.Policies, "", " ")
if err != nil {
return err
@@ -60,23 +61,13 @@ func showTrust(cmd *cobra.Command, args []string) error {
fmt.Println(string(b))
return nil
}
+ rpt := report.New(os.Stdout, cmd.Name())
+ defer rpt.Flush()
- format := "{{range . }}{{.RepoName}}\t{{.Type}}\t{{.GPGId}}\t{{.SignatureStore}}\n{{end -}}"
- tmpl, err := report.NewTemplate("list").Parse(format)
- if err != nil {
- return err
- }
-
- w, err := report.NewWriterDefault(os.Stdout)
+ rpt, err = rpt.Parse(report.OriginPodman,
+ "{{range . }}{{.RepoName}}\t{{.Type}}\t{{.GPGId}}\t{{.SignatureStore}}\n{{end -}}")
if err != nil {
return err
}
-
- if err := tmpl.Execute(w, trust.Policies); err != nil {
- return err
- }
- if err := w.Flush(); err != nil {
- return err
- }
- return nil
+ return rpt.Execute(trust.Policies)
}
diff --git a/cmd/podman/inspect/inspect.go b/cmd/podman/inspect/inspect.go
index 64b586388..c982b1b7f 100644
--- a/cmd/podman/inspect/inspect.go
+++ b/cmd/podman/inspect/inspect.go
@@ -215,8 +215,10 @@ func (i *inspector) inspect(namesOrIDs []string) error {
case report.IsJSON(i.options.Format) || i.options.Format == "":
err = printJSON(data)
default:
+ // Landing here implies user has given a custom --format
row := inspectNormalize(i.options.Format)
- row = "{{range . }}" + report.NormalizeFormat(row) + "{{end -}}"
+ row = report.NormalizeFormat(row)
+ row = report.EnforceRange(row)
err = printTmpl(tmpType, row, data)
}
if err != nil {
diff --git a/cmd/podman/machine/list.go b/cmd/podman/machine/list.go
index d569f4db0..774ab4fd0 100644
--- a/cmd/podman/machine/list.go
+++ b/cmd/podman/machine/list.go
@@ -116,7 +116,15 @@ func outputTemplate(cmd *cobra.Command, responses []*machineReporter) error {
"DiskSize": "DISK SIZE",
})
- row := report.NormalizeFormat(listFlag.format)
+ var row string
+ switch {
+ case cmd.Flags().Changed("format"):
+ row = cmd.Flag("format").Value.String()
+ listFlag.noHeading = !report.HasTable(row)
+ row = report.NormalizeFormat(row)
+ default:
+ row = cmd.Flag("format").Value.String()
+ }
format := report.EnforceRange(row)
tmpl, err := report.NewTemplate("list").Parse(format)
@@ -130,10 +138,6 @@ func outputTemplate(cmd *cobra.Command, responses []*machineReporter) error {
}
defer w.Flush()
- if cmd.Flags().Changed("format") && !report.HasTable(listFlag.format) {
- listFlag.noHeading = true
- }
-
if !listFlag.noHeading {
if err := tmpl.Execute(w, headers); err != nil {
return errors.Wrapf(err, "failed to write report column headers")
diff --git a/cmd/podman/networks/list.go b/cmd/podman/networks/list.go
index 124a17d5d..6f1a7742a 100644
--- a/cmd/podman/networks/list.go
+++ b/cmd/podman/networks/list.go
@@ -84,7 +84,7 @@ func networkList(cmd *cobra.Command, args []string) error {
// table or other format output
default:
- err = templateOut(responses, cmd)
+ err = templateOut(cmd, responses)
}
return err
@@ -105,7 +105,7 @@ func jsonOut(responses []types.Network) error {
return nil
}
-func templateOut(responses []types.Network, cmd *cobra.Command) error {
+func templateOut(cmd *cobra.Command, responses []types.Network) error {
nlprs := make([]ListPrintReports, 0, len(responses))
for _, r := range responses {
nlprs = append(nlprs, ListPrintReports{r})
@@ -120,14 +120,16 @@ func templateOut(responses []types.Network, cmd *cobra.Command) error {
})
renderHeaders := report.HasTable(networkListOptions.Format)
- var row, format string
- if cmd.Flags().Changed("format") {
+ var row string
+ switch {
+ case cmd.Flags().Changed("format"):
row = report.NormalizeFormat(networkListOptions.Format)
- } else { // 'podman network ls' equivalent to 'podman network ls --format="table {{.ID}} {{.Name}} {{.Version}} {{.Plugins}}" '
- renderHeaders = true
+ default:
+ // 'podman network ls' equivalent to 'podman network ls --format="table {{.ID}} {{.Name}} {{.Version}} {{.Plugins}}" '
row = "{{.ID}}\t{{.Name}}\t{{.Driver}}\n"
+ renderHeaders = true
}
- format = report.EnforceRange(row)
+ format := report.EnforceRange(row)
tmpl, err := report.NewTemplate("list").Parse(format)
if err != nil {
diff --git a/cmd/podman/pods/inspect.go b/cmd/podman/pods/inspect.go
index 96eaec3b9..d4b8df90e 100644
--- a/cmd/podman/pods/inspect.go
+++ b/cmd/podman/pods/inspect.go
@@ -64,11 +64,13 @@ func inspect(cmd *cobra.Command, args []string) error {
}
if report.IsJSON(inspectOptions.Format) {
+ json.MarshalIndent(responses, "", " ")
enc := json.NewEncoder(os.Stdout)
enc.SetIndent("", " ")
return enc.Encode(responses)
}
+ // cmd.Flags().Changed("format") must be true to reach this code
row := report.NormalizeFormat(inspectOptions.Format)
t, err := report.NewTemplate("inspect").Parse(row)
diff --git a/cmd/podman/pods/ps.go b/cmd/podman/pods/ps.go
index 60aadf224..808ec31b3 100644
--- a/cmd/podman/pods/ps.go
+++ b/cmd/podman/pods/ps.go
@@ -136,11 +136,12 @@ func pods(cmd *cobra.Command, _ []string) error {
renderHeaders = report.HasTable(psInput.Format)
row = report.NormalizeFormat(psInput.Format)
}
+ format := report.EnforceRange(row)
+
noHeading, _ := cmd.Flags().GetBool("noheading")
if noHeading {
renderHeaders = false
}
- format := report.EnforceRange(row)
tmpl, err := report.NewTemplate("list").Parse(format)
if err != nil {
diff --git a/cmd/podman/pods/stats.go b/cmd/podman/pods/stats.go
index ba2c1495b..a7bba3064 100644
--- a/cmd/podman/pods/stats.go
+++ b/cmd/podman/pods/stats.go
@@ -67,9 +67,7 @@ func stats(cmd *cobra.Command, args []string) error {
return err
}
- row := report.NormalizeFormat(statsOptions.Format)
- doJSON := report.IsJSON(row)
-
+ doJSON := report.IsJSON(cmd.Flag("format").Value.String())
headers := report.Headers(entities.PodStatsReport{}, map[string]string{
"CPU": "CPU %",
"MemUsage": "MEM USAGE/ LIMIT",
@@ -96,6 +94,8 @@ func stats(cmd *cobra.Command, args []string) error {
goterm.Flush()
}
if cmd.Flags().Changed("format") {
+ row := report.NormalizeFormat(statsOptions.Format)
+ row = report.EnforceRange(row)
if err := printFormattedPodStatsLines(headers, row, reports); err != nil {
return err
}
@@ -143,8 +143,6 @@ func printFormattedPodStatsLines(headerNames []map[string]string, row string, st
return nil
}
- row = report.EnforceRange(row)
-
tmpl, err := report.NewTemplate("stats").Parse(row)
if err != nil {
return err
diff --git a/cmd/podman/secrets/list.go b/cmd/podman/secrets/list.go
index f136de4ab..255d9ae1a 100644
--- a/cmd/podman/secrets/list.go
+++ b/cmd/podman/secrets/list.go
@@ -71,7 +71,10 @@ func outputTemplate(cmd *cobra.Command, responses []*entities.SecretListReport)
"UpdatedAt": "UPDATED",
})
- row := report.NormalizeFormat(listFlag.format)
+ row := cmd.Flag("format").Value.String()
+ if cmd.Flags().Changed("format") {
+ row = report.NormalizeFormat(row)
+ }
format := report.EnforceRange(row)
tmpl, err := report.NewTemplate("list").Parse(format)
diff --git a/cmd/podman/system/connection/list.go b/cmd/podman/system/connection/list.go
index f1f7657ad..2710142a8 100644
--- a/cmd/podman/system/connection/list.go
+++ b/cmd/podman/system/connection/list.go
@@ -82,7 +82,7 @@ func list(cmd *cobra.Command, _ []string) error {
return rows[i].Name < rows[j].Name
})
- format := "{{.Name}}\t{{.URI}}\t{{.Identity}}\t{{.Default}}\n"
+ var format string
switch {
case report.IsJSON(cmd.Flag("format").Value.String()):
buf, err := registry.JSONLibrary().MarshalIndent(rows, "", " ")
@@ -90,11 +90,10 @@ func list(cmd *cobra.Command, _ []string) error {
fmt.Println(string(buf))
}
return err
+ case cmd.Flags().Changed("format"):
+ format = report.NormalizeFormat(cmd.Flag("format").Value.String())
default:
- if cmd.Flag("format").Changed {
- format = cmd.Flag("format").Value.String()
- format = report.NormalizeFormat(format)
- }
+ format = "{{.Name}}\t{{.URI}}\t{{.Identity}}\t{{.Default}}\n"
}
format = report.EnforceRange(format)
diff --git a/cmd/podman/system/version.go b/cmd/podman/system/version.go
index 3443978d6..87b806503 100644
--- a/cmd/podman/system/version.go
+++ b/cmd/podman/system/version.go
@@ -59,7 +59,7 @@ func version(cmd *cobra.Command, args []string) error {
}
defer w.Flush()
- if cmd.Flag("format").Changed {
+ if cmd.Flags().Changed("format") {
row := report.NormalizeFormat(versionFormat)
tmpl, err := report.NewTemplate("version 2.0.0").Parse(row)
if err != nil {
diff --git a/cmd/podman/volumes/list.go b/cmd/podman/volumes/list.go
index 0243054af..c372527de 100644
--- a/cmd/podman/volumes/list.go
+++ b/cmd/podman/volumes/list.go
@@ -97,9 +97,14 @@ func outputTemplate(cmd *cobra.Command, responses []*entities.VolumeListReport)
"Name": "VOLUME NAME",
})
- row := report.NormalizeFormat(cliOpts.Format)
- if cliOpts.Quiet {
+ var row string
+ switch {
+ case cliOpts.Quiet:
row = "{{.Name}}\n"
+ case cmd.Flags().Changed("format"):
+ row = report.NormalizeFormat(cliOpts.Format)
+ default:
+ row = cmd.Flag("format").Value.String()
}
format := report.EnforceRange(row)
diff --git a/contrib/cirrus/logformatter b/contrib/cirrus/logformatter
index 5156f9f8a..70f119b5b 100755
--- a/contrib/cirrus/logformatter
+++ b/contrib/cirrus/logformatter
@@ -37,12 +37,15 @@ table.synopsis { border: none; border-collapse: collapse; margin-left: 2em; marg
.synopsis td { font-weight: bold; font-size: 120%; font-family: monospace; }
/* test results */
+.testname { font-size: 125%; color: #444; }
.boring { color: #999; }
.timestamp { color: #999; }
.log-debug { color: #999; }
.log-info { color: #333; }
.log-warn { color: #f60; }
.log-error { color: #900; font-weight: bold; }
+.log-skip { color: #F90; }
+.log-slow { background: #FF0; color: #000; font-weight: bold; }
.subtest { background: #eee; }
.subsubtest { color: #F39; font-weight: bold; }
.string { color: #00c; }
@@ -205,11 +208,17 @@ END_HTML
print { $out_fh } "<pre> <!-- begin processed output -->\n";
+ # Assume rootful prompt, check for rootless (here and in log itself, below)
+ my $Prompt = '#';
+ $Prompt = '$' if $test_name =~ /rootless/;
+
# Main loop: read input, one line at a time, and write out reformatted
LINE:
while (my $line = <STDIN>) {
print $line; # Immediately dump back to stdout
+ $Prompt = '$' if $line =~ /Runner executing .* as rootless /;
+
# Remain robust in face of errors: always write stdout even if no HTML
next LINE if ! $out_fh;
@@ -328,7 +337,7 @@ END_HTML
next LINE;
}
# (bindings test sometimes emits 'Running' with leading bullet char)
- elsif ($line =~ /^•?Running:/) {
+ elsif ($line =~ s!^•?Running:!<span class="boring">$Prompt</span>!) {
# Highlight the important (non-boilerplate) podman command.
$line =~ s/\s+--remote\s+/ /g; # --remote takes no args
# Strip out the global podman options, but show them on hover
@@ -365,19 +374,27 @@ END_HTML
# an anchor so we can link to it later.
if ($after_divider++ == 2) {
# Sigh. There is no actual marker. Assume that anything with
- ## two leading spaces then alpha (not slashes) is a test name.
- if ($line =~ /^ [a-zA-Z]/) {
+ ## two leading spaces then alpha or hyphen (not slashes) is
+ ## a test name.
+ if ($line =~ /^ [a-zA-Z-]/) {
my $id = make_id($line, 'anchor');
$line = "<a name='t--$id'><h2>$line</h2></a>";
}
}
+ # Make SKIPPING and SLOW TEST visible
+ $line =~ s!(\[SKIPPING\].*)!<span class="log-skip">$1</span>!;
+ $line =~ s!(\[SLOW TEST.*\])!<span class="log-slow">$1</span>!;
+
+ # Highlight test name when it appears in the middle of commands.
+ # But make it boring, because we already have the test name in large
+ # bold just above. (Except in skipped tests).
+ $line =~ s!^(\s*)(\[It\]\s+.*)!$1<span class="testname">$2</span>!;
+
# Failure name corresponds to a previously-seen block.
- ## FIXME: sometimes there are three failures with the same name.
- ## ...I have no idea why or how to link to the right ones.
- # 1 2 2 3 3 14 4
- if ($line =~ /^(\[(Fail|Panic!)\] .* \[(It|BeforeEach)\] )([A-Za-z].*)/) {
+ # 1 2 2 3 3 14 4
+ if ($line =~ /^(\[(Fail|Panic!)\] .* \[(It|BeforeEach)\] )([A-Za-z-].*)/) {
my ($lhs, $type, $ginkgo_fluff, $testname) = ($1, $2, $3, $4);
my $id = make_id($testname, 'link');
@@ -486,7 +503,10 @@ sub make_id {
state %counter;
$name =~ s/^\s+|\s+$//g; # strip leading/trailing whitespace
+ $name =~ s/\&#\d+;//g; # 'doesn&#39;t' -> 'doesnt'
+ $name =~ s/\&quot;/-/g; # '&quot;path&quot;' -> '-path-'
$name =~ s/[^a-zA-Z0-9_-]/-/g; # Convert non-alphanumeric to dash
+ $name =~ s/-{3,}/-/g; # '------' to just '-'
# Keep a running tally of how many times we've seen this identifier
# for this given type! This lets us cross-match, in the bottom of
diff --git a/contrib/cirrus/logformatter.t b/contrib/cirrus/logformatter.t
index bd4179b5e..d905693ad 100755
--- a/contrib/cirrus/logformatter.t
+++ b/contrib/cirrus/logformatter.t
@@ -134,9 +134,35 @@ $SCRIPT_BASE/integration_test.sh |& ${TIMESTAMP}
[+0103s] 4810be0cfbd42241e349dbe7d50fbc54405cd320a6637c65fd5323f34d64af89
[+0104s] Running: /var/tmp/go/src/github.com/containers/libpod/bin/podman-remote --storage-opt vfs.imagestore=/tmp/podman/imagecachedir --root /tmp/podman_test553496330/crio --runroot /tmp/podman_test553496330/crio-run --runtime /usr/bin/runc --conmon /usr/bin/conmon --cni-config-dir /etc/cni/net.d --cgroup-manager systemd --tmpdir /tmp/podman_test553496330 --events-backend file --storage-driver vfs --remote --url unix:/run/user/12345/podman-xyz.sock pod rm -fa
[+0104s] 4810be0cfbd42241e349dbe7d50fbc54405cd320a6637c65fd5323f34d64af89 again
+
+
[+0107s] •
-[+0107s] ------------------------------
-[+0107s] podman system reset
+[+0523s] ------------------------------
+[+0523s] Podman play kube with build
+[+0523s] --build should override image in store
+[+0523s] /var/tmp/go/src/github.com/containers/podman/test/e2e/play_build_test.go:215
+
+
+[+0479s] •
+[+0479s] ------------------------------
+[+0479s] Podman pod rm
+[+0479s] podman pod rm -a doesn't remove a running container
+[+0479s] /var/tmp/go/src/github.com/containers/podman/test/e2e/pod_rm_test.go:119
+
+
+[+1405s] •
+[+1405s] ------------------------------
+[+1405s] Podman run entrypoint
+[+1405s] podman run entrypoint == [""]
+[+1405s] /var/tmp/go/src/github.com/containers/podman/test/e2e/run_entrypoint_test.go:47
+
+[+0184s] S [SKIPPING] [3.086 seconds]
+[+1385s] S [SKIPPING] in Spec Setup (BeforeEach) [0.001 seconds]
+
+[+1512s] Summarizing 6 Failures:
+[+1512s]
+[+1512s] [Fail] Podman play kube with build [It] --build should override image in store
+[+1512s] /var/tmp/go/src/github.com/containers/podman/test/e2e/play_build_test.go:259
>>>
$SCRIPT_BASE/integration_test.sh |&amp; ${TIMESTAMP}
[08:26:19] START - All [+xxxx] lines that follow are relative to right now.
@@ -150,9 +176,9 @@ $SCRIPT_BASE/integration_test.sh |&amp; ${TIMESTAMP}
<span class="timestamp"> </span> /var/tmp/go/src/github.com<a class="codelink" href='https://github.com/containers/podman/blob/40f5d8b1becd381c4e8283ed3940d09193e4fe06/test/e2e/pod_restart_test.go#L41'>/containers/podman/test/e2e/pod_restart_test.go:41</a>
<span class="timestamp"> </span>[BeforeEach] Podman pod restart
<span class="timestamp"> </span> /var/tmp/go/src/github.com<a class="codelink" href='https://github.com/containers/podman/blob/40f5d8b1becd381c4e8283ed3940d09193e4fe06/test/e2e/pod_restart_test.go#L18'>/containers/podman/test/e2e/pod_restart_test.go:18</a>
-<span class="timestamp"> </span>[It] podman pod restart single empty pod
+<span class="timestamp"> </span><span class="testname">[It] podman pod restart single empty pod</span>
<span class="timestamp"> </span> /var/tmp/go/src/github.com<a class="codelink" href='https://github.com/containers/podman/blob/40f5d8b1becd381c4e8283ed3940d09193e4fe06/test/e2e/pod_restart_test.go#L41'>/containers/podman/test/e2e/pod_restart_test.go:41</a>
-<span class="timestamp"> </span>Running: <span title="/var/tmp/go/src/github.com/containers/podman/bin/podman"><b>podman</b></span> <span class="boring" title="--storage-opt vfs.imagestore=/tmp/podman/imagecachedir
+<span class="timestamp"> </span><span class="boring">#</span> <span title="/var/tmp/go/src/github.com/containers/podman/bin/podman"><b>podman</b></span> <span class="boring" title="--storage-opt vfs.imagestore=/tmp/podman/imagecachedir
--root /tmp/podman_test553496330/crio
--runroot /tmp/podman_test553496330/crio-run
--runtime /usr/bin/runc
@@ -163,7 +189,7 @@ $SCRIPT_BASE/integration_test.sh |&amp; ${TIMESTAMP}
--events-backend file
--storage-driver vfs">[options]</span><b> pod create --infra=false --share</b>
<span class="timestamp"> </span>4810be0cfbd42241e349dbe7d50fbc54405cd320a6637c65fd5323f34d64af89
-<span class="timestamp"> </span>Running: <span title="/var/tmp/go/src/github.com/containers/podman/bin/podman"><b>podman</b></span> <span class="boring" title="--storage-opt vfs.imagestore=/tmp/podman/imagecachedir
+<span class="timestamp"> </span><span class="boring">#</span> <span title="/var/tmp/go/src/github.com/containers/podman/bin/podman"><b>podman</b></span> <span class="boring" title="--storage-opt vfs.imagestore=/tmp/podman/imagecachedir
--root /tmp/podman_test553496330/crio
--runroot /tmp/podman_test553496330/crio-run
--runtime /usr/bin/runc
@@ -177,7 +203,7 @@ $SCRIPT_BASE/integration_test.sh |&amp; ${TIMESTAMP}
<span class="timestamp"> </span>output:
<span class="timestamp"> </span>[AfterEach] Podman pod restart
<span class="timestamp"> </span> /var/tmp/go/src/github.com<a class="codelink" href='https://github.com/containers/podman/blob/40f5d8b1becd381c4e8283ed3940d09193e4fe06/test/e2e/pod_restart_test.go#L28'>/containers/podman/test/e2e/pod_restart_test.go:28</a>
-<span class="timestamp"> </span>Running: <span title="/var/tmp/go/src/github.com/containers/podman/bin/podman"><b>podman</b></span> <span class="boring" title="--storage-opt vfs.imagestore=/tmp/podman/imagecachedir
+<span class="timestamp"> </span><span class="boring">#</span> <span title="/var/tmp/go/src/github.com/containers/podman/bin/podman"><b>podman</b></span> <span class="boring" title="--storage-opt vfs.imagestore=/tmp/podman/imagecachedir
--root /tmp/podman_test553496330/crio
--runroot /tmp/podman_test553496330/crio-run
--runtime /usr/bin/runc
@@ -189,7 +215,7 @@ $SCRIPT_BASE/integration_test.sh |&amp; ${TIMESTAMP}
--storage-driver vfs">[options]</span><b> pod rm -fa</b>
<span class="timestamp"> </span>4810be0cfbd42241e349dbe7d50fbc54405cd320a6637c65fd5323f34d64af89
-<span class="timestamp">[+0104s] </span>Running: <span title="/var/tmp/go/src/github.com/containers/libpod/bin/podman-remote"><b>podman-remote</b></span> <span class="boring" title="--storage-opt vfs.imagestore=/tmp/podman/imagecachedir
+<span class="timestamp">[+0104s] </span><span class="boring">#</span> <span title="/var/tmp/go/src/github.com/containers/libpod/bin/podman-remote"><b>podman-remote</b></span> <span class="boring" title="--storage-opt vfs.imagestore=/tmp/podman/imagecachedir
--root /tmp/podman_test553496330/crio
--runroot /tmp/podman_test553496330/crio-run
--runtime /usr/bin/runc
@@ -207,4 +233,34 @@ $SCRIPT_BASE/integration_test.sh |&amp; ${TIMESTAMP}
</pre>
<hr />
<pre>
-<span class="timestamp">[+0107s] </span>podman system reset
+<span class="timestamp">[+0523s] </span>Podman play kube with build
+<span class="timestamp"> </span><a name='t----build-should-override-image-in-store--1'><h2> --build should override image in store</h2></a>
+<span class="timestamp"> </span> /var/tmp/go/src/github.com<a class="codelink" href='https://github.com/containers/podman/blob/40f5d8b1becd381c4e8283ed3940d09193e4fe06/test/e2e/play_build_test.go#L215'>/containers/podman/test/e2e/play_build_test.go:215</a>
+
+
+<span class="timestamp">[+0479s] </span>•
+</pre>
+<hr />
+<pre>
+<span class="timestamp">[+0479s] </span>Podman pod rm
+<span class="timestamp"> </span><a name='t--podman-pod-rm--a-doesnt-remove-a-running-container--1'><h2> podman pod rm -a doesn&#39;t remove a running container</h2></a>
+<span class="timestamp"> </span> /var/tmp/go/src/github.com<a class="codelink" href='https://github.com/containers/podman/blob/40f5d8b1becd381c4e8283ed3940d09193e4fe06/test/e2e/pod_rm_test.go#L119'>/containers/podman/test/e2e/pod_rm_test.go:119</a>
+
+
+<span class="timestamp">[+1405s] </span>•
+</pre>
+<hr />
+<pre>
+<span class="timestamp">[+1405s] </span>Podman run entrypoint
+<span class="timestamp"> </span><a name='t--podman-run-entrypoint---1'><h2> podman run entrypoint == [&quot;&quot;]</h2></a>
+<span class="timestamp"> </span> /var/tmp/go/src/github.com<a class="codelink" href='https://github.com/containers/podman/blob/40f5d8b1becd381c4e8283ed3940d09193e4fe06/test/e2e/run_entrypoint_test.go#L47'>/containers/podman/test/e2e/run_entrypoint_test.go:47</a>
+
+
+<span class="timestamp">[+0184s] </span>S <span class="log-skip">[SKIPPING] [3.086 seconds]</span>
+<span class="timestamp">[+1385s] </span>S <span class="log-skip">[SKIPPING] in Spec Setup (BeforeEach) [0.001 seconds]</span>
+
+
+<span class="timestamp">[+1512s] </span>Summarizing 6 Failures:
+[+1512s]
+<span class="timestamp"> </span><b>[Fail] Podman play kube with build [It] <a href='#t----build-should-override-image-in-store--1'>--build should override image in store</a></b>
+<span class="timestamp"> </span>/var/tmp/go/src/github.com<a class="codelink" href='https://github.com/containers/podman/blob/40f5d8b1becd381c4e8283ed3940d09193e4fe06/test/e2e/play_build_test.go#L259'>/containers/podman/test/e2e/play_build_test.go:259</a>
diff --git a/docs/source/markdown/podman-unshare.1.md b/docs/source/markdown/podman-unshare.1.md
index 5676b1be7..01393a862 100644
--- a/docs/source/markdown/podman-unshare.1.md
+++ b/docs/source/markdown/podman-unshare.1.md
@@ -35,7 +35,6 @@ Print usage statement
Join the rootless network namespace used for CNI and netavark networking. It can be used to
connect to a rootless container via IP address (bridge networking). This is otherwise
not possible from the host network namespace.
-_Note: Using this option with more than one unshare session can have unexpected results._
## Exit Codes
@@ -57,13 +56,13 @@ the exit codes follow the `chroot` standard, see below:
**127** Executing a _contained command_ and the _command_ cannot be found
- $ podman run busybox foo; echo $?
+ $ podman unshare foo; echo $?
Error: fork/exec /usr/bin/bogus: no such file or directory
127
**Exit code** _contained command_ exit code
- $ podman run busybox /bin/sh -c 'exit 3'; echo $?
+ $ podman unshare /bin/sh -c 'exit 3'; echo $?
3
## EXAMPLE
diff --git a/docs/tutorials/remote_client.md b/docs/tutorials/remote_client.md
index 889947397..0370b0329 100644
--- a/docs/tutorials/remote_client.md
+++ b/docs/tutorials/remote_client.md
@@ -58,11 +58,11 @@ sudo systemctl enable --now -s sshd
```
#### Setting up SSH
-Remote Podman uses SSH to communicate between the client and server. The remote client works considerably smoother using SSH keys. To set up your ssh connection, you need to generate an ssh key pair from your client machine.
+Remote Podman uses SSH to communicate between the client and server. The remote client works considerably smoother using SSH keys. To set up your ssh connection, you need to generate an ssh key pair from your client machine. *NOTE:* in some instances, using a `rsa` key will cause connection issues, be sure to create an `ed25519` key.
```
-ssh-keygen
+ssh-keygen -t ed25519
```
-Your public key by default should be in your home directory under ~/.ssh/id_rsa.pub. You then need to copy the contents of id_rsa.pub and append it into ~/.ssh/authorized_keys on the Linux server. You can automate this using ssh-copy-id.
+Your public key by default should be in your home directory under ~/.ssh/id_ed25519.pub. You then need to copy the contents of id_ed25519.pub and append it into ~/.ssh/authorized_keys on the Linux server. You can automate this using ssh-copy-id.
If you do not wish to use SSH keys, you will be prompted with each Podman command for your login password.
@@ -75,7 +75,7 @@ The first step in using the Podman remote client is to configure a connection.
You can add a connection by using the `podman-remote system connection add` command.
```
-podman-remote system connection add myuser --identity ~/.ssh/id_rsa ssh://192.168.122.1/run/user/1000/podman/podman.sock
+podman-remote system connection add myuser --identity ~/.ssh/id_ed25519 ssh://192.168.122.1/run/user/1000/podman/podman.sock
```
This will add a remote connection to Podman and if it is the first connection added, it will mark the connection as the default. You can observe your connections with `podman-remote system connection list`:
@@ -83,7 +83,7 @@ This will add a remote connection to Podman and if it is the first connection ad
```
podman-remote system connection list
Name Identity URI
-myuser* id_rsa ssh://myuser@192.168.122.1/run/user/1000/podman/podman.sock
+myuser* id_ed25519 ssh://myuser@192.168.122.1/run/user/1000/podman/podman.sock
```
Now we can test the connection with `podman info`:
diff --git a/libpod/kube.go b/libpod/kube.go
index 351c49c9a..4e61b5377 100644
--- a/libpod/kube.go
+++ b/libpod/kube.go
@@ -79,7 +79,11 @@ func (p *Pod) GenerateForKube(ctx context.Context) (*v1.Pod, []v1.ServicePort, e
if err != nil {
return nil, servicePorts, err
}
- servicePorts = containerPortsToServicePorts(ports)
+ spState := newServicePortState()
+ servicePorts, err = spState.containerPortsToServicePorts(ports)
+ if err != nil {
+ return nil, servicePorts, err
+ }
hostNetwork = infraContainer.NetworkMode() == string(namespaces.NetworkMode(specgen.Host))
}
pod, err := p.podWithContainers(ctx, allContainers, ports, hostNetwork)
@@ -242,13 +246,17 @@ func ConvertV1PodToYAMLPod(pod *v1.Pod) *YAMLPod {
}
// GenerateKubeServiceFromV1Pod creates a v1 service object from a v1 pod object
-func GenerateKubeServiceFromV1Pod(pod *v1.Pod, servicePorts []v1.ServicePort) YAMLService {
+func GenerateKubeServiceFromV1Pod(pod *v1.Pod, servicePorts []v1.ServicePort) (YAMLService, error) {
service := YAMLService{}
selector := make(map[string]string)
selector["app"] = pod.Labels["app"]
ports := servicePorts
if len(ports) == 0 {
- ports = containersToServicePorts(pod.Spec.Containers)
+ p, err := containersToServicePorts(pod.Spec.Containers)
+ if err != nil {
+ return service, err
+ }
+ ports = p
}
serviceSpec := v1.ServiceSpec{
Ports: ports,
@@ -262,15 +270,43 @@ func GenerateKubeServiceFromV1Pod(pod *v1.Pod, servicePorts []v1.ServicePort) YA
APIVersion: pod.TypeMeta.APIVersion,
}
service.TypeMeta = tm
- return service
+ return service, nil
+}
+
+// servicePortState allows calling containerPortsToServicePorts for a single service
+type servicePortState struct {
+ // A program using the shared math/rand state with the default seed will produce the same sequence of pseudo-random numbers
+ // for each execution. Use a private RNG state not to interfere with other users.
+ rng *rand.Rand
+ usedPorts map[int]struct{}
+}
+
+func newServicePortState() servicePortState {
+ return servicePortState{
+ rng: rand.New(rand.NewSource(time.Now().UnixNano())),
+ usedPorts: map[int]struct{}{},
+ }
}
// containerPortsToServicePorts takes a slice of containerports and generates a
// slice of service ports
-func containerPortsToServicePorts(containerPorts []v1.ContainerPort) []v1.ServicePort {
+func (state *servicePortState) containerPortsToServicePorts(containerPorts []v1.ContainerPort) ([]v1.ServicePort, error) {
sps := make([]v1.ServicePort, 0, len(containerPorts))
for _, cp := range containerPorts {
- nodePort := 30000 + rand.Intn(32767-30000+1)
+ var nodePort int
+ attempt := 0
+ for {
+ // Legal nodeport range is 30000-32767
+ nodePort = 30000 + state.rng.Intn(32767-30000+1)
+ if _, found := state.usedPorts[nodePort]; !found {
+ state.usedPorts[nodePort] = struct{}{}
+ break
+ }
+ attempt++
+ if attempt >= 100 {
+ return nil, fmt.Errorf("too many attempts trying to generate a unique NodePort number")
+ }
+ }
servicePort := v1.ServicePort{
Protocol: cp.Protocol,
Port: cp.ContainerPort,
@@ -280,21 +316,22 @@ func containerPortsToServicePorts(containerPorts []v1.ContainerPort) []v1.Servic
}
sps = append(sps, servicePort)
}
- return sps
+ return sps, nil
}
// containersToServicePorts takes a slice of v1.Containers and generates an
// inclusive list of serviceports to expose
-func containersToServicePorts(containers []v1.Container) []v1.ServicePort {
- // Without the call to rand.Seed, a program will produce the same sequence of pseudo-random numbers
- // for each execution. Legal nodeport range is 30000-32767
- rand.Seed(time.Now().UnixNano())
-
+func containersToServicePorts(containers []v1.Container) ([]v1.ServicePort, error) {
+ state := newServicePortState()
sps := make([]v1.ServicePort, 0, len(containers))
for _, ctr := range containers {
- sps = append(sps, containerPortsToServicePorts(ctr.Ports)...)
+ ports, err := state.containerPortsToServicePorts(ctr.Ports)
+ if err != nil {
+ return nil, err
+ }
+ sps = append(sps, ports...)
}
- return sps
+ return sps, nil
}
func (p *Pod) podWithContainers(ctx context.Context, containers []*Container, ports []v1.ContainerPort, hostNetwork bool) (*v1.Pod, error) {
diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go
index 7d1214183..b734b9c95 100644
--- a/libpod/networking_linux.go
+++ b/libpod/networking_linux.go
@@ -322,17 +322,14 @@ func (r *RootlessNetNS) Do(toRun func() error) error {
// Cleanup the rootless network namespace if needed.
// It checks if we have running containers with the bridge network mode.
-// Cleanup() will try to lock RootlessNetNS, therefore you have to call
-// it with an unlocked lock.
+// Cleanup() expects that r.Lock is locked
func (r *RootlessNetNS) 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()
- running := func(c *Container) bool {
+ activeNetns := func(c *Container) bool {
// no bridge => no need to check
if !c.config.NetMode.IsBridge() {
return false
@@ -352,15 +349,18 @@ func (r *RootlessNetNS) Cleanup(runtime *Runtime) error {
return false
}
- state := c.state.State
- return state == define.ContainerStateRunning
+ // only check for an active netns, we cannot use the container state
+ // because not running does not mean that the netns does not need cleanup
+ // only if the netns is empty we know that we do not need cleanup
+ return c.state.NetNS != nil
}
- ctrs, err := runtime.GetContainersWithoutLock(running)
+ ctrs, err := runtime.GetContainersWithoutLock(activeNetns)
if err != nil {
return err
}
- // no cleanup if we found containers
- if len(ctrs) > 0 {
+ // no cleanup if we found no other containers with a netns
+ // we will always find one container (the container cleanup that is currently calling us)
+ if len(ctrs) > 1 {
return nil
}
logrus.Debug("Cleaning up rootless network namespace")
@@ -809,10 +809,10 @@ func (r *Runtime) teardownNetwork(ns string, opts types.NetworkOptions) error {
if rootlessNetNS != nil {
// execute the cni setup in the rootless net ns
err = rootlessNetNS.Do(tearDownPod)
- rootlessNetNS.Lock.Unlock()
- if err == nil {
- err = rootlessNetNS.Cleanup(r)
+ if cerr := rootlessNetNS.Cleanup(r); cerr != nil {
+ logrus.WithError(err).Error("failed to cleanup rootless netns")
}
+ rootlessNetNS.Lock.Unlock()
} else {
err = tearDownPod()
}
diff --git a/pkg/api/handlers/compat/images.go b/pkg/api/handlers/compat/images.go
index af8b6b63d..4533fddeb 100644
--- a/pkg/api/handlers/compat/images.go
+++ b/pkg/api/handlers/compat/images.go
@@ -409,14 +409,20 @@ func GetImages(w http.ResponseWriter, r *http.Request) {
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "Failed get images"))
return
}
- var summaries = make([]*entities.ImageSummary, len(images))
- for j, img := range images {
+
+ summaries := make([]*entities.ImageSummary, 0, len(images))
+ for _, img := range images {
+ // If the image is a manifest list, extract as much as we can.
+ if isML, _ := img.IsManifestList(r.Context()); isML {
+ continue
+ }
+
is, err := handlers.ImageToImageSummary(img)
if err != nil {
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "Failed transform image summaries"))
return
}
- summaries[j] = is
+ summaries = append(summaries, is)
}
utils.WriteResponse(w, http.StatusOK, summaries)
}
diff --git a/pkg/api/handlers/compat/images_push.go b/pkg/api/handlers/compat/images_push.go
index 5ecb429ae..3a84b5799 100644
--- a/pkg/api/handlers/compat/images_push.go
+++ b/pkg/api/handlers/compat/images_push.go
@@ -74,10 +74,16 @@ func PushImage(w http.ResponseWriter, r *http.Request) {
return
}
imageName = possiblyNormalizedName
- if _, _, err := runtime.LibimageRuntime().LookupImage(possiblyNormalizedName, nil); err != nil {
+ localImage, _, err := runtime.LibimageRuntime().LookupImage(possiblyNormalizedName, nil)
+ if err != nil {
utils.ImageNotFound(w, imageName, errors.Wrapf(err, "failed to find image %s", imageName))
return
}
+ rawManifest, _, err := localImage.Manifest(r.Context())
+ if err != nil {
+ utils.Error(w, "Something went wrong.", http.StatusBadRequest, err)
+ return
+ }
authconf, authfile, key, err := auth.GetCredentials(r)
if err != nil {
@@ -196,7 +202,7 @@ loop: // break out of for/select infinite loop
if tag == "" {
tag = "latest"
}
- report.Status = fmt.Sprintf("%s: digest: %s", tag, string(digestBytes))
+ report.Status = fmt.Sprintf("%s: digest: %s size: %d", tag, string(digestBytes), len(rawManifest))
if err := enc.Encode(report); err != nil {
logrus.Warnf("Failed to json encode error %q", err.Error())
}
diff --git a/pkg/bindings/images/build.go b/pkg/bindings/images/build.go
index 25770fdfc..be6e5ab55 100644
--- a/pkg/bindings/images/build.go
+++ b/pkg/bindings/images/build.go
@@ -346,6 +346,11 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
}
c = tmpFile.Name()
}
+ cfDir := filepath.Dir(c)
+ if absDir, err := filepath.EvalSymlinks(cfDir); err == nil {
+ name := filepath.ToSlash(strings.TrimPrefix(c, cfDir+string(filepath.Separator)))
+ c = filepath.Join(absDir, name)
+ }
containerfile, err := filepath.Abs(c)
if err != nil {
logrus.Errorf("Cannot find absolute path of %v: %v", c, err)
diff --git a/pkg/domain/infra/abi/generate.go b/pkg/domain/infra/abi/generate.go
index 0defa1923..68bb351bf 100644
--- a/pkg/domain/infra/abi/generate.go
+++ b/pkg/domain/infra/abi/generate.go
@@ -139,7 +139,11 @@ func (ic *ContainerEngine) GenerateKube(ctx context.Context, nameOrIDs []string,
podContent = append(podContent, b)
if options.Service {
- b, err := generateKubeYAML(libpod.GenerateKubeServiceFromV1Pod(po, []k8sAPI.ServicePort{}))
+ svc, err := libpod.GenerateKubeServiceFromV1Pod(po, []k8sAPI.ServicePort{})
+ if err != nil {
+ return nil, err
+ }
+ b, err := generateKubeYAML(svc)
if err != nil {
return nil, err
}
@@ -177,7 +181,11 @@ func getKubePods(ctx context.Context, pods []*libpod.Pod, getService bool) ([][]
pos = append(pos, b)
if getService {
- b, err := generateKubeYAML(libpod.GenerateKubeServiceFromV1Pod(po, sp))
+ svc, err := libpod.GenerateKubeServiceFromV1Pod(po, sp)
+ if err != nil {
+ return nil, nil, err
+ }
+ b, err := generateKubeYAML(svc)
if err != nil {
return nil, nil, err
}
diff --git a/pkg/domain/infra/abi/system.go b/pkg/domain/infra/abi/system.go
index 7da7754f2..e6c9d850b 100644
--- a/pkg/domain/infra/abi/system.go
+++ b/pkg/domain/infra/abi/system.go
@@ -365,9 +365,12 @@ 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
+ // Make sure to unlock, unshare can run for a long time.
rootlessNetNS.Lock.Unlock()
- defer rootlessNetNS.Cleanup(ic.Libpod)
+ // We do not want to cleanup the netns after unshare.
+ // The problem is that we cannot know if we need to cleanup and
+ // secondly unshare should allow user to setup the namespace with
+ // special things, e.g. potentially macvlan or something like that.
return rootlessNetNS.Do(unshare)
}
return unshare()
diff --git a/test/apiv2/10-images.at b/test/apiv2/10-images.at
index b7bcaf81d..e67f559f3 100644
--- a/test/apiv2/10-images.at
+++ b/test/apiv2/10-images.at
@@ -10,6 +10,13 @@ t GET libpod/images/json 200 \
.[0].Id~[0-9a-f]\\{64\\}
iid=$(jq -r '.[0].Id' <<<"$output")
+# Create an empty manifest and make sure it is not listed
+# in the compat endpoint.
+t GET images/json 200 length=1
+podman manifest create foo
+t GET images/json 200 length=1
+t GET libpod/images/json 200 length=2
+
t GET libpod/images/$iid/exists 204
t GET libpod/images/$PODMAN_TEST_IMAGE_NAME/exists 204
t GET libpod/images/${iid}abcdef/exists 404 \
diff --git a/test/e2e/build_test.go b/test/e2e/build_test.go
index 5e93f9078..9a9dec191 100644
--- a/test/e2e/build_test.go
+++ b/test/e2e/build_test.go
@@ -139,7 +139,7 @@ var _ = Describe("Podman build", func() {
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
// Check for two layers
- Expect(len(strings.Fields(session.OutputToString()))).To(Equal(2))
+ Expect(strings.Fields(session.OutputToString())).To(HaveLen(2))
session = podmanTest.Podman([]string{"build", "--pull-never", "-f", "build/squash/Dockerfile.squash-b", "--squash", "-t", "test-squash-b:latest", "build/squash"})
session.WaitWithDefaultTimeout()
@@ -149,7 +149,7 @@ var _ = Describe("Podman build", func() {
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
// Check for three layers
- Expect(len(strings.Fields(session.OutputToString()))).To(Equal(3))
+ Expect(strings.Fields(session.OutputToString())).To(HaveLen(3))
session = podmanTest.Podman([]string{"build", "--pull-never", "-f", "build/squash/Dockerfile.squash-c", "--squash", "-t", "test-squash-c:latest", "build/squash"})
session.WaitWithDefaultTimeout()
@@ -159,7 +159,7 @@ var _ = Describe("Podman build", func() {
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
// Check for two layers
- Expect(len(strings.Fields(session.OutputToString()))).To(Equal(2))
+ Expect(strings.Fields(session.OutputToString())).To(HaveLen(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()
@@ -169,7 +169,7 @@ var _ = Describe("Podman build", func() {
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
// Check for one layers
- Expect(len(strings.Fields(session.OutputToString()))).To(Equal(1))
+ Expect(strings.Fields(session.OutputToString())).To(HaveLen(1))
session = podmanTest.Podman([]string{"rm", "-a"})
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/checkpoint_test.go b/test/e2e/checkpoint_test.go
index 5a2640f33..064c82621 100644
--- a/test/e2e/checkpoint_test.go
+++ b/test/e2e/checkpoint_test.go
@@ -568,7 +568,7 @@ var _ = Describe("Podman checkpoint", func() {
Expect(result.OutputToString()).To(ContainSubstring("C /etc"))
Expect(result.OutputToString()).To(ContainSubstring("A /test.output"))
Expect(result.OutputToString()).To(ContainSubstring("D /etc/motd"))
- Expect(len(result.OutputToStringArray())).To(Equal(3))
+ Expect(result.OutputToStringArray()).To(HaveLen(3))
// Checkpoint the container
result = podmanTest.Podman([]string{"container", "checkpoint", cid, "-e", fileName})
@@ -599,7 +599,7 @@ var _ = Describe("Podman checkpoint", func() {
Expect(result.OutputToString()).To(ContainSubstring("C /etc"))
Expect(result.OutputToString()).To(ContainSubstring("A /test.output"))
Expect(result.OutputToString()).To(ContainSubstring("D /etc/motd"))
- Expect(len(result.OutputToStringArray())).To(Equal(3))
+ Expect(result.OutputToStringArray()).To(HaveLen(3))
// Remove exported checkpoint
os.Remove(fileName)
@@ -1280,7 +1280,7 @@ var _ = Describe("Podman checkpoint", func() {
err := json.Unmarshal([]byte(result.OutputToString()), cS)
Expect(err).ShouldNot(HaveOccurred())
- Expect(len(cS.ContainerStatistics)).To(Equal(2))
+ Expect(cS.ContainerStatistics).To(HaveLen(2))
Expect(cS.PodmanDuration).To(BeNumerically(">", cS.ContainerStatistics[0].RuntimeDuration))
Expect(cS.PodmanDuration).To(BeNumerically(">", cS.ContainerStatistics[1].RuntimeDuration))
Expect(cS.ContainerStatistics[0].RuntimeDuration).To(
@@ -1322,7 +1322,7 @@ var _ = Describe("Podman checkpoint", func() {
err = json.Unmarshal([]byte(result.OutputToString()), rS)
Expect(err).ShouldNot(HaveOccurred())
- Expect(len(cS.ContainerStatistics)).To(Equal(2))
+ Expect(cS.ContainerStatistics).To(HaveLen(2))
Expect(cS.PodmanDuration).To(BeNumerically(">", cS.ContainerStatistics[0].RuntimeDuration))
Expect(cS.PodmanDuration).To(BeNumerically(">", cS.ContainerStatistics[1].RuntimeDuration))
Expect(cS.ContainerStatistics[0].RuntimeDuration).To(
diff --git a/test/e2e/commit_test.go b/test/e2e/commit_test.go
index a09666468..d9411b146 100644
--- a/test/e2e/commit_test.go
+++ b/test/e2e/commit_test.go
@@ -146,8 +146,8 @@ var _ = Describe("Podman commit", func() {
check := podmanTest.Podman([]string{"inspect", "foobar.com/test1-image:latest"})
check.WaitWithDefaultTimeout()
data := check.InspectImageJSON()
- Expect(len(data)).To(Equal(1))
- Expect(len(data[0].Config.Entrypoint)).To(Equal(2))
+ Expect(data).To(HaveLen(1))
+ Expect(data[0].Config.Entrypoint).To(HaveLen(2))
Expect(data[0].Config.Entrypoint[0]).To(Equal("foo"))
Expect(data[0].Config.Entrypoint[1]).To(Equal("bar=baz"))
})
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index 63cb4f091..a411a860b 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -36,7 +36,6 @@ var (
PODMAN_BINARY string //nolint:golint,stylecheck
INTEGRATION_ROOT string //nolint:golint,stylecheck
CGROUP_MANAGER = "systemd" //nolint:golint,stylecheck
- ARTIFACT_DIR = "/tmp/.artifacts" //nolint:golint,stylecheck
RESTORE_IMAGES = []string{ALPINE, BB, nginx} //nolint:golint,stylecheck
defaultWaitTimeout = 90
CGROUPSV2, _ = cgroups.IsCgroup2UnifiedMode() //nolint:golint,stylecheck
@@ -46,7 +45,7 @@ var (
type PodmanTestIntegration struct {
PodmanTest
ConmonBinary string
- CrioRoot string
+ Root string
CNIConfigDir string
OCIRuntime string
RunRoot string
@@ -111,13 +110,6 @@ var _ = SynchronizedBeforeSuite(func() []byte {
cwd, _ := os.Getwd()
INTEGRATION_ROOT = filepath.Join(cwd, "../../")
podman := PodmanTestSetup("/tmp")
- podman.ArtifactPath = ARTIFACT_DIR
- if _, err := os.Stat(ARTIFACT_DIR); os.IsNotExist(err) {
- if err = os.Mkdir(ARTIFACT_DIR, 0777); err != nil {
- fmt.Printf("%q\n", err)
- os.Exit(1)
- }
- }
// Pull cirros but don't put it into the cache
pullImages := []string{cirros, fedoraToolbox, volumeTest}
@@ -130,7 +122,7 @@ var _ = SynchronizedBeforeSuite(func() []byte {
fmt.Printf("%q\n", err)
os.Exit(1)
}
- podman.CrioRoot = ImageCacheDir
+ podman.Root = ImageCacheDir
// If running localized tests, the cache dir is created and populated. if the
// tests are remote, this is a no-op
populateCache(podman)
@@ -170,7 +162,6 @@ var _ = SynchronizedBeforeSuite(func() []byte {
func (p *PodmanTestIntegration) Setup() {
cwd, _ := os.Getwd()
INTEGRATION_ROOT = filepath.Join(cwd, "../../")
- p.ArtifactPath = ARTIFACT_DIR
}
var _ = SynchronizedAfterSuite(func() {},
@@ -181,14 +172,14 @@ var _ = SynchronizedAfterSuite(func() {},
fmt.Printf("%s\t\t%f\n", result.name, result.length)
}
- // previous crio-run
+ // previous runroot
tempdir, err := CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
}
podmanTest := PodmanTestCreate(tempdir)
- if err := os.RemoveAll(podmanTest.CrioRoot); err != nil {
+ if err := os.RemoveAll(podmanTest.Root); err != nil {
fmt.Printf("%q\n", err)
}
@@ -265,18 +256,17 @@ func PodmanTestCreateUtil(tempDir string, remote bool) *PodmanTestIntegration {
PodmanTest: PodmanTest{
PodmanBinary: podmanBinary,
RemotePodmanBinary: podmanRemoteBinary,
- ArtifactPath: ARTIFACT_DIR,
TempDir: tempDir,
RemoteTest: remote,
ImageCacheFS: storageFs,
ImageCacheDir: ImageCacheDir,
},
ConmonBinary: conmonBinary,
- CrioRoot: filepath.Join(tempDir, "crio"),
+ Root: filepath.Join(tempDir, "root"),
TmpDir: tempDir,
CNIConfigDir: CNIConfigDir,
OCIRuntime: ociRuntime,
- RunRoot: filepath.Join(tempDir, "crio-run"),
+ RunRoot: filepath.Join(tempDir, "runroot"),
StorageOptions: storageOptions,
SignaturePolicyPath: filepath.Join(INTEGRATION_ROOT, "test/policy.json"),
CgroupManager: cgroupManager,
@@ -308,15 +298,29 @@ func (p PodmanTestIntegration) AddImageToRWStore(image string) {
}
}
-// createArtifact creates a cached image in the artifact dir
+func imageTarPath(image string) string {
+ cacheDir := os.Getenv("PODMAN_TEST_IMAGE_CACHE_DIR")
+ if cacheDir == "" {
+ cacheDir = os.Getenv("TMPDIR")
+ if cacheDir == "" {
+ cacheDir = "/tmp"
+ }
+ }
+
+ // e.g., registry.com/fubar:latest -> registry.com-fubar-latest.tar
+ imageCacheName := strings.Replace(strings.Replace(image, ":", "-", -1), "/", "-", -1) + ".tar"
+
+ return filepath.Join(cacheDir, imageCacheName)
+}
+
+// createArtifact creates a cached image tarball in a local directory
func (p *PodmanTestIntegration) createArtifact(image string) {
if os.Getenv("NO_TEST_CACHE") != "" {
return
}
- dest := strings.Split(image, "/")
- destName := fmt.Sprintf("/tmp/%s.tar", strings.Replace(strings.Join(strings.Split(dest[len(dest)-1], "/"), ""), ":", "-", -1))
- fmt.Printf("Caching %s at %s...\n", image, destName)
+ destName := imageTarPath(image)
if _, err := os.Stat(destName); os.IsNotExist(err) {
+ fmt.Printf("Caching %s at %s...\n", image, destName)
pull := p.PodmanNoCache([]string{"pull", image})
pull.Wait(440)
Expect(pull).Should(Exit(0))
@@ -326,7 +330,7 @@ func (p *PodmanTestIntegration) createArtifact(image string) {
Expect(save).Should(Exit(0))
fmt.Printf("\n")
} else {
- fmt.Printf(" already exists.\n")
+ fmt.Printf("[image already cached: %s]\n", destName)
}
}
@@ -738,12 +742,13 @@ func (p *PodmanTestIntegration) RestartRemoteService() {
// RestoreArtifactToCache populates the imagecache from tarballs that were cached earlier
func (p *PodmanTestIntegration) RestoreArtifactToCache(image string) error {
- fmt.Printf("Restoring %s...\n", image)
- dest := strings.Split(image, "/")
- destName := fmt.Sprintf("/tmp/%s.tar", strings.Replace(strings.Join(strings.Split(dest[len(dest)-1], "/"), ""), ":", "-", -1))
- p.CrioRoot = p.ImageCacheDir
- restore := p.PodmanNoEvents([]string{"load", "-q", "-i", destName})
- restore.WaitWithDefaultTimeout()
+ tarball := imageTarPath(image)
+ if _, err := os.Stat(tarball); err == nil {
+ fmt.Printf("Restoring %s...\n", image)
+ p.Root = p.ImageCacheDir
+ restore := p.PodmanNoEvents([]string{"load", "-q", "-i", tarball})
+ restore.WaitWithDefaultTimeout()
+ }
return nil
}
@@ -795,7 +800,7 @@ func (p *PodmanTestIntegration) makeOptions(args []string, noEvents, noCache boo
}
podmanOptions := strings.Split(fmt.Sprintf("%s--root %s --runroot %s --runtime %s --conmon %s --cni-config-dir %s --cgroup-manager %s --tmpdir %s --events-backend %s",
- debug, p.CrioRoot, p.RunRoot, p.OCIRuntime, p.ConmonBinary, p.CNIConfigDir, p.CgroupManager, p.TmpDir, eventsType), " ")
+ debug, p.Root, p.RunRoot, p.OCIRuntime, p.ConmonBinary, p.CNIConfigDir, p.CgroupManager, p.TmpDir, eventsType), " ")
if os.Getenv("HOOK_OPTION") != "" {
podmanOptions = append(podmanOptions, os.Getenv("HOOK_OPTION"))
}
diff --git a/test/e2e/container_create_volume_test.go b/test/e2e/container_create_volume_test.go
index 0dac96a5e..df1d9a371 100644
--- a/test/e2e/container_create_volume_test.go
+++ b/test/e2e/container_create_volume_test.go
@@ -45,8 +45,8 @@ func checkDataVolumeContainer(pTest *PodmanTestIntegration, image, cont, dest, d
Expect(create).Should(Exit(0))
inspect := pTest.InspectContainer(cont)
- Expect(len(inspect)).To(Equal(1))
- Expect(len(inspect[0].Mounts)).To(Equal(1))
+ Expect(inspect).To(HaveLen(1))
+ Expect(inspect[0].Mounts).To(HaveLen(1))
Expect(inspect[0].Mounts[0].Destination).To(Equal(dest))
mntName, mntSource := inspect[0].Mounts[0].Name, inspect[0].Mounts[0].Source
@@ -54,7 +54,7 @@ func checkDataVolumeContainer(pTest *PodmanTestIntegration, image, cont, dest, d
volList := pTest.Podman([]string{"volume", "list", "--quiet"})
volList.WaitWithDefaultTimeout()
Expect(volList).Should(Exit(0))
- Expect(len(volList.OutputToStringArray())).To(Equal(1))
+ Expect(volList.OutputToStringArray()).To(HaveLen(1))
Expect(volList.OutputToStringArray()[0]).To(Equal(mntName))
// Check the mount source directory
@@ -62,9 +62,9 @@ func checkDataVolumeContainer(pTest *PodmanTestIntegration, image, cont, dest, d
Expect(err).To(BeNil())
if data == "" {
- Expect(len(files)).To(Equal(0))
+ Expect(files).To(BeEmpty())
} else {
- Expect(len(files)).To(Equal(1))
+ Expect(files).To(HaveLen(1))
Expect(files[0].Name()).To(Equal(data))
}
}
diff --git a/test/e2e/create_test.go b/test/e2e/create_test.go
index 321361382..9126303cd 100644
--- a/test/e2e/create_test.go
+++ b/test/e2e/create_test.go
@@ -279,8 +279,8 @@ var _ = Describe("Podman create", func() {
Expect(create).Should(Exit(0))
ctrJSON := podmanTest.InspectContainer(name)
- Expect(len(ctrJSON)).To(Equal(1))
- Expect(len(ctrJSON[0].Config.Cmd)).To(Equal(1))
+ Expect(ctrJSON).To(HaveLen(1))
+ Expect(ctrJSON[0].Config.Cmd).To(HaveLen(1))
Expect(ctrJSON[0].Config.Cmd[0]).To(Equal("redis-server"))
Expect(ctrJSON[0].Config.Entrypoint).To(Equal("docker-entrypoint.sh"))
})
@@ -382,8 +382,8 @@ var _ = Describe("Podman create", func() {
inspect := podmanTest.Podman([]string{"inspect", ctrName})
inspect.WaitWithDefaultTimeout()
data := inspect.InspectContainerToJSON()
- Expect(len(data)).To(Equal(1), "len(InspectContainerToJSON)")
- Expect(len(data[0].Config.Labels)).To(Equal(2))
+ Expect(data).To(HaveLen(1), "len(InspectContainerToJSON)")
+ Expect(data[0].Config.Labels).To(HaveLen(2))
Expect(data[0].Config.Labels).To(HaveKey("TESTKEY1"))
Expect(data[0].Config.Labels).To(HaveKey("TESTKEY2"))
})
@@ -398,8 +398,8 @@ var _ = Describe("Podman create", func() {
inspect := podmanTest.Podman([]string{"inspect", ctrName})
inspect.WaitWithDefaultTimeout()
data := inspect.InspectContainerToJSON()
- Expect(len(data)).To(Equal(1))
- Expect(len(data[0].Config.Labels)).To(Equal(2))
+ Expect(data).To(HaveLen(1))
+ Expect(data[0].Config.Labels).To(HaveLen(2))
Expect(data[0].Config.Labels).To(HaveKeyWithValue("TESTKEY1", "value1"))
Expect(data[0].Config.Labels).To(HaveKeyWithValue("TESTKEY2", "bar"))
})
@@ -413,7 +413,7 @@ var _ = Describe("Podman create", func() {
inspect := podmanTest.Podman([]string{"inspect", ctrName})
inspect.WaitWithDefaultTimeout()
data := inspect.InspectContainerToJSON()
- Expect(len(data)).To(Equal(1))
+ Expect(data).To(HaveLen(1))
Expect(data[0].HostConfig.RestartPolicy.Name).To(Equal("on-failure"))
Expect(data[0].HostConfig.RestartPolicy.MaximumRetryCount).To(Equal(uint(5)))
})
@@ -434,7 +434,7 @@ var _ = Describe("Podman create", func() {
inspect := podmanTest.Podman([]string{"inspect", ctrName})
inspect.WaitWithDefaultTimeout()
data := inspect.InspectContainerToJSON()
- Expect(len(data)).To(Equal(1))
+ Expect(data).To(HaveLen(1))
Expect(data[0].HostConfig.RestartPolicy.Name).To(Equal(unlessStopped))
})
@@ -448,7 +448,7 @@ var _ = Describe("Podman create", func() {
inspect := podmanTest.Podman([]string{"inspect", ctrName})
inspect.WaitWithDefaultTimeout()
data := inspect.InspectContainerToJSON()
- Expect(len(data)).To(Equal(1))
+ Expect(data).To(HaveLen(1))
Expect(data[0].HostConfig.MemorySwap).To(Equal(int64(2 * numMem)))
})
@@ -463,7 +463,7 @@ var _ = Describe("Podman create", func() {
inspect := podmanTest.Podman([]string{"inspect", ctrName})
inspect.WaitWithDefaultTimeout()
data := inspect.InspectContainerToJSON()
- Expect(len(data)).To(Equal(1))
+ Expect(data).To(HaveLen(1))
Expect(data[0].HostConfig.NanoCpus).To(Equal(int64(nanoCPUs)))
})
@@ -491,7 +491,7 @@ var _ = Describe("Podman create", func() {
inspect := podmanTest.Podman([]string{"inspect", ctrName})
inspect.WaitWithDefaultTimeout()
data := inspect.InspectContainerToJSON()
- Expect(len(data)).To(Equal(1))
+ Expect(data).To(HaveLen(1))
Expect(data[0].Config.StopSignal).To(Equal(uint(15)))
})
@@ -509,7 +509,7 @@ var _ = Describe("Podman create", func() {
inspect := podmanTest.Podman([]string{"inspect", "zone"})
inspect.WaitWithDefaultTimeout()
data := inspect.InspectContainerToJSON()
- Expect(len(data)).To(Equal(1))
+ Expect(data).To(HaveLen(1))
Expect(data[0].Config.Timezone).To(Equal("Pacific/Honolulu"))
session = podmanTest.Podman([]string{"create", "--tz", "local", "--name", "lcl", ALPINE, "date"})
@@ -517,7 +517,7 @@ var _ = Describe("Podman create", func() {
inspect = podmanTest.Podman([]string{"inspect", "lcl"})
inspect.WaitWithDefaultTimeout()
data = inspect.InspectContainerToJSON()
- Expect(len(data)).To(Equal(1))
+ Expect(data).To(HaveLen(1))
Expect(data[0].Config.Timezone).To(Equal("local"))
})
@@ -531,7 +531,7 @@ var _ = Describe("Podman create", func() {
inspect := podmanTest.Podman([]string{"inspect", "default"})
inspect.WaitWithDefaultTimeout()
data := inspect.InspectContainerToJSON()
- Expect(len(data)).To(Equal(1))
+ Expect(data).To(HaveLen(1))
Expect(data[0].Config.Umask).To(Equal("0022"))
session = podmanTest.Podman([]string{"create", "--umask", "0002", "--name", "umask", ALPINE})
@@ -539,7 +539,7 @@ var _ = Describe("Podman create", func() {
inspect = podmanTest.Podman([]string{"inspect", "umask"})
inspect.WaitWithDefaultTimeout()
data = inspect.InspectContainerToJSON()
- Expect(len(data)).To(Equal(1))
+ Expect(data).To(HaveLen(1))
Expect(data[0].Config.Umask).To(Equal("0002"))
session = podmanTest.Podman([]string{"create", "--umask", "0077", "--name", "fedora", fedoraMinimal})
@@ -547,7 +547,7 @@ var _ = Describe("Podman create", func() {
inspect = podmanTest.Podman([]string{"inspect", "fedora"})
inspect.WaitWithDefaultTimeout()
data = inspect.InspectContainerToJSON()
- Expect(len(data)).To(Equal(1))
+ Expect(data).To(HaveLen(1))
Expect(data[0].Config.Umask).To(Equal("0077"))
session = podmanTest.Podman([]string{"create", "--umask", "22", "--name", "umask-short", ALPINE})
@@ -555,7 +555,7 @@ var _ = Describe("Podman create", func() {
inspect = podmanTest.Podman([]string{"inspect", "umask-short"})
inspect.WaitWithDefaultTimeout()
data = inspect.InspectContainerToJSON()
- Expect(len(data)).To(Equal(1))
+ Expect(data).To(HaveLen(1))
Expect(data[0].Config.Umask).To(Equal("0022"))
session = podmanTest.Podman([]string{"create", "--umask", "9999", "--name", "bad", ALPINE})
@@ -689,7 +689,7 @@ var _ = Describe("Podman create", func() {
Expect(setup).Should(Exit(0))
idata := setup.InspectImageJSON() // returns []inspect.ImageData
- Expect(len(idata)).To(Equal(1))
+ Expect(idata).To(HaveLen(1))
Expect(idata[0].Os).To(Equal(runtime.GOOS))
Expect(idata[0].Architecture).To(Equal("arm64"))
})
diff --git a/test/e2e/diff_test.go b/test/e2e/diff_test.go
index 80647c6f5..a872a9713 100644
--- a/test/e2e/diff_test.go
+++ b/test/e2e/diff_test.go
@@ -120,13 +120,13 @@ RUN echo test
session := podmanTest.Podman([]string{"image", "diff", image})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(BeNumerically("==", 1))
+ Expect(session.OutputToStringArray()).To(HaveLen(1))
Expect(session.OutputToString()).To(Equal("A " + file3))
session = podmanTest.Podman([]string{"image", "diff", image, baseImage})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(BeNumerically("==", 4))
+ Expect(session.OutputToStringArray()).To(HaveLen(4))
Expect(session.OutputToString()).To(ContainSubstring("A " + file1))
Expect(session.OutputToString()).To(ContainSubstring("A " + file2))
Expect(session.OutputToString()).To(ContainSubstring("A " + file3))
@@ -149,7 +149,7 @@ RUN echo test
session := podmanTest.Podman([]string{"image", "diff", ALPINE, ALPINE})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(BeNumerically("==", 0))
+ Expect(session.OutputToStringArray()).To(BeEmpty())
})
It("podman diff container and image with same name", func() {
@@ -172,20 +172,20 @@ RUN touch %s`, ALPINE, imagefile)
session = podmanTest.Podman([]string{"diff", name})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(BeNumerically("==", 2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
Expect(session.OutputToString()).To(ContainSubstring(imagefile))
session = podmanTest.Podman([]string{"image", "diff", name})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(BeNumerically("==", 2))
+ Expect(session.OutputToStringArray()).To(HaveLen(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).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(BeNumerically("==", 2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
Expect(session.OutputToString()).To(ContainSubstring(confile))
})
diff --git a/test/e2e/events_test.go b/test/e2e/events_test.go
index 2b9b0f575..39f495460 100644
--- a/test/e2e/events_test.go
+++ b/test/e2e/events_test.go
@@ -74,7 +74,7 @@ var _ = Describe("Podman events", func() {
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
events := result.OutputToStringArray()
- Expect(len(events)).To(Equal(1), "number of events")
+ Expect(events).To(HaveLen(1), "number of events")
Expect(events[0]).To(ContainSubstring(cid), "event log includes CID")
Expect(events[0]).To(Not(ContainSubstring(cid2)), "event log does not include second CID")
})
@@ -86,7 +86,7 @@ var _ = Describe("Podman events", func() {
result := podmanTest.Podman([]string{"events", "--stream=false", "--filter", "type=pod", "--filter", fmt.Sprintf("container=%s", cid)})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
- Expect(len(result.OutputToStringArray())).To(Equal(0))
+ Expect(result.OutputToStringArray()).To(BeEmpty())
})
It("podman events with a type", func() {
diff --git a/test/e2e/exec_test.go b/test/e2e/exec_test.go
index 65d60b24d..121d0b234 100644
--- a/test/e2e/exec_test.go
+++ b/test/e2e/exec_test.go
@@ -527,8 +527,8 @@ RUN useradd -u 1000 auser`, fedoraMinimal)
Expect(ctr).Should(Exit(0))
data := podmanTest.InspectContainer(ctrName)
- Expect(len(data)).To(Equal(1))
- Expect(len(data[0].ExecIDs)).To(Equal(1))
+ Expect(data).To(HaveLen(1))
+ Expect(data[0].ExecIDs).To(HaveLen(1))
Expect(exec1.OutputToString()).To(ContainSubstring(data[0].ExecIDs[0]))
exec2 := podmanTest.Podman([]string{"exec", "-t", "-i", ctrName, "ps", "-a"})
diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go
index 735334eec..cfa264de2 100644
--- a/test/e2e/generate_kube_test.go
+++ b/test/e2e/generate_kube_test.go
@@ -137,12 +137,12 @@ var _ = Describe("Podman generate kube", func() {
// Separate out the Service and Pod yaml
arr := strings.Split(string(kube.Out.Contents()), "---")
- Expect(len(arr)).To(Equal(2))
+ Expect(arr).To(HaveLen(2))
svc := new(v1.Service)
err := yaml.Unmarshal([]byte(arr[0]), svc)
Expect(err).To(BeNil())
- Expect(len(svc.Spec.Ports)).To(Equal(1))
+ Expect(svc.Spec.Ports).To(HaveLen(1))
Expect(svc.Spec.Ports[0].TargetPort.IntValue()).To(Equal(3890))
pod := new(v1.Pod)
@@ -324,7 +324,7 @@ var _ = Describe("Podman generate kube", func() {
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.Out.Contents(), pod)
Expect(err).To(BeNil())
- Expect(len(pod.Spec.HostAliases)).To(Equal(2))
+ Expect(pod.Spec.HostAliases).To(HaveLen(2))
Expect(pod.Spec.HostAliases[0].IP).To(Equal(testIP))
Expect(pod.Spec.HostAliases[1].IP).To(Equal(testIP))
})
@@ -340,12 +340,12 @@ var _ = Describe("Podman generate kube", func() {
// Separate out the Service and Pod yaml
arr := strings.Split(string(kube.Out.Contents()), "---")
- Expect(len(arr)).To(Equal(2))
+ Expect(arr).To(HaveLen(2))
svc := new(v1.Service)
err := yaml.Unmarshal([]byte(arr[0]), svc)
Expect(err).To(BeNil())
- Expect(len(svc.Spec.Ports)).To(Equal(1))
+ Expect(svc.Spec.Ports).To(HaveLen(1))
Expect(svc.Spec.Ports[0].TargetPort.IntValue()).To(Equal(4000))
Expect(svc.Spec.Ports[0].Protocol).To(Equal(v1.ProtocolUDP))
@@ -504,8 +504,8 @@ var _ = Describe("Podman generate kube", func() {
Expect(err).To(BeNil())
containers := pod.Spec.Containers
- Expect(len(containers)).To(Equal(1))
- Expect(len(containers[0].Ports)).To(Equal(1))
+ Expect(containers).To(HaveLen(1))
+ Expect(containers[0].Ports).To(HaveLen(1))
Expect(containers[0].Ports[0].Protocol).To(Equal(v1.ProtocolUDP))
})
@@ -641,7 +641,7 @@ var _ = Describe("Podman generate kube", func() {
err := yaml.Unmarshal(kube.Out.Contents(), pod)
Expect(err).To(BeNil())
- Expect(len(pod.Spec.Volumes)).To(Equal(2))
+ Expect(pod.Spec.Volumes).To(HaveLen(2))
})
@@ -839,7 +839,7 @@ var _ = Describe("Podman generate kube", func() {
Expect(err).To(BeNil())
containers := pod.Spec.Containers
- Expect(len(containers)).To(Equal(1))
+ Expect(containers).To(HaveLen(1))
Expect(containers[0].Command).To(Equal([]string{"/bin/sleep"}))
Expect(containers[0].Args).To(Equal([]string{"10s"}))
@@ -861,8 +861,8 @@ var _ = Describe("Podman generate kube", func() {
Expect(err).To(BeNil())
containers := pod.Spec.Containers
- Expect(len(containers)).To(Equal(1))
- Expect(len(containers[0].Command)).To(Equal(0))
+ Expect(containers).To(HaveLen(1))
+ Expect(containers[0].Command).To(BeEmpty())
cmd := []string{"echo", "hi"}
session = podmanTest.Podman(append([]string{"create", "--name", "test1", ALPINE}, cmd...))
@@ -880,7 +880,7 @@ var _ = Describe("Podman generate kube", func() {
Expect(err).To(BeNil())
containers = pod.Spec.Containers
- Expect(len(containers)).To(Equal(1))
+ Expect(containers).To(HaveLen(1))
Expect(containers[0].Command).To(Equal(cmd))
})
@@ -915,7 +915,7 @@ ENTRYPOINT ["sleep"]`
Expect(err).To(BeNil())
containers := pod.Spec.Containers
- Expect(len(containers)).To(Equal(1))
+ Expect(containers).To(HaveLen(1))
Expect(containers[0].Args).To(Equal([]string{"10s"}))
session = podmanTest.Podman([]string{"create", "--pod", "new:testpod-2", "--entrypoint", "echo", image, "hello"})
@@ -933,7 +933,7 @@ ENTRYPOINT ["sleep"]`
Expect(err).To(BeNil())
containers = pod.Spec.Containers
- Expect(len(containers)).To(Equal(1))
+ Expect(containers).To(HaveLen(1))
Expect(containers[0].Command).To(Equal([]string{"echo"}))
Expect(containers[0].Args).To(Equal([]string{"hello"}))
})
@@ -953,7 +953,7 @@ ENTRYPOINT ["sleep"]`
Expect(err).To(BeNil())
containers := pod.Spec.Containers
- Expect(len(containers)).To(Equal(1))
+ Expect(containers).To(HaveLen(1))
Expect(containers[0].SecurityContext.Capabilities).To(BeNil())
// Now make sure we can also `play` it.
diff --git a/test/e2e/healthcheck_run_test.go b/test/e2e/healthcheck_run_test.go
index c9a6f926f..6e4dc5bbf 100644
--- a/test/e2e/healthcheck_run_test.go
+++ b/test/e2e/healthcheck_run_test.go
@@ -239,7 +239,7 @@ var _ = Describe("Podman healthcheck run", func() {
ps := podmanTest.Podman([]string{"ps", "--filter", "health=healthy"})
ps.WaitWithDefaultTimeout()
Expect(ps).Should(Exit(0))
- Expect(len(ps.OutputToStringArray())).To(Equal(2))
+ Expect(ps.OutputToStringArray()).To(HaveLen(2))
Expect(ps.OutputToString()).To(ContainSubstring("hc"))
})
})
diff --git a/test/e2e/history_test.go b/test/e2e/history_test.go
index 1f8faa6c2..c6e9579ae 100644
--- a/test/e2e/history_test.go
+++ b/test/e2e/history_test.go
@@ -73,7 +73,7 @@ var _ = Describe("Podman history", func() {
lines := session.OutputToStringArray()
Expect(len(lines)).To(BeNumerically(">", 0))
// the image id must be 64 chars long
- Expect(len(lines[0])).To(BeNumerically("==", 64))
+ Expect(lines[0]).To(HaveLen(64))
session = podmanTest.Podman([]string{"history", "--no-trunc", "--format", "{{.CreatedBy}}", ALPINE})
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/image_scp_test.go b/test/e2e/image_scp_test.go
index 6c6c85bc3..6651a04b5 100644
--- a/test/e2e/image_scp_test.go
+++ b/test/e2e/image_scp_test.go
@@ -109,7 +109,7 @@ var _ = Describe("podman image scp", func() {
cfg, err := config.ReadCustomConfig()
Expect(err).ShouldNot(HaveOccurred())
Expect(cfg.Engine.ActiveService).To(Equal("QA"))
- Expect(cfg.Engine.ServiceDestinations["QA"]).To(Equal(
+ Expect(cfg.Engine.ServiceDestinations).To(HaveKeyWithValue("QA",
config.Destination{
URI: "ssh://root@server.fubar.com:2222/run/podman/podman.sock",
},
diff --git a/test/e2e/images_test.go b/test/e2e/images_test.go
index 9cc04e6b0..efa9f399b 100644
--- a/test/e2e/images_test.go
+++ b/test/e2e/images_test.go
@@ -78,7 +78,7 @@ var _ = Describe("Podman images", func() {
session = podmanTest.Podman([]string{"images", "-qn"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(BeNumerically("==", len(CACHE_IMAGES)))
+ Expect(session.OutputToStringArray()).To(HaveLen(len(CACHE_IMAGES)))
})
It("podman images with digests", func() {
@@ -125,7 +125,7 @@ var _ = Describe("Podman images", func() {
session := podmanTest.Podman([]string{"images", "-q", ALPINE})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(1))
+ Expect(session.OutputToStringArray()).To(HaveLen(1))
session = podmanTest.Podman([]string{"tag", ALPINE, "foo:a"})
session.WaitWithDefaultTimeout()
@@ -137,31 +137,31 @@ var _ = Describe("Podman images", func() {
session = podmanTest.Podman([]string{"images", "-q", "foo"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
})
It("podman images filter reference", func() {
result := podmanTest.Podman([]string{"images", "-q", "-f", "reference=quay.io*"})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
- Expect(len(result.OutputToStringArray())).To(Equal(7))
+ Expect(result.OutputToStringArray()).To(HaveLen(7))
retalpine := podmanTest.Podman([]string{"images", "-f", "reference=a*pine"})
retalpine.WaitWithDefaultTimeout()
Expect(retalpine).Should(Exit(0))
- Expect(len(retalpine.OutputToStringArray())).To(Equal(6))
+ Expect(retalpine.OutputToStringArray()).To(HaveLen(6))
Expect(retalpine.OutputToString()).To(ContainSubstring("alpine"))
retalpine = podmanTest.Podman([]string{"images", "-f", "reference=alpine"})
retalpine.WaitWithDefaultTimeout()
Expect(retalpine).Should(Exit(0))
- Expect(len(retalpine.OutputToStringArray())).To(Equal(6))
+ Expect(retalpine.OutputToStringArray()).To(HaveLen(6))
Expect(retalpine.OutputToString()).To(ContainSubstring("alpine"))
retnone := podmanTest.Podman([]string{"images", "-q", "-f", "reference=bogus"})
retnone.WaitWithDefaultTimeout()
Expect(retnone).Should(Exit(0))
- Expect(len(retnone.OutputToStringArray())).To(Equal(0))
+ Expect(retnone.OutputToStringArray()).To(BeEmpty())
})
It("podman images filter before image", func() {
@@ -172,8 +172,7 @@ RUN apk update && apk add strace
result := podmanTest.Podman([]string{"images", "-q", "-f", "before=foobar.com/before:latest"})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
- Expect(len(result.OutputToStringArray()) >= 1).To(BeTrue())
-
+ Expect(len(result.OutputToStringArray())).To(BeNumerically(">=", 1))
})
It("podman images workingdir from image", func() {
@@ -194,7 +193,7 @@ WORKDIR /test
result := podmanTest.Podman([]string{"images", "-q", "-f", "since=quay.io/libpod/alpine:latest"})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
- Expect(len(result.OutputToStringArray())).To(Equal(9))
+ Expect(result.OutputToStringArray()).To(HaveLen(9))
})
It("podman image list filter after image", func() {
@@ -326,12 +325,12 @@ ENV foo=bar
session := podmanTest.Podman([]string{"images"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(len(CACHE_IMAGES) + 2))
+ Expect(session.OutputToStringArray()).To(HaveLen(len(CACHE_IMAGES) + 2))
session2 := podmanTest.Podman([]string{"images", "--all"})
session2.WaitWithDefaultTimeout()
Expect(session2).Should(Exit(0))
- Expect(len(session2.OutputToStringArray())).To(Equal(len(CACHE_IMAGES) + 4))
+ Expect(session2.OutputToStringArray()).To(HaveLen(len(CACHE_IMAGES) + 4))
})
It("podman images filter by label", func() {
@@ -343,7 +342,7 @@ LABEL "com.example.vendor"="Example Vendor"
session := podmanTest.Podman([]string{"images", "-f", "label=version=1.0"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
})
It("podman with images with no layers", func() {
@@ -380,7 +379,7 @@ LABEL "com.example.vendor"="Example Vendor"
session = podmanTest.Podman([]string{"history", "--quiet", "foo"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(6))
+ Expect(session.OutputToStringArray()).To(HaveLen(6))
session = podmanTest.Podman([]string{"image", "list", "foo"})
session.WaitWithDefaultTimeout()
@@ -437,11 +436,11 @@ RUN > file2
result := podmanTest.Podman([]string{"image", "prune", "--filter", "label=abc", "--force"})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
- Expect(len(result.OutputToStringArray())).To(Equal(1))
+ Expect(result.OutputToStringArray()).To(HaveLen(1))
//check if really abc is removed
result = podmanTest.Podman([]string{"image", "list", "--filter", "label=abc"})
- Expect(len(result.OutputToStringArray())).To(Equal(0))
+ Expect(result.OutputToStringArray()).To(BeEmpty())
})
@@ -458,11 +457,11 @@ RUN > file2
result := podmanTest.Podman([]string{"builder", "prune", "--filter", "label=abc", "--force"})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
- Expect(len(result.OutputToStringArray())).To(Equal(1))
+ Expect(result.OutputToStringArray()).To(HaveLen(1))
//check if really abc is removed
result = podmanTest.Podman([]string{"image", "list", "--filter", "label=abc"})
- Expect(len(result.OutputToStringArray())).To(Equal(0))
+ Expect(result.OutputToStringArray()).To(BeEmpty())
})
diff --git a/test/e2e/inspect_test.go b/test/e2e/inspect_test.go
index 0f0237adc..127e26b11 100644
--- a/test/e2e/inspect_test.go
+++ b/test/e2e/inspect_test.go
@@ -113,7 +113,7 @@ var _ = Describe("Podman inspect", func() {
result := podmanTest.Podman([]string{"inspect", "--format={{.ID}}", cid, ALPINE})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
- Expect(len(result.OutputToStringArray())).To(Equal(2))
+ Expect(result.OutputToStringArray()).To(HaveLen(2))
})
It("podman inspect container and filter for Image{ID}", func() {
@@ -124,12 +124,12 @@ var _ = Describe("Podman inspect", func() {
result := podmanTest.Podman([]string{"inspect", "--format={{.ImageID}}", cid})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
- Expect(len(result.OutputToStringArray())).To(Equal(1))
+ Expect(result.OutputToStringArray()).To(HaveLen(1))
result = podmanTest.Podman([]string{"inspect", "--format={{.Image}}", cid})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
- Expect(len(result.OutputToStringArray())).To(Equal(1))
+ Expect(result.OutputToStringArray()).To(HaveLen(1))
})
It("podman inspect container and filter for CreateCommand", func() {
@@ -140,7 +140,7 @@ var _ = Describe("Podman inspect", func() {
result := podmanTest.Podman([]string{"inspect", "--format={{.Config.CreateCommand}}", cid})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
- Expect(len(result.OutputToStringArray())).To(Equal(1))
+ Expect(result.OutputToStringArray()).To(HaveLen(1))
})
It("podman inspect -l with additional input should fail", func() {
@@ -200,7 +200,7 @@ var _ = Describe("Podman inspect", func() {
baseInspect.WaitWithDefaultTimeout()
Expect(baseInspect).Should(Exit(0))
baseJSON := baseInspect.InspectImageJSON()
- Expect(len(baseJSON)).To(Equal(1))
+ Expect(baseJSON).To(HaveLen(1))
ctrInspect := podmanTest.Podman([]string{"container", "inspect", ALPINE})
ctrInspect.WaitWithDefaultTimeout()
@@ -210,7 +210,7 @@ var _ = Describe("Podman inspect", func() {
imageInspect.WaitWithDefaultTimeout()
Expect(imageInspect).Should(Exit(0))
imageJSON := imageInspect.InspectImageJSON()
- Expect(len(imageJSON)).To(Equal(1))
+ Expect(imageJSON).To(HaveLen(1))
Expect(baseJSON[0].ID).To(Equal(imageJSON[0].ID))
})
@@ -225,13 +225,13 @@ var _ = Describe("Podman inspect", func() {
baseInspect.WaitWithDefaultTimeout()
Expect(baseInspect).Should(Exit(0))
baseJSON := baseInspect.InspectContainerToJSON()
- Expect(len(baseJSON)).To(Equal(1))
+ Expect(baseJSON).To(HaveLen(1))
ctrInspect := podmanTest.Podman([]string{"container", "inspect", ctrName})
ctrInspect.WaitWithDefaultTimeout()
Expect(ctrInspect).Should(Exit(0))
ctrJSON := ctrInspect.InspectContainerToJSON()
- Expect(len(ctrJSON)).To(Equal(1))
+ Expect(ctrJSON).To(HaveLen(1))
imageInspect := podmanTest.Podman([]string{"image", "inspect", ctrName})
imageInspect.WaitWithDefaultTimeout()
@@ -245,7 +245,7 @@ var _ = Describe("Podman inspect", func() {
baseInspect.WaitWithDefaultTimeout()
Expect(baseInspect).To(ExitWithError())
emptyJSON := baseInspect.InspectContainerToJSON()
- Expect(len(emptyJSON)).To(Equal(0))
+ Expect(emptyJSON).To(BeEmpty())
})
It("podman inspect one container with not exist returns 1-length valid array", func() {
@@ -258,7 +258,7 @@ var _ = Describe("Podman inspect", func() {
baseInspect.WaitWithDefaultTimeout()
Expect(baseInspect).To(ExitWithError())
baseJSON := baseInspect.InspectContainerToJSON()
- Expect(len(baseJSON)).To(Equal(1))
+ Expect(baseJSON).To(HaveLen(1))
Expect(baseJSON[0].Name).To(Equal(ctrName))
})
@@ -277,7 +277,7 @@ var _ = Describe("Podman inspect", func() {
baseInspect.WaitWithDefaultTimeout()
Expect(baseInspect).Should(Exit(0))
baseJSON := baseInspect.InspectContainerToJSON()
- Expect(len(baseJSON)).To(Equal(1))
+ Expect(baseJSON).To(HaveLen(1))
Expect(baseJSON[0].Name).To(Equal(ctrName))
})
@@ -301,7 +301,7 @@ var _ = Describe("Podman inspect", func() {
baseInspect.WaitWithDefaultTimeout()
Expect(baseInspect).Should(Exit(0))
baseJSON := baseInspect.InspectContainerToJSON()
- Expect(len(baseJSON)).To(Equal(1))
+ Expect(baseJSON).To(HaveLen(1))
Expect(baseJSON[0].HostConfig.SecurityOpt).To(Equal([]string{"label=type:spc_t,label=level:s0", "seccomp=unconfined"}))
})
@@ -468,8 +468,8 @@ var _ = Describe("Podman inspect", func() {
Expect(session).Should(Exit(0))
inspect := podmanTest.InspectContainer(ctrName)
- Expect(len(inspect)).To(Equal(1))
- Expect(len(inspect[0].NetworkSettings.Networks)).To(Equal(1))
+ Expect(inspect).To(HaveLen(1))
+ Expect(inspect[0].NetworkSettings.Networks).To(HaveLen(1))
})
It("Verify stopped container still has default network in inspect", func() {
@@ -480,8 +480,8 @@ var _ = Describe("Podman inspect", func() {
Expect(session).Should(Exit(0))
inspect := podmanTest.InspectContainer(ctrName)
- Expect(len(inspect)).To(Equal(1))
- Expect(len(inspect[0].NetworkSettings.Networks)).To(Equal(1))
+ Expect(inspect).To(HaveLen(1))
+ Expect(inspect[0].NetworkSettings.Networks).To(HaveLen(1))
})
It("Container inspect with unlimited uilimits should be -1", func() {
@@ -519,8 +519,8 @@ var _ = Describe("Podman inspect", func() {
Expect(inspect).Should(Exit(0))
data := inspect.InspectContainerToJSON()
- Expect(len(data)).To(Equal(1))
- Expect(len(data[0].HostConfig.CapDrop)).To(Equal(3))
+ Expect(data).To(HaveLen(1))
+ Expect(data[0].HostConfig.CapDrop).To(HaveLen(3))
Expect(data[0].HostConfig.CapDrop[0]).To(Equal("CAP_AUDIT_WRITE"))
Expect(data[0].HostConfig.CapDrop[1]).To(Equal("CAP_MKNOD"))
Expect(data[0].HostConfig.CapDrop[2]).To(Equal("CAP_NET_RAW"))
diff --git a/test/e2e/libpod_suite_remote_test.go b/test/e2e/libpod_suite_remote_test.go
index 2ecbd0eab..d60383029 100644
--- a/test/e2e/libpod_suite_remote_test.go
+++ b/test/e2e/libpod_suite_remote_test.go
@@ -148,7 +148,7 @@ func (p *PodmanTestIntegration) StopRemoteService() {
//MakeOptions assembles all the podman main options
func getRemoteOptions(p *PodmanTestIntegration, args []string) []string {
podmanOptions := strings.Split(fmt.Sprintf("--root %s --runroot %s --runtime %s --conmon %s --cni-config-dir %s --cgroup-manager %s",
- p.CrioRoot, p.RunRoot, p.OCIRuntime, p.ConmonBinary, p.CNIConfigDir, p.CgroupManager), " ")
+ p.Root, p.RunRoot, p.OCIRuntime, p.ConmonBinary, p.CNIConfigDir, p.CgroupManager), " ")
if os.Getenv("HOOK_OPTION") != "" {
podmanOptions = append(podmanOptions, os.Getenv("HOOK_OPTION"))
}
@@ -164,15 +164,16 @@ func (p *PodmanTestIntegration) SeedImages() error {
// RestoreArtifact puts the cached image into our test store
func (p *PodmanTestIntegration) RestoreArtifact(image string) error {
- fmt.Printf("Restoring %s...\n", image)
- dest := strings.Split(image, "/")
- destName := fmt.Sprintf("/tmp/%s.tar", strings.Replace(strings.Join(strings.Split(dest[len(dest)-1], "/"), ""), ":", "-", -1))
- args := []string{"load", "-q", "-i", destName}
- podmanOptions := getRemoteOptions(p, args)
- command := exec.Command(p.PodmanBinary, podmanOptions...)
- fmt.Printf("Running: %s %s\n", p.PodmanBinary, strings.Join(podmanOptions, " "))
- command.Start()
- command.Wait()
+ tarball := imageTarPath(image)
+ if _, err := os.Stat(tarball); err == nil {
+ fmt.Printf("Restoring %s...\n", image)
+ args := []string{"load", "-q", "-i", tarball}
+ podmanOptions := getRemoteOptions(p, args)
+ command := exec.Command(p.PodmanBinary, podmanOptions...)
+ fmt.Printf("Running: %s %s\n", p.PodmanBinary, strings.Join(podmanOptions, " "))
+ command.Start()
+ command.Wait()
+ }
return nil
}
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go
index 001a869b1..4147ba2c3 100644
--- a/test/e2e/libpod_suite_test.go
+++ b/test/e2e/libpod_suite_test.go
@@ -7,7 +7,6 @@ import (
"io/ioutil"
"os"
"path/filepath"
- "strings"
"github.com/containers/podman/v3/pkg/rootless"
)
@@ -59,11 +58,12 @@ func PodmanTestCreate(tempDir string) *PodmanTestIntegration {
// RestoreArtifact puts the cached image into our test store
func (p *PodmanTestIntegration) RestoreArtifact(image string) error {
- fmt.Printf("Restoring %s...\n", image)
- dest := strings.Split(image, "/")
- destName := fmt.Sprintf("/tmp/%s.tar", strings.Replace(strings.Join(strings.Split(dest[len(dest)-1], "/"), ""), ":", "-", -1))
- restore := p.PodmanNoEvents([]string{"load", "-q", "-i", destName})
- restore.Wait(90)
+ tarball := imageTarPath(image)
+ if _, err := os.Stat(tarball); err == nil {
+ fmt.Printf("Restoring %s...\n", image)
+ restore := p.PodmanNoEvents([]string{"load", "-q", "-i", tarball})
+ restore.Wait(90)
+ }
return nil
}
diff --git a/test/e2e/logs_test.go b/test/e2e/logs_test.go
index 2558af0eb..dc00491cd 100644
--- a/test/e2e/logs_test.go
+++ b/test/e2e/logs_test.go
@@ -68,7 +68,7 @@ var _ = Describe("Podman logs", func() {
results := podmanTest.Podman([]string{"logs", cid})
results.WaitWithDefaultTimeout()
Expect(results).To(Exit(0))
- Expect(len(results.OutputToStringArray())).To(Equal(3))
+ Expect(results.OutputToStringArray()).To(HaveLen(3))
Expect(results.OutputToString()).To(Equal("podman podman podman"))
})
@@ -83,7 +83,7 @@ var _ = Describe("Podman logs", func() {
results := podmanTest.Podman([]string{"logs", "--tail", "2", cid})
results.WaitWithDefaultTimeout()
Expect(results).To(Exit(0))
- Expect(len(results.OutputToStringArray())).To(Equal(2))
+ Expect(results.OutputToStringArray()).To(HaveLen(2))
})
It("tail zero lines: "+log, func() {
@@ -97,7 +97,7 @@ var _ = Describe("Podman logs", func() {
results := podmanTest.Podman([]string{"logs", "--tail", "0", cid})
results.WaitWithDefaultTimeout()
Expect(results).To(Exit(0))
- Expect(len(results.OutputToStringArray())).To(Equal(0))
+ Expect(results.OutputToStringArray()).To(BeEmpty())
})
It("tail 99 lines: "+log, func() {
@@ -111,7 +111,7 @@ var _ = Describe("Podman logs", func() {
results := podmanTest.Podman([]string{"logs", "--tail", "99", cid})
results.WaitWithDefaultTimeout()
Expect(results).To(Exit(0))
- Expect(len(results.OutputToStringArray())).To(Equal(3))
+ Expect(results.OutputToStringArray()).To(HaveLen(3))
})
It("tail 800 lines: "+log, func() {
@@ -125,7 +125,7 @@ var _ = Describe("Podman logs", func() {
results := podmanTest.Podman([]string{"logs", "--tail", "800", cid})
results.WaitWithDefaultTimeout()
Expect(results).To(Exit(0))
- Expect(len(results.OutputToStringArray())).To(Equal(800))
+ Expect(results.OutputToStringArray()).To(HaveLen(800))
})
It("tail 2 lines with timestamps: "+log, func() {
@@ -139,7 +139,7 @@ var _ = Describe("Podman logs", func() {
results := podmanTest.Podman([]string{"logs", "--tail", "2", "-t", cid})
results.WaitWithDefaultTimeout()
Expect(results).To(Exit(0))
- Expect(len(results.OutputToStringArray())).To(Equal(2))
+ Expect(results.OutputToStringArray()).To(HaveLen(2))
})
It("since time 2017-08-07: "+log, func() {
@@ -153,7 +153,7 @@ var _ = Describe("Podman logs", func() {
results := podmanTest.Podman([]string{"logs", "--since", "2017-08-07T10:10:09.056611202-04:00", cid})
results.WaitWithDefaultTimeout()
Expect(results).To(Exit(0))
- Expect(len(results.OutputToStringArray())).To(Equal(3))
+ Expect(results.OutputToStringArray()).To(HaveLen(3))
})
It("since duration 10m: "+log, func() {
@@ -167,7 +167,7 @@ var _ = Describe("Podman logs", func() {
results := podmanTest.Podman([]string{"logs", "--since", "10m", cid})
results.WaitWithDefaultTimeout()
Expect(results).To(Exit(0))
- Expect(len(results.OutputToStringArray())).To(Equal(3))
+ Expect(results.OutputToStringArray()).To(HaveLen(3))
})
It("until duration 10m: "+log, func() {
@@ -181,7 +181,7 @@ var _ = Describe("Podman logs", func() {
results := podmanTest.Podman([]string{"logs", "--until", "10m", cid})
results.WaitWithDefaultTimeout()
Expect(results).To(Exit(0))
- Expect(len(results.OutputToStringArray())).To(Equal(3))
+ Expect(results.OutputToStringArray()).To(HaveLen(3))
})
It("until time NOW: "+log, func() {
@@ -198,7 +198,7 @@ var _ = Describe("Podman logs", func() {
results := podmanTest.Podman([]string{"logs", "--until", nowS, cid})
results.WaitWithDefaultTimeout()
Expect(results).To(Exit(0))
- Expect(len(results.OutputToStringArray())).To(Equal(3))
+ Expect(results.OutputToStringArray()).To(HaveLen(3))
})
It("latest and container name should fail: "+log, func() {
@@ -228,7 +228,7 @@ var _ = Describe("Podman logs", func() {
Expect(results).Should(Exit(0))
output := results.OutputToStringArray()
- Expect(len(output)).To(Equal(6))
+ Expect(output).To(HaveLen(6))
Expect(strings.Contains(output[0], cid1[:12]) || strings.Contains(output[0], cid2[:12])).To(BeTrue())
})
@@ -342,7 +342,7 @@ var _ = Describe("Podman logs", func() {
results.WaitWithDefaultTimeout()
Expect(results).To(Exit(0))
outlines := results.OutputToStringArray()
- Expect(len(outlines)).To(Equal(2))
+ Expect(outlines).To(HaveLen(2))
Expect(outlines[0]).To(Equal("1\r"))
Expect(outlines[1]).To(Equal("2\r"))
})
diff --git a/test/e2e/mount_test.go b/test/e2e/mount_test.go
index 0555a0749..cd7f73337 100644
--- a/test/e2e/mount_test.go
+++ b/test/e2e/mount_test.go
@@ -348,7 +348,7 @@ var _ = Describe("Podman mount", func() {
umount := podmanTest.Podman([]string{"image", "umount", "--all"})
umount.WaitWithDefaultTimeout()
Expect(umount).Should(Exit(0))
- Expect(len(umount.OutputToStringArray())).To(Equal(1))
+ Expect(umount.OutputToStringArray()).To(HaveLen(1))
})
It("podman mount many", func() {
diff --git a/test/e2e/network_test.go b/test/e2e/network_test.go
index d56cde9db..92f962abc 100644
--- a/test/e2e/network_test.go
+++ b/test/e2e/network_test.go
@@ -262,8 +262,8 @@ var _ = Describe("Podman network", func() {
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
conData := inspect.InspectContainerToJSON()
- Expect(len(conData)).To(Equal(1))
- Expect(len(conData[0].NetworkSettings.Networks)).To(Equal(1))
+ Expect(conData).To(HaveLen(1))
+ Expect(conData[0].NetworkSettings.Networks).To(HaveLen(1))
net, ok := conData[0].NetworkSettings.Networks[netName]
Expect(ok).To(BeTrue())
Expect(net.NetworkID).To(Equal(netName))
@@ -298,8 +298,8 @@ var _ = Describe("Podman network", func() {
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
conData := inspect.InspectContainerToJSON()
- Expect(len(conData)).To(Equal(1))
- Expect(len(conData[0].NetworkSettings.Networks)).To(Equal(2))
+ Expect(conData).To(HaveLen(1))
+ Expect(conData[0].NetworkSettings.Networks).To(HaveLen(2))
net1, ok := conData[0].NetworkSettings.Networks[netName1]
Expect(ok).To(BeTrue())
Expect(net1.NetworkID).To(Equal(netName1))
@@ -335,8 +335,8 @@ var _ = Describe("Podman network", func() {
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
conData := inspect.InspectContainerToJSON()
- Expect(len(conData)).To(Equal(1))
- Expect(len(conData[0].NetworkSettings.Networks)).To(Equal(2))
+ Expect(conData).To(HaveLen(1))
+ Expect(conData[0].NetworkSettings.Networks).To(HaveLen(2))
net1, ok := conData[0].NetworkSettings.Networks[netName1]
Expect(ok).To(BeTrue())
Expect(net1.NetworkID).To(Equal(netName1))
diff --git a/test/e2e/pause_test.go b/test/e2e/pause_test.go
index 99488a507..c9182960a 100644
--- a/test/e2e/pause_test.go
+++ b/test/e2e/pause_test.go
@@ -282,7 +282,7 @@ var _ = Describe("Podman pause", func() {
running := podmanTest.Podman([]string{"ps", "-q"})
running.WaitWithDefaultTimeout()
Expect(running).Should(Exit(0))
- Expect(len(running.OutputToStringArray())).To(Equal(3))
+ Expect(running.OutputToStringArray()).To(HaveLen(3))
pause := podmanTest.Podman([]string{"pause", "--all"})
pause.WaitWithDefaultTimeout()
@@ -291,7 +291,7 @@ var _ = Describe("Podman pause", func() {
running = podmanTest.Podman([]string{"ps", "-q"})
running.WaitWithDefaultTimeout()
Expect(running).Should(Exit(0))
- Expect(len(running.OutputToStringArray())).To(Equal(0))
+ Expect(running.OutputToStringArray()).To(BeEmpty())
unpause := podmanTest.Podman([]string{"unpause", "--all"})
unpause.WaitWithDefaultTimeout()
@@ -317,7 +317,7 @@ var _ = Describe("Podman pause", func() {
running := podmanTest.Podman([]string{"ps", "-q"})
running.WaitWithDefaultTimeout()
Expect(running).Should(Exit(0))
- Expect(len(running.OutputToStringArray())).To(Equal(3))
+ Expect(running.OutputToStringArray()).To(HaveLen(3))
})
})
diff --git a/test/e2e/play_build_test.go b/test/e2e/play_build_test.go
index 9bdf9d06b..a56560634 100644
--- a/test/e2e/play_build_test.go
+++ b/test/e2e/play_build_test.go
@@ -125,7 +125,7 @@ LABEL marge=mom
Expect(inspect).Should(Exit(0))
inspectData := inspect.InspectContainerToJSON()
Expect(len(inspectData)).To(BeNumerically(">", 0))
- Expect(inspectData[0].Config.Labels["homer"]).To(Equal("dad"))
+ Expect(inspectData[0].Config.Labels).To(HaveKeyWithValue("homer", "dad"))
})
It("Check that image is built using Containerfile", func() {
@@ -162,7 +162,7 @@ LABEL marge=mom
Expect(inspect).Should(Exit(0))
inspectData := inspect.InspectContainerToJSON()
Expect(len(inspectData)).To(BeNumerically(">", 0))
- Expect(inspectData[0].Config.Labels["homer"]).To(Equal("dad"))
+ Expect(inspectData[0].Config.Labels).To(HaveKeyWithValue("homer", "dad"))
})
It("Do not build image if already in the local store", func() {
@@ -208,8 +208,8 @@ LABEL marge=mom
Expect(inspect).Should(Exit(0))
inspectData := inspect.InspectContainerToJSON()
Expect(len(inspectData)).To(BeNumerically(">", 0))
- Expect(inspectData[0].Config.Labels["homer"]).To(Equal(""))
- Expect(inspectData[0].Config.Labels["marge"]).To(Equal("mom"))
+ Expect(inspectData[0].Config.Labels).To(Not(HaveKey("homer")))
+ Expect(inspectData[0].Config.Labels).To(HaveKeyWithValue("marge", "mom"))
})
It("--build should override image in store", func() {
@@ -255,8 +255,8 @@ LABEL marge=mom
Expect(inspect).Should(Exit(0))
inspectData := inspect.InspectContainerToJSON()
Expect(len(inspectData)).To(BeNumerically(">", 0))
- Expect(inspectData[0].Config.Labels["homer"]).To(Equal("dad"))
- Expect(inspectData[0].Config.Labels["marge"]).To(Equal(""))
+ Expect(inspectData[0].Config.Labels).To(HaveKeyWithValue("homer", "dad"))
+ Expect(inspectData[0].Config.Labels).To(Not(HaveKey("marge")))
})
})
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go
index fc939711f..82b543151 100644
--- a/test/e2e/play_kube_test.go
+++ b/test/e2e/play_kube_test.go
@@ -2012,8 +2012,8 @@ spec:
ctr := inspect.InspectContainerToJSON()
Expect(ctr[0].Config.WorkingDir).To(ContainSubstring("/etc"))
- Expect(ctr[0].Config.Labels["key1"]).To(ContainSubstring("value1"))
- Expect(ctr[0].Config.Labels["key1"]).To(ContainSubstring("value1"))
+ Expect(ctr[0].Config.Labels).To(HaveKeyWithValue("key1", ContainSubstring("value1")))
+ Expect(ctr[0].Config.Labels).To(HaveKeyWithValue("key1", ContainSubstring("value1")))
Expect(ctr[0].Config.StopSignal).To(Equal(uint(51)))
})
@@ -2286,7 +2286,7 @@ VOLUME %s`, ALPINE, hostPathDir+"/")
// If two volumes are specified and share the same destination,
// only one will be mounted. Host path volumes take precedence.
ctrJSON := inspect.InspectContainerToJSON()
- Expect(len(ctrJSON[0].Mounts)).To(Equal(1))
+ Expect(ctrJSON[0].Mounts).To(HaveLen(1))
Expect(ctrJSON[0].Mounts[0].Type).To(Equal("bind"))
})
@@ -2770,7 +2770,7 @@ invalid kube kind
ls := podmanTest.Podman([]string{"pod", "ps", "--format", "'{{.ID}}'"})
ls.WaitWithDefaultTimeout()
Expect(ls).Should(Exit(0))
- Expect(len(ls.OutputToStringArray())).To(Equal(1))
+ Expect(ls.OutputToStringArray()).To(HaveLen(1))
// teardown
teardown := podmanTest.Podman([]string{"play", "kube", "--down", kubeYaml})
@@ -2780,7 +2780,7 @@ invalid kube kind
checkls := podmanTest.Podman([]string{"pod", "ps", "--format", "'{{.ID}}'"})
checkls.WaitWithDefaultTimeout()
Expect(checkls).Should(Exit(0))
- Expect(len(checkls.OutputToStringArray())).To(Equal(0))
+ Expect(checkls.OutputToStringArray()).To(BeEmpty())
})
It("podman play kube teardown pod does not exist", func() {
@@ -2862,7 +2862,7 @@ invalid kube kind
ls := podmanTest.Podman([]string{"pod", "ps", "--format", "'{{.ID}}'"})
ls.WaitWithDefaultTimeout()
Expect(ls).Should(Exit(0))
- Expect(len(ls.OutputToStringArray())).To(Equal(1))
+ Expect(ls.OutputToStringArray()).To(HaveLen(1))
containerLen := podmanTest.Podman([]string{"pod", "inspect", pod.Name, "--format", "'{{len .Containers}}'"})
@@ -2901,7 +2901,7 @@ invalid kube kind
ls := podmanTest.Podman([]string{"pod", "ps", "--format", "'{{.ID}}'"})
ls.WaitWithDefaultTimeout()
Expect(ls).Should(Exit(0))
- Expect(len(ls.OutputToStringArray())).To(Equal(1))
+ Expect(ls.OutputToStringArray()).To(HaveLen(1))
})
Describe("verify environment variables", func() {
diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go
index 186688b93..41a017a52 100644
--- a/test/e2e/pod_create_test.go
+++ b/test/e2e/pod_create_test.go
@@ -49,7 +49,7 @@ var _ = Describe("Podman pod create", func() {
check := podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc"})
check.WaitWithDefaultTimeout()
Expect(check.OutputToString()).To(ContainSubstring(podID))
- Expect(len(check.OutputToStringArray())).To(Equal(1))
+ Expect(check.OutputToStringArray()).To(HaveLen(1))
})
It("podman create pod with name", func() {
@@ -72,7 +72,7 @@ var _ = Describe("Podman pod create", func() {
check := podmanTest.Podman([]string{"pod", "ps", "-q"})
check.WaitWithDefaultTimeout()
- Expect(len(check.OutputToStringArray())).To(Equal(1))
+ Expect(check.OutputToStringArray()).To(HaveLen(1))
})
It("podman create pod with same name as ctr", func() {
@@ -86,7 +86,7 @@ var _ = Describe("Podman pod create", func() {
check := podmanTest.Podman([]string{"pod", "ps", "-q"})
check.WaitWithDefaultTimeout()
- Expect(len(check.OutputToStringArray())).To(Equal(0))
+ Expect(check.OutputToStringArray()).To(BeEmpty())
})
It("podman create pod without network portbindings", func() {
@@ -517,7 +517,7 @@ entrypoint ["/fromimage"]
session.WaitWithDefaultTimeout()
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))
+ Expect(session.OutputToStringArray()).To(HaveLen(1))
})
It("podman pod create --infra-image w/untagged image", func() {
@@ -729,7 +729,7 @@ ENTRYPOINT ["sleep","99999"]
m[l] = l
}
// check for no duplicates
- Expect(len(m)).To(Equal(5))
+ Expect(m).To(HaveLen(5))
})
It("podman pod create --userns=auto:size=%d", func() {
diff --git a/test/e2e/pod_infra_container_test.go b/test/e2e/pod_infra_container_test.go
index 6d57c3887..4a5a8c6b0 100644
--- a/test/e2e/pod_infra_container_test.go
+++ b/test/e2e/pod_infra_container_test.go
@@ -43,11 +43,11 @@ var _ = Describe("Podman pod create", func() {
check := podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc"})
check.WaitWithDefaultTimeout()
Expect(check.OutputToString()).To(ContainSubstring(podID))
- Expect(len(check.OutputToStringArray())).To(Equal(1))
+ Expect(check.OutputToStringArray()).To(HaveLen(1))
check = podmanTest.Podman([]string{"ps", "-qa", "--no-trunc"})
check.WaitWithDefaultTimeout()
- Expect(len(check.OutputToStringArray())).To(Equal(1))
+ Expect(check.OutputToStringArray()).To(HaveLen(1))
})
It("podman start infra container", func() {
@@ -63,7 +63,7 @@ var _ = Describe("Podman pod create", func() {
check := podmanTest.Podman([]string{"ps", "-qa", "--no-trunc", "--filter", "status=running"})
check.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(check.OutputToStringArray())).To(Equal(1))
+ Expect(check.OutputToStringArray()).To(HaveLen(1))
})
It("podman start infra container different image", func() {
@@ -95,13 +95,13 @@ var _ = Describe("Podman pod create", func() {
check := podmanTest.Podman([]string{"ps", "-a", "--no-trunc", "--ns", "--format", "{{.Namespaces.IPC}} {{.Namespaces.NET}}"})
check.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(check.OutputToStringArray())).To(Equal(2))
+ Expect(check.OutputToStringArray()).To(HaveLen(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).Should(Exit(0))
- Expect(len(check.OutputToStringArray())).To(Equal(2))
+ Expect(check.OutputToStringArray()).To(HaveLen(2))
Expect(check.OutputToStringArray()[0]).To(Equal(check.OutputToStringArray()[1]))
})
@@ -169,7 +169,7 @@ var _ = Describe("Podman pod create", func() {
check.WaitWithDefaultTimeout()
Expect(check).Should(Exit(0))
PIDs := check.OutputToStringArray()
- Expect(len(PIDs)).To(Equal(3))
+ Expect(PIDs).To(HaveLen(3))
ctrPID, _ := strconv.Atoi(PIDs[1])
infraPID, _ := strconv.Atoi(PIDs[2])
@@ -243,13 +243,13 @@ var _ = Describe("Podman pod create", func() {
check.WaitWithDefaultTimeout()
Expect(check).Should(Exit(0))
outputArray := check.OutputToStringArray()
- Expect(len(outputArray)).To(Equal(2))
+ Expect(outputArray).To(HaveLen(2))
check = podmanTest.Podman([]string{"ps", "-a", "--ns", "--format", "{{.PIDNS}}"})
check.WaitWithDefaultTimeout()
Expect(check).Should(Exit(0))
outputArray = check.OutputToStringArray()
- Expect(len(outputArray)).To(Equal(2))
+ Expect(outputArray).To(HaveLen(2))
PID1 := outputArray[0]
PID2 := outputArray[1]
@@ -274,7 +274,7 @@ var _ = Describe("Podman pod create", func() {
check.WaitWithDefaultTimeout()
Expect(check).Should(Exit(0))
outputArray := check.OutputToStringArray()
- Expect(len(outputArray)).To(Equal(2))
+ Expect(outputArray).To(HaveLen(2))
PID1 := outputArray[0]
PID2 := outputArray[1]
@@ -299,7 +299,7 @@ var _ = Describe("Podman pod create", func() {
check.WaitWithDefaultTimeout()
Expect(check).Should(Exit(0))
outputArray := check.OutputToStringArray()
- Expect(len(outputArray)).To(Equal(2))
+ Expect(outputArray).To(HaveLen(2))
PID1 := outputArray[0]
PID2 := outputArray[1]
diff --git a/test/e2e/pod_inspect_test.go b/test/e2e/pod_inspect_test.go
index 8a6f2a367..0fc16b507 100644
--- a/test/e2e/pod_inspect_test.go
+++ b/test/e2e/pod_inspect_test.go
@@ -97,7 +97,7 @@ var _ = Describe("Podman pod inspect", func() {
err := json.Unmarshal(inspectOut.Out.Contents(), inspectJSON)
Expect(err).To(BeNil())
Expect(inspectJSON.InfraConfig).To(Not(BeNil()))
- Expect(len(inspectJSON.InfraConfig.PortBindings["80/tcp"])).To(Equal(1))
+ Expect(inspectJSON.InfraConfig.PortBindings["80/tcp"]).To(HaveLen(1))
Expect(inspectJSON.InfraConfig.PortBindings["80/tcp"][0].HostPort).To(Equal("8383"))
})
diff --git a/test/e2e/pod_pod_namespaces_test.go b/test/e2e/pod_pod_namespaces_test.go
index 9e9b9b2d3..293fd02ae 100644
--- a/test/e2e/pod_pod_namespaces_test.go
+++ b/test/e2e/pod_pod_namespaces_test.go
@@ -52,7 +52,7 @@ var _ = Describe("Podman pod create", func() {
check.WaitWithDefaultTimeout()
Expect(check).Should(Exit(0))
outputArray := check.OutputToStringArray()
- Expect(len(outputArray)).To(Equal(2))
+ Expect(outputArray).To(HaveLen(2))
NAMESPACE1 := outputArray[0]
fmt.Println("NAMESPACE1:", NAMESPACE1)
@@ -98,7 +98,7 @@ var _ = Describe("Podman pod create", func() {
check.WaitWithDefaultTimeout()
Expect(check).Should(Exit(0))
outputArray := check.OutputToStringArray()
- Expect(len(outputArray)).To(Equal(2))
+ Expect(outputArray).To(HaveLen(2))
NAMESPACE1 := outputArray[0]
fmt.Println("NAMESPACE1:", NAMESPACE1)
diff --git a/test/e2e/pod_prune_test.go b/test/e2e/pod_prune_test.go
index 6273fcec3..84348f30c 100644
--- a/test/e2e/pod_prune_test.go
+++ b/test/e2e/pod_prune_test.go
@@ -56,7 +56,7 @@ var _ = Describe("Podman pod prune", func() {
result = podmanTest.Podman([]string{"ps", "-qa"})
result.WaitWithDefaultTimeout()
- Expect(len(result.OutputToStringArray())).To(Equal(1))
+ Expect(result.OutputToStringArray()).To(HaveLen(1))
})
It("podman pod prune removes a pod with a stopped container", func() {
@@ -72,6 +72,6 @@ var _ = Describe("Podman pod prune", func() {
result = podmanTest.Podman([]string{"ps", "-qa"})
result.WaitWithDefaultTimeout()
- Expect(len(result.OutputToStringArray())).To(Equal(0))
+ Expect(result.OutputToStringArray()).To(BeEmpty())
})
})
diff --git a/test/e2e/pod_ps_test.go b/test/e2e/pod_ps_test.go
index b4a0df904..4b2a3b66d 100644
--- a/test/e2e/pod_ps_test.go
+++ b/test/e2e/pod_ps_test.go
@@ -135,14 +135,14 @@ var _ = Describe("Podman ps", func() {
Expect(result).Should(Exit(0))
output := result.OutputToStringArray()
- Expect(len(output)).To(Equal(2))
+ Expect(output).To(HaveLen(2))
result = podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc", "--filter", "name=mypod$"})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
output = result.OutputToStringArray()
- Expect(len(output)).To(Equal(1))
+ Expect(output).To(HaveLen(1))
Expect(output[0]).To(Equal(podid))
})
@@ -368,7 +368,7 @@ var _ = Describe("Podman ps", func() {
infra := podmanTest.Podman([]string{"pod", "ps", "--format", "{{.InfraId}}"})
infra.WaitWithDefaultTimeout()
- Expect(len(infra.OutputToString())).To(BeZero())
+ Expect(infra.OutputToString()).To(BeEmpty())
})
It("podman pod ps format with labels", func() {
diff --git a/test/e2e/pod_rm_test.go b/test/e2e/pod_rm_test.go
index d9b0761fa..636503a0c 100644
--- a/test/e2e/pod_rm_test.go
+++ b/test/e2e/pod_rm_test.go
@@ -96,7 +96,7 @@ var _ = Describe("Podman pod rm", func() {
result = podmanTest.Podman([]string{"ps", "-qa"})
result.WaitWithDefaultTimeout()
- Expect(len(result.OutputToStringArray())).To(Equal(0))
+ Expect(result.OutputToStringArray()).To(BeEmpty())
})
It("podman pod rm -f does remove a running container", func() {
diff --git a/test/e2e/pod_top_test.go b/test/e2e/pod_top_test.go
index 253d4adf5..602546141 100644
--- a/test/e2e/pod_top_test.go
+++ b/test/e2e/pod_top_test.go
@@ -120,7 +120,7 @@ var _ = Describe("Podman top", func() {
result := podmanTest.Podman([]string{"pod", "top", podid})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
- Expect(len(result.OutputToStringArray())).To(Equal(3))
+ Expect(result.OutputToStringArray()).To(HaveLen(3))
})
It("podman pod top on pod with containers in different namespace", func() {
@@ -145,6 +145,6 @@ var _ = Describe("Podman top", func() {
result := podmanTest.Podman([]string{"pod", "top", podid})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
- Expect(len(result.OutputToStringArray())).To(Equal(3))
+ Expect(result.OutputToStringArray()).To(HaveLen(3))
})
})
diff --git a/test/e2e/prune_test.go b/test/e2e/prune_test.go
index 6b0081171..6a70fd556 100644
--- a/test/e2e/prune_test.go
+++ b/test/e2e/prune_test.go
@@ -105,14 +105,14 @@ var _ = Describe("Podman prune", func() {
session = podmanTest.Podman([]string{"image", "prune", "-f"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(0))
+ Expect(session.OutputToStringArray()).To(BeEmpty())
// Let's be extra sure that the same number of images is
// reported.
session = podmanTest.Podman([]string{"images", "-a"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(numImages))
+ Expect(session.OutputToStringArray()).To(HaveLen(numImages))
// Now build an image and untag it. The (intermediate) images
// should be removed recursively during pruning.
@@ -140,7 +140,7 @@ var _ = Describe("Podman prune", func() {
session = podmanTest.Podman([]string{"images", "-a"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(numImages - numPrunedImages))
+ Expect(session.OutputToStringArray()).To(HaveLen(numImages - numPrunedImages))
})
It("podman image prune - handle empty images", func() {
@@ -157,7 +157,7 @@ var _ = Describe("Podman prune", func() {
session = podmanTest.Podman([]string{"image", "prune", "-f"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(0))
+ Expect(session.OutputToStringArray()).To(BeEmpty())
// Now the image will be untagged, and its parent images will
// be removed recursively.
@@ -168,7 +168,7 @@ var _ = Describe("Podman prune", func() {
session = podmanTest.Podman([]string{"image", "prune", "-f"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
})
It("podman image prune dangling images", func() {
@@ -178,7 +178,7 @@ var _ = Describe("Podman prune", func() {
none.WaitWithDefaultTimeout()
Expect(none).Should(Exit(0))
hasNone, result := none.GrepString("<none>")
- Expect(len(result)).To(Equal(2))
+ Expect(result).To(HaveLen(2))
Expect(hasNone).To(BeTrue())
prune := podmanTest.Podman([]string{"image", "prune", "-f"})
@@ -210,7 +210,7 @@ var _ = Describe("Podman prune", func() {
images.WaitWithDefaultTimeout()
Expect(images).Should(Exit(0))
// all images are unused, so they all should be deleted!
- Expect(len(images.OutputToStringArray())).To(Equal(len(CACHE_IMAGES)))
+ Expect(images.OutputToStringArray()).To(HaveLen(len(CACHE_IMAGES)))
})
It("podman system image prune unused images", func() {
@@ -223,7 +223,7 @@ var _ = Describe("Podman prune", func() {
images := podmanTest.Podman([]string{"images", "-aq"})
images.WaitWithDefaultTimeout()
// all images are unused, so they all should be deleted!
- Expect(len(images.OutputToStringArray())).To(Equal(len(CACHE_IMAGES)))
+ Expect(images.OutputToStringArray()).To(HaveLen(len(CACHE_IMAGES)))
})
It("podman system prune pods", func() {
@@ -247,7 +247,7 @@ var _ = Describe("Podman prune", func() {
pods := podmanTest.Podman([]string{"pod", "ps"})
pods.WaitWithDefaultTimeout()
Expect(pods).Should(Exit(0))
- Expect(len(pods.OutputToStringArray())).To(Equal(3))
+ Expect(pods.OutputToStringArray()).To(HaveLen(3))
prune := podmanTest.Podman([]string{"system", "prune", "-f"})
prune.WaitWithDefaultTimeout()
@@ -256,7 +256,7 @@ var _ = Describe("Podman prune", func() {
pods = podmanTest.Podman([]string{"pod", "ps"})
pods.WaitWithDefaultTimeout()
Expect(pods).Should(Exit(0))
- Expect(len(pods.OutputToStringArray())).To(Equal(2))
+ Expect(pods.OutputToStringArray()).To(HaveLen(2))
})
It("podman system prune - pod,container stopped", func() {
@@ -344,7 +344,7 @@ var _ = Describe("Podman prune", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(3))
+ Expect(session.OutputToStringArray()).To(HaveLen(3))
session = podmanTest.Podman([]string{"system", "prune", "--force", "--volumes"})
session.WaitWithDefaultTimeout()
@@ -354,7 +354,7 @@ var _ = Describe("Podman prune", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(0))
+ Expect(session.OutputToStringArray()).To(BeEmpty())
// One Pod should not be pruned as it was running
Expect(podmanTest.NumberOfPods()).To(Equal(1))
@@ -365,7 +365,7 @@ var _ = Describe("Podman prune", func() {
// Image should not be pruned and number should be same.
images := podmanTest.Podman([]string{"images"})
images.WaitWithDefaultTimeout()
- Expect(len(images.OutputToStringArray())).To(Equal(numberOfImages))
+ Expect(images.OutputToStringArray()).To(HaveLen(numberOfImages))
})
It("podman system prune - with dangling images true", func() {
@@ -408,12 +408,12 @@ var _ = Describe("Podman prune", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
images := podmanTest.Podman([]string{"images", "-aq"})
images.WaitWithDefaultTimeout()
// all images are unused, so they all should be deleted!
- Expect(len(images.OutputToStringArray())).To(Equal(len(CACHE_IMAGES)))
+ Expect(images.OutputToStringArray()).To(HaveLen(len(CACHE_IMAGES)))
})
It("podman system prune --volumes --filter", func() {
@@ -444,7 +444,7 @@ var _ = Describe("Podman prune", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(7))
+ Expect(session.OutputToStringArray()).To(HaveLen(7))
session = podmanTest.Podman([]string{"system", "prune", "--force", "--volumes", "--filter", "label=label1=value1"})
session.WaitWithDefaultTimeout()
@@ -453,7 +453,7 @@ var _ = Describe("Podman prune", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(6))
+ Expect(session.OutputToStringArray()).To(HaveLen(6))
session = podmanTest.Podman([]string{"system", "prune", "--force", "--volumes", "--filter", "label=sharedlabel1=slv1"})
session.WaitWithDefaultTimeout()
@@ -462,7 +462,7 @@ var _ = Describe("Podman prune", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(5))
+ Expect(session.OutputToStringArray()).To(HaveLen(5))
session = podmanTest.Podman([]string{"system", "prune", "--force", "--volumes", "--filter", "label=sharedlabel1"})
session.WaitWithDefaultTimeout()
@@ -471,7 +471,7 @@ var _ = Describe("Podman prune", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(3))
+ Expect(session.OutputToStringArray()).To(HaveLen(3))
podmanTest.Cleanup()
})
diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go
index 3334250db..a9f334f5c 100644
--- a/test/e2e/ps_test.go
+++ b/test/e2e/ps_test.go
@@ -118,7 +118,7 @@ var _ = Describe("Podman ps", func() {
result := podmanTest.Podman([]string{"ps", "-q", "--latest"})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
- Expect(len(result.OutputToStringArray())).Should(Equal(1))
+ Expect(result.OutputToStringArray()).To(HaveLen(1))
})
It("podman ps last flag", func() {
@@ -133,7 +133,7 @@ var _ = Describe("Podman ps", func() {
result := podmanTest.Podman([]string{"ps", "--last", "2"})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
- Expect(len(result.OutputToStringArray())).Should(Equal(2)) // 1 container
+ Expect(result.OutputToStringArray()).Should(HaveLen(2)) // 1 container
_, ec, _ := podmanTest.RunLsContainer("test1")
Expect(ec).To(Equal(0))
@@ -147,17 +147,17 @@ var _ = Describe("Podman ps", func() {
result = podmanTest.Podman([]string{"ps", "--last", "2"})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
- Expect(len(result.OutputToStringArray())).Should(Equal(3)) // 2 containers
+ Expect(result.OutputToStringArray()).Should(HaveLen(3)) // 2 containers
result = podmanTest.Podman([]string{"ps", "--last", "3"})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
- Expect(len(result.OutputToStringArray())).Should(Equal(4)) // 3 containers
+ Expect(result.OutputToStringArray()).Should(HaveLen(4)) // 3 containers
result = podmanTest.Podman([]string{"ps", "--last", "100"})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
- Expect(len(result.OutputToStringArray())).Should(Equal(5)) // 4 containers (3 running + 1 created)
+ Expect(result.OutputToStringArray()).Should(HaveLen(5)) // 4 containers (3 running + 1 created)
})
It("podman ps no-trunc", func() {
@@ -357,7 +357,7 @@ var _ = Describe("Podman ps", func() {
Expect(result).Should(Exit(0))
output := result.OutputToStringArray()
- Expect(len(output)).To(Equal(1))
+ Expect(output).To(HaveLen(1))
Expect(output[0]).To(Equal(fullCid))
})
@@ -580,14 +580,14 @@ var _ = Describe("Podman ps", func() {
Expect(result).Should(Exit(0))
output := result.OutputToStringArray()
- Expect(len(output)).To(Equal(2))
+ Expect(output).To(HaveLen(2))
result = podmanTest.Podman([]string{"ps", "-aq", "--no-trunc", "--filter", "name=test1$"})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
output = result.OutputToStringArray()
- Expect(len(output)).To(Equal(1))
+ Expect(output).To(HaveLen(1))
Expect(output[0]).To(Equal(fullCid))
})
@@ -602,7 +602,7 @@ var _ = Describe("Podman ps", func() {
Expect(result).Should(Exit(0))
output := result.OutputToStringArray()
- Expect(len(output)).To(Equal(1))
+ Expect(output).To(HaveLen(1))
Expect(output[0]).To(Equal(ctrName))
})
@@ -669,7 +669,7 @@ var _ = Describe("Podman ps", func() {
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "name=test"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(5))
+ Expect(session.OutputToStringArray()).To(HaveLen(5))
Expect(session.OutputToString()).To(ContainSubstring("test1"))
Expect(session.OutputToString()).To(ContainSubstring("test2"))
Expect(session.OutputToString()).To(ContainSubstring("test3"))
@@ -678,7 +678,7 @@ var _ = Describe("Podman ps", func() {
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "name=test1", "--filter", "name=test2"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(3))
+ Expect(session.OutputToStringArray()).To(HaveLen(3))
Expect(session.OutputToString()).To(ContainSubstring("test1"))
Expect(session.OutputToString()).To(ContainSubstring("test2"))
@@ -686,19 +686,19 @@ var _ = Describe("Podman ps", func() {
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "id=" + cid1[:40], "--filter", "id=" + cid1 + "$"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
Expect(session.OutputToString()).To(ContainSubstring("test1"))
session = podmanTest.Podman([]string{"ps", "--filter", "status=created"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
Expect(session.OutputToString()).To(ContainSubstring("test3"))
session = podmanTest.Podman([]string{"ps", "--filter", "status=created", "--filter", "status=exited"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(4))
+ Expect(session.OutputToStringArray()).To(HaveLen(4))
Expect(session.OutputToString()).To(ContainSubstring("test2"))
Expect(session.OutputToString()).To(ContainSubstring("test3"))
Expect(session.OutputToString()).To(ContainSubstring("test4"))
@@ -706,63 +706,63 @@ var _ = Describe("Podman ps", func() {
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "label=foo=1"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(3))
+ Expect(session.OutputToStringArray()).To(HaveLen(3))
Expect(session.OutputToString()).To(ContainSubstring("test1"))
Expect(session.OutputToString()).To(ContainSubstring("test2"))
session = podmanTest.Podman([]string{"ps", "--filter", "label=foo=1", "--filter", "status=exited"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
Expect(session.OutputToString()).To(ContainSubstring("test2"))
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "label=foo=1", "--filter", "label=non=1"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(1))
+ Expect(session.OutputToStringArray()).To(HaveLen(1))
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "label=foo=1", "--filter", "label=bar=2"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
Expect(session.OutputToString()).To(ContainSubstring("test1"))
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "exited=1"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
Expect(session.OutputToString()).To(ContainSubstring("test2"))
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "exited=1", "--filter", "exited=0"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(3))
+ Expect(session.OutputToStringArray()).To(HaveLen(3))
Expect(session.OutputToString()).To(ContainSubstring("test2"))
Expect(session.OutputToString()).To(ContainSubstring("test4"))
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "volume=volume1"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(3))
+ Expect(session.OutputToStringArray()).To(HaveLen(3))
Expect(session.OutputToString()).To(ContainSubstring("test1"))
Expect(session.OutputToString()).To(ContainSubstring("test4"))
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "volume=/:/test2"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
Expect(session.OutputToString()).To(ContainSubstring("test4"))
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "before=test2"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
Expect(session.OutputToString()).To(ContainSubstring("test1"))
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "since=test2"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(3))
+ Expect(session.OutputToStringArray()).To(HaveLen(3))
Expect(session.OutputToString()).To(ContainSubstring("test3"))
Expect(session.OutputToString()).To(ContainSubstring("test4"))
})
@@ -790,28 +790,28 @@ var _ = Describe("Podman ps", func() {
session = podmanTest.Podman([]string{"ps", "-q", "--no-trunc", "--filter", "pod=pod1"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
Expect(session.OutputToStringArray()).To(ContainElement(con1.OutputToString()))
// filter by full pod id
session = podmanTest.Podman([]string{"ps", "-q", "--no-trunc", "--filter", "pod=" + pod1.OutputToString()})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
Expect(session.OutputToStringArray()).To(ContainElement(con1.OutputToString()))
// filter by partial pod id
session = podmanTest.Podman([]string{"ps", "-q", "--no-trunc", "--filter", "pod=" + pod1.OutputToString()[0:12]})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
Expect(session.OutputToStringArray()).To(ContainElement(con1.OutputToString()))
// filter by multiple pods is inclusive
session = podmanTest.Podman([]string{"ps", "-q", "--no-trunc", "--filter", "pod=pod1", "--filter", "pod=pod2"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(4))
+ Expect(session.OutputToStringArray()).To(HaveLen(4))
Expect(session.OutputToStringArray()).To(ContainElement(con1.OutputToString()))
Expect(session.OutputToStringArray()).To(ContainElement(con2.OutputToString()))
diff --git a/test/e2e/pull_test.go b/test/e2e/pull_test.go
index b2474b223..f22acca6e 100644
--- a/test/e2e/pull_test.go
+++ b/test/e2e/pull_test.go
@@ -443,7 +443,7 @@ var _ = Describe("Podman pull", func() {
Expect(setup).Should(Exit(0))
data := setup.InspectImageJSON() // returns []inspect.ImageData
- Expect(len(data)).To(Equal(1))
+ Expect(data).To(HaveLen(1))
return data[0].ID
}
@@ -457,8 +457,8 @@ var _ = Describe("Podman pull", func() {
Expect(setup).Should(Exit(0))
data := setup.InspectImageJSON() // returns []inspect.ImageData
- Expect(len(data)).To(Equal(1))
- Expect(len(data[0].RepoTags)).To(Equal(0))
+ Expect(data).To(HaveLen(1))
+ Expect(data[0].RepoTags).To(BeEmpty())
}
tag := func(image, tag string) {
@@ -511,8 +511,8 @@ var _ = Describe("Podman pull", func() {
Expect(setup).Should(Exit(0))
data := setup.InspectImageJSON() // returns []inspect.ImageData
- Expect(len(data)).To(Equal(1))
- Expect(len(data[0].RepoTags)).To(Equal(1))
+ Expect(data).To(HaveLen(1))
+ Expect(data[0].RepoTags).To(HaveLen(1))
Expect(data[0].RepoTags[0]).To(Equal(t.tag1))
Expect(data[0].ID).To(Equal(image1))
}
@@ -540,7 +540,7 @@ var _ = Describe("Podman pull", func() {
Expect(setup).Should(Exit(0))
data := setup.InspectImageJSON() // returns []inspect.ImageData
- Expect(len(data)).To(Equal(1))
+ Expect(data).To(HaveLen(1))
Expect(data[0].Os).To(Equal(runtime.GOOS))
Expect(data[0].Architecture).To(Equal("arm64"))
})
@@ -567,7 +567,7 @@ var _ = Describe("Podman pull", func() {
Expect(setup).Should(Exit(0))
data := setup.InspectImageJSON() // returns []inspect.ImageData
- Expect(len(data)).To(Equal(1))
+ Expect(data).To(HaveLen(1))
Expect(data[0].Os).To(Equal(runtime.GOOS))
Expect(data[0].Architecture).To(Equal("arm64"))
})
diff --git a/test/e2e/rmi_test.go b/test/e2e/rmi_test.go
index 2c2a9688e..658155587 100644
--- a/test/e2e/rmi_test.go
+++ b/test/e2e/rmi_test.go
@@ -136,13 +136,13 @@ var _ = Describe("Podman rmi", func() {
session = podmanTest.Podman([]string{"images", "-q"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(12))
+ Expect(session.OutputToStringArray()).To(HaveLen(12))
session = podmanTest.Podman([]string{"images", "--sort", "created", "--format", "{{.Id}}", "--all"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(13),
- "Output from 'podman images -q -a':'%s'", session.Out.Contents())
+ Expect(session.OutputToStringArray()).To(HaveLen(13),
+ "Output from 'podman images -q -a'")
untaggedImg := session.OutputToStringArray()[1]
session = podmanTest.Podman([]string{"rmi", "-f", untaggedImg})
@@ -179,7 +179,7 @@ var _ = Describe("Podman rmi", func() {
session = podmanTest.Podman([]string{"images", "-q"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(len(CACHE_IMAGES) + 1))
+ Expect(session.OutputToStringArray()).To(HaveLen(len(CACHE_IMAGES) + 1))
})
It("podman rmi with cached images", func() {
@@ -221,7 +221,7 @@ var _ = Describe("Podman rmi", func() {
session = podmanTest.Podman([]string{"images", "-q", "-a"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(len(CACHE_IMAGES) + 1))
+ Expect(session.OutputToStringArray()).To(HaveLen(len(CACHE_IMAGES) + 1))
podmanTest.BuildImage(dockerfile, "test3", "true")
@@ -236,7 +236,7 @@ var _ = Describe("Podman rmi", func() {
session = podmanTest.Podman([]string{"images", "-q", "-a"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToString())).To(Equal(155))
+ Expect(session.OutputToString()).To(HaveLen(155))
})
It("podman rmi -a with no images should be exit 0", func() {
@@ -267,7 +267,7 @@ RUN find $LOCAL
images := podmanTest.Podman([]string{"images", "-aq"})
images.WaitWithDefaultTimeout()
Expect(images).Should(Exit(0))
- Expect(len(images.OutputToStringArray())).To(Equal(len(CACHE_IMAGES)))
+ Expect(images.OutputToStringArray()).To(HaveLen(len(CACHE_IMAGES)))
})
// Don't rerun all tests; just assume that if we get that diagnostic,
diff --git a/test/e2e/run_entrypoint_test.go b/test/e2e/run_entrypoint_test.go
index 29f76bad1..23c343332 100644
--- a/test/e2e/run_entrypoint_test.go
+++ b/test/e2e/run_entrypoint_test.go
@@ -64,7 +64,7 @@ ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
})
It("podman run entrypoint with cmd", func() {
@@ -76,7 +76,7 @@ ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(4))
+ Expect(session.OutputToStringArray()).To(HaveLen(4))
})
It("podman run entrypoint with user cmd overrides image cmd", func() {
@@ -88,7 +88,7 @@ ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest", "-i"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(5))
+ Expect(session.OutputToStringArray()).To(HaveLen(5))
})
It("podman run entrypoint with user cmd no image cmd", func() {
@@ -99,7 +99,7 @@ ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest", "-i"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(5))
+ Expect(session.OutputToStringArray()).To(HaveLen(5))
})
It("podman run user entrypoint overrides image entrypoint and image cmd", func() {
diff --git a/test/e2e/run_env_test.go b/test/e2e/run_env_test.go
index 5a62db809..f27f5eda7 100644
--- a/test/e2e/run_env_test.go
+++ b/test/e2e/run_env_test.go
@@ -68,7 +68,7 @@ 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.OutputToString()).To(BeEmpty())
Expect(session).Should(Exit(1))
session = podmanTest.Podman([]string{"run", "--rm", ALPINE, "printenv"})
diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go
index 22ec27346..00db9b727 100644
--- a/test/e2e/run_networking_test.go
+++ b/test/e2e/run_networking_test.go
@@ -91,9 +91,9 @@ var _ = Describe("Podman run networking", func() {
session := podmanTest.Podman([]string{"create", "-t", "-p", "80", "--name", name, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
inspectOut := podmanTest.InspectContainer(name)
- Expect(len(inspectOut)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports["80/tcp"])).To(Equal(1))
+ Expect(inspectOut).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Not(Equal("80")))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal(""))
})
@@ -103,18 +103,18 @@ var _ = Describe("Podman run networking", func() {
session := podmanTest.Podman([]string{"create", "-t", "-p", "80-82", "-p", "8090:8090", "--name", name, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
inspectOut := podmanTest.InspectContainer(name)
- Expect(len(inspectOut)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(4))
- Expect(len(inspectOut[0].NetworkSettings.Ports["80/tcp"])).To(Equal(1))
+ Expect(inspectOut).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(4))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Not(Equal("80")))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal(""))
- Expect(len(inspectOut[0].NetworkSettings.Ports["81/tcp"])).To(Equal(1))
+ Expect(inspectOut[0].NetworkSettings.Ports["81/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["81/tcp"][0].HostPort).To(Not(Equal("81")))
Expect(inspectOut[0].NetworkSettings.Ports["81/tcp"][0].HostIP).To(Equal(""))
- Expect(len(inspectOut[0].NetworkSettings.Ports["82/tcp"])).To(Equal(1))
+ Expect(inspectOut[0].NetworkSettings.Ports["82/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["82/tcp"][0].HostPort).To(Not(Equal("82")))
Expect(inspectOut[0].NetworkSettings.Ports["82/tcp"][0].HostIP).To(Equal(""))
- Expect(len(inspectOut[0].NetworkSettings.Ports["8090/tcp"])).To(Equal(1))
+ Expect(inspectOut[0].NetworkSettings.Ports["8090/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["8090/tcp"][0].HostPort).To(Equal("8090"))
Expect(inspectOut[0].NetworkSettings.Ports["8090/tcp"][0].HostIP).To(Equal(""))
})
@@ -124,18 +124,18 @@ var _ = Describe("Podman run networking", func() {
session := podmanTest.Podman([]string{"create", "-t", "-p", "80-81", "-p", "8180-8181", "--name", name, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
inspectOut := podmanTest.InspectContainer(name)
- Expect(len(inspectOut)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(4))
- Expect(len(inspectOut[0].NetworkSettings.Ports["80/tcp"])).To(Equal(1))
+ Expect(inspectOut).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(4))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Not(Equal("80")))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal(""))
- Expect(len(inspectOut[0].NetworkSettings.Ports["81/tcp"])).To(Equal(1))
+ Expect(inspectOut[0].NetworkSettings.Ports["81/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["81/tcp"][0].HostPort).To(Not(Equal("81")))
Expect(inspectOut[0].NetworkSettings.Ports["81/tcp"][0].HostIP).To(Equal(""))
- Expect(len(inspectOut[0].NetworkSettings.Ports["8180/tcp"])).To(Equal(1))
+ Expect(inspectOut[0].NetworkSettings.Ports["8180/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["8180/tcp"][0].HostPort).To(Not(Equal("8180")))
Expect(inspectOut[0].NetworkSettings.Ports["8180/tcp"][0].HostIP).To(Equal(""))
- Expect(len(inspectOut[0].NetworkSettings.Ports["8181/tcp"])).To(Equal(1))
+ Expect(inspectOut[0].NetworkSettings.Ports["8181/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["8181/tcp"][0].HostPort).To(Not(Equal("8181")))
Expect(inspectOut[0].NetworkSettings.Ports["8181/tcp"][0].HostIP).To(Equal(""))
})
@@ -145,18 +145,18 @@ var _ = Describe("Podman run networking", func() {
session := podmanTest.Podman([]string{"create", "-t", "-p", "80", "-p", "8280-8282:8280-8282", "--name", name, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
inspectOut := podmanTest.InspectContainer(name)
- Expect(len(inspectOut)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(4))
- Expect(len(inspectOut[0].NetworkSettings.Ports["80/tcp"])).To(Equal(1))
+ Expect(inspectOut).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(4))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Not(Equal("80")))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal(""))
- Expect(len(inspectOut[0].NetworkSettings.Ports["8280/tcp"])).To(Equal(1))
+ Expect(inspectOut[0].NetworkSettings.Ports["8280/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["8280/tcp"][0].HostPort).To(Equal("8280"))
Expect(inspectOut[0].NetworkSettings.Ports["8280/tcp"][0].HostIP).To(Equal(""))
- Expect(len(inspectOut[0].NetworkSettings.Ports["8281/tcp"])).To(Equal(1))
+ Expect(inspectOut[0].NetworkSettings.Ports["8281/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["8281/tcp"][0].HostPort).To(Equal("8281"))
Expect(inspectOut[0].NetworkSettings.Ports["8281/tcp"][0].HostIP).To(Equal(""))
- Expect(len(inspectOut[0].NetworkSettings.Ports["8282/tcp"])).To(Equal(1))
+ Expect(inspectOut[0].NetworkSettings.Ports["8282/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["8282/tcp"][0].HostPort).To(Equal("8282"))
Expect(inspectOut[0].NetworkSettings.Ports["8282/tcp"][0].HostIP).To(Equal(""))
})
@@ -166,9 +166,9 @@ var _ = Describe("Podman run networking", func() {
session := podmanTest.Podman([]string{"create", "-t", "-p", "8380:80", "--name", name, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
inspectOut := podmanTest.InspectContainer(name)
- Expect(len(inspectOut)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports["80/tcp"])).To(Equal(1))
+ Expect(inspectOut).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Equal("8380"))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal(""))
})
@@ -179,10 +179,10 @@ var _ = Describe("Podman run networking", func() {
session := podmanTest.Podman([]string{"create", "-t", "-p", "8480:80/TCP", "--name", name, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
inspectOut := podmanTest.InspectContainer(name)
- Expect(len(inspectOut)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1))
+ Expect(inspectOut).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1))
// "tcp" in lower characters
- Expect(len(inspectOut[0].NetworkSettings.Ports["80/tcp"])).To(Equal(1))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Equal("8480"))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal(""))
})
@@ -192,9 +192,9 @@ var _ = Describe("Podman run networking", func() {
session := podmanTest.Podman([]string{"create", "-t", "-p", "80/udp", "--name", name, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
inspectOut := podmanTest.InspectContainer(name)
- Expect(len(inspectOut)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports["80/udp"])).To(Equal(1))
+ Expect(inspectOut).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/udp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostPort).To(Not(Equal("80")))
Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostIP).To(Equal(""))
})
@@ -204,9 +204,9 @@ var _ = Describe("Podman run networking", func() {
session := podmanTest.Podman([]string{"create", "-t", "-p", "127.0.0.1:8580:80", "--name", name, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
inspectOut := podmanTest.InspectContainer(name)
- Expect(len(inspectOut)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports["80/tcp"])).To(Equal(1))
+ Expect(inspectOut).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Equal("8580"))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal("127.0.0.1"))
})
@@ -216,9 +216,9 @@ var _ = Describe("Podman run networking", func() {
session := podmanTest.Podman([]string{"create", "-t", "-p", "127.0.0.1:8680:80/udp", "--name", name, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
inspectOut := podmanTest.InspectContainer(name)
- Expect(len(inspectOut)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports["80/udp"])).To(Equal(1))
+ Expect(inspectOut).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/udp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostPort).To(Equal("8680"))
Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostIP).To(Equal("127.0.0.1"))
})
@@ -228,9 +228,9 @@ var _ = Describe("Podman run networking", func() {
session := podmanTest.Podman([]string{"create", "-t", "-p", "[::1]:8780:80/udp", "--name", name, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
inspectOut := podmanTest.InspectContainer(name)
- Expect(len(inspectOut)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports["80/udp"])).To(Equal(1))
+ Expect(inspectOut).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/udp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostPort).To(Equal("8780"))
Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostIP).To(Equal("::1"))
})
@@ -240,9 +240,9 @@ var _ = Describe("Podman run networking", func() {
session := podmanTest.Podman([]string{"create", "-t", "-p", "[::1]:8880:80/tcp", "--name", name, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
inspectOut := podmanTest.InspectContainer(name)
- Expect(len(inspectOut)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports["80/tcp"])).To(Equal(1))
+ Expect(inspectOut).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Equal("8880"))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal("::1"))
})
@@ -252,9 +252,9 @@ var _ = Describe("Podman run networking", func() {
session := podmanTest.Podman([]string{"create", "-t", "--expose", "80", "-P", "--name", name, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
inspectOut := podmanTest.InspectContainer(name)
- Expect(len(inspectOut)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports["80/tcp"])).To(Equal(1))
+ Expect(inspectOut).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Not(Equal("0")))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal(""))
})
@@ -264,9 +264,9 @@ var _ = Describe("Podman run networking", func() {
session := podmanTest.Podman([]string{"create", "-t", "--expose", "80/udp", "-P", "--name", name, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
inspectOut := podmanTest.InspectContainer(name)
- Expect(len(inspectOut)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports["80/udp"])).To(Equal(1))
+ Expect(inspectOut).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/udp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostPort).To(Not(Equal("0")))
Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostIP).To(Equal(""))
})
@@ -276,9 +276,9 @@ var _ = Describe("Podman run networking", func() {
session := podmanTest.Podman([]string{"create", "-t", "--expose", "80", "-p", "80", "--name", name, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
inspectOut := podmanTest.InspectContainer(name)
- Expect(len(inspectOut)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports["80/tcp"])).To(Equal(1))
+ Expect(inspectOut).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Not(Equal("80")))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal(""))
})
@@ -297,8 +297,8 @@ EXPOSE 2004-2005/tcp`, ALPINE)
inspect := podmanTest.Podman([]string{"inspect", imageName})
inspect.WaitWithDefaultTimeout()
image := inspect.InspectImageJSON()
- Expect(len(image)).To(Equal(1))
- Expect(len(image[0].Config.ExposedPorts)).To(Equal(3))
+ Expect(image).To(HaveLen(1))
+ Expect(image[0].Config.ExposedPorts).To(HaveLen(3))
Expect(image[0].Config.ExposedPorts).To(HaveKey("2002/tcp"))
Expect(image[0].Config.ExposedPorts).To(HaveKey("2001-2003/tcp"))
Expect(image[0].Config.ExposedPorts).To(HaveKey("2004-2005/tcp"))
@@ -307,11 +307,11 @@ EXPOSE 2004-2005/tcp`, ALPINE)
session := podmanTest.Podman([]string{"create", "--name", containerName, imageName, "true"})
session.WaitWithDefaultTimeout()
inspectOut := podmanTest.InspectContainer(containerName)
- Expect(len(inspectOut)).To(Equal(1))
+ Expect(inspectOut).To(HaveLen(1))
// Inspect the network settings with available ports to be mapped to the host
// Don't need to verity HostConfig.PortBindings since we used --publish-all
- Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(5))
+ Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(5))
Expect(inspectOut[0].NetworkSettings.Ports).To(HaveKey("2001/tcp"))
Expect(inspectOut[0].NetworkSettings.Ports).To(HaveKey("2002/tcp"))
Expect(inspectOut[0].NetworkSettings.Ports).To(HaveKey("2003/tcp"))
@@ -324,9 +324,9 @@ EXPOSE 2004-2005/tcp`, ALPINE)
session := podmanTest.Podman([]string{"create", "-t", "-p", "127.0.0.1::8980/udp", "--name", name, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
inspectOut := podmanTest.InspectContainer(name)
- Expect(len(inspectOut)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports["8980/udp"])).To(Equal(1))
+ Expect(inspectOut).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Ports["8980/udp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["8980/udp"][0].HostPort).To(Not(Equal("8980")))
Expect(inspectOut[0].NetworkSettings.Ports["8980/udp"][0].HostIP).To(Equal("127.0.0.1"))
})
@@ -336,9 +336,9 @@ EXPOSE 2004-2005/tcp`, ALPINE)
session := podmanTest.Podman([]string{"create", "-t", "-p", ":8181", "--name", name, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
inspectOut := podmanTest.InspectContainer(name)
- Expect(len(inspectOut)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports["8181/tcp"])).To(Equal(1))
+ Expect(inspectOut).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Ports["8181/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["8181/tcp"][0].HostPort).To(Not(Equal("8181")))
Expect(inspectOut[0].NetworkSettings.Ports["8181/tcp"][0].HostIP).To(Equal(""))
})
@@ -348,9 +348,9 @@ EXPOSE 2004-2005/tcp`, ALPINE)
session := podmanTest.Podman([]string{"create", "-t", "-p", "4444:8080", "-p", "5555:8080", "--name", name, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
inspectOut := podmanTest.InspectContainer(name)
- Expect(len(inspectOut)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports["8080/tcp"])).To(Equal(2))
+ Expect(inspectOut).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Ports["8080/tcp"]).To(HaveLen(2))
hp1 := inspectOut[0].NetworkSettings.Ports["8080/tcp"][0].HostPort
hp2 := inspectOut[0].NetworkSettings.Ports["8080/tcp"][1].HostPort
@@ -364,9 +364,9 @@ EXPOSE 2004-2005/tcp`, ALPINE)
session := podmanTest.Podman([]string{"create", "-t", "-p", "0.0.0.0:9280:80", "--name", name, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
inspectOut := podmanTest.InspectContainer(name)
- Expect(len(inspectOut)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports["80/tcp"])).To(Equal(1))
+ Expect(inspectOut).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Equal("9280"))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal(""))
})
@@ -526,7 +526,7 @@ EXPOSE 2004-2005/tcp`, ALPINE)
containerConfig := inspect.InspectContainerToJSON()
Expect(containerConfig[0].NetworkSettings.Ports).To(Not(BeNil()))
- Expect(containerConfig[0].NetworkSettings.Ports["80/tcp"]).To(Not(BeNil()))
+ Expect(containerConfig[0].NetworkSettings.Ports).To(HaveKeyWithValue("80/tcp", Not(BeNil())))
Expect(containerConfig[0].NetworkSettings.Ports["80/tcp"][0].HostPort).ToNot(Equal(80))
})
@@ -863,8 +863,8 @@ EXPOSE 2004-2005/tcp`, ALPINE)
Expect(ctr).Should(Exit(0))
inspectOut := podmanTest.InspectContainer(ctrName)
- Expect(len(inspectOut)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Networks)).To(Equal(1))
+ Expect(inspectOut).To(HaveLen(1))
+ Expect(inspectOut[0].NetworkSettings.Networks).To(HaveLen(1))
Expect(inspectOut[0].NetworkSettings.Networks).To(HaveKey("podman"))
})
})
diff --git a/test/e2e/run_privileged_test.go b/test/e2e/run_privileged_test.go
index f1084a3d2..b894c7b1c 100644
--- a/test/e2e/run_privileged_test.go
+++ b/test/e2e/run_privileged_test.go
@@ -122,7 +122,7 @@ var _ = Describe("Podman privileged container tests", func() {
session := podmanTest.Podman([]string{"run", "-t", BB, "ls", "-l", "/dev"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(17))
+ Expect(session.OutputToStringArray()).To(HaveLen(17))
})
It("podman privileged should inherit host devices", func() {
diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go
index 3d4c1240e..f063c79e9 100644
--- a/test/e2e/run_test.go
+++ b/test/e2e/run_test.go
@@ -289,7 +289,7 @@ var _ = Describe("Podman run", func() {
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"))
+ Expect(conData[0].Config.Annotations).To(HaveKeyWithValue("io.podman.annotations.init", "TRUE"))
})
It("podman run a container with --init and --init-path", func() {
@@ -301,7 +301,7 @@ var _ = Describe("Podman run", func() {
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"))
+ Expect(conData[0].Config.Annotations).To(HaveKeyWithValue("io.podman.annotations.init", "TRUE"))
})
It("podman run a container without --init", func() {
@@ -313,7 +313,7 @@ var _ = Describe("Podman run", func() {
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"))
+ Expect(conData[0].Config.Annotations).To(HaveKeyWithValue("io.podman.annotations.init", "FALSE"))
})
forbidGetCWDSeccompProfile := func() string {
@@ -1186,7 +1186,7 @@ USER mail`, BB)
session := podmanTest.Podman([]string{"run", "--mount", "type=bind,bind-nonrecursive,slave,src=/,target=/host", fedoraMinimal, "findmnt", "-nR", "/host"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(1))
+ Expect(session.OutputToStringArray()).To(HaveLen(1))
})
It("podman run --mount type=devpts,target=/foo/bar", func() {
@@ -1444,7 +1444,7 @@ USER mail`, BB)
// Get PID and get cgroups of that PID
inspectOut := podmanTest.InspectContainer(ctrName)
- Expect(len(inspectOut)).To(Equal(1))
+ Expect(inspectOut).To(HaveLen(1))
pid := inspectOut[0].State.Pid
Expect(pid).To(Not(Equal(0)))
@@ -1897,7 +1897,7 @@ WORKDIR /madethis`, BB)
running := podmanTest.Podman([]string{"ps", "-q"})
running.WaitWithDefaultTimeout()
Expect(running).Should(Exit(0))
- Expect(len(running.OutputToStringArray())).To(Equal(2))
+ Expect(running.OutputToStringArray()).To(HaveLen(2))
})
It("podman run with pidfile", func() {
diff --git a/test/e2e/run_userns_test.go b/test/e2e/run_userns_test.go
index 50f8087f1..c1645af06 100644
--- a/test/e2e/run_userns_test.go
+++ b/test/e2e/run_userns_test.go
@@ -157,7 +157,7 @@ var _ = Describe("Podman UserNS support", func() {
m[l] = l
}
// check for no duplicates
- Expect(len(m)).To(Equal(5))
+ Expect(m).To(HaveLen(5))
})
It("podman --userns=auto:size=%d", func() {
diff --git a/test/e2e/run_volume_test.go b/test/e2e/run_volume_test.go
index 74aa69c96..3d05e0f70 100644
--- a/test/e2e/run_volume_test.go
+++ b/test/e2e/run_volume_test.go
@@ -410,7 +410,7 @@ RUN sh -c "cd /etc/apk && ln -s ../../testfile"`, ALPINE)
list2.WaitWithDefaultTimeout()
Expect(list2).Should(Exit(0))
arr := list2.OutputToStringArray()
- Expect(len(arr)).To(Equal(1))
+ Expect(arr).To(HaveLen(1))
Expect(arr[0]).To(Not(Equal("")))
})
@@ -429,7 +429,7 @@ RUN sh -c "cd /etc/apk && ln -s ../../testfile"`, ALPINE)
list2.WaitWithDefaultTimeout()
Expect(list2).Should(Exit(0))
arr := list2.OutputToStringArray()
- Expect(len(arr)).To(Equal(1))
+ Expect(arr).To(HaveLen(1))
Expect(arr[0]).To(Not(Equal("")))
remove := podmanTest.Podman([]string{"rm", "-v", ctrName})
@@ -458,7 +458,7 @@ RUN sh -c "cd /etc/apk && ln -s ../../testfile"`, ALPINE)
list2.WaitWithDefaultTimeout()
Expect(list2).Should(Exit(0))
arr := list2.OutputToStringArray()
- Expect(len(arr)).To(Equal(1))
+ Expect(arr).To(HaveLen(1))
Expect(arr[0]).To(Equal(volName))
remove := podmanTest.Podman([]string{"rm", "-v", ctrName})
@@ -469,7 +469,7 @@ RUN sh -c "cd /etc/apk && ln -s ../../testfile"`, ALPINE)
list3.WaitWithDefaultTimeout()
Expect(list3).Should(Exit(0))
arr2 := list3.OutputToStringArray()
- Expect(len(arr2)).To(Equal(1))
+ Expect(arr2).To(HaveLen(1))
Expect(arr2[0]).To(Equal(volName))
})
@@ -511,7 +511,7 @@ RUN sh -c "cd /etc/apk && ln -s ../../testfile"`, ALPINE)
runLs.WaitWithDefaultTimeout()
Expect(runLs).Should(Exit(0))
outputArr := runLs.OutputToStringArray()
- Expect(len(outputArr)).To(Equal(1))
+ Expect(outputArr).To(HaveLen(1))
Expect(outputArr[0]).To(ContainSubstring(fileName))
})
@@ -527,8 +527,8 @@ VOLUME /test/`, ALPINE)
Expect(create).Should(Exit(0))
data := podmanTest.InspectContainer(ctrName)
- Expect(len(data)).To(Equal(1))
- Expect(len(data[0].Mounts)).To(Equal(1))
+ Expect(data).To(HaveLen(1))
+ Expect(data[0].Mounts).To(HaveLen(1))
Expect(data[0].Mounts[0].Source).To(Equal("/tmp"))
Expect(data[0].Mounts[0].Destination).To(Equal("/test"))
})
@@ -626,7 +626,7 @@ VOLUME /test/`, ALPINE)
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).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
})
It("podman run with --volume and U flag", func() {
diff --git a/test/e2e/search_test.go b/test/e2e/search_test.go
index c67ef7ed2..5c8e7c064 100644
--- a/test/e2e/search_test.go
+++ b/test/e2e/search_test.go
@@ -175,12 +175,12 @@ registries = ['{{.Host}}:{{.Port}}']`
search = podmanTest.Podman([]string{"search", "--limit", "3", "docker.io/alpine"})
search.WaitWithDefaultTimeout()
Expect(search).Should(Exit(0))
- Expect(len(search.OutputToStringArray())).To(Equal(4))
+ Expect(search.OutputToStringArray()).To(HaveLen(4))
search = podmanTest.Podman([]string{"search", "--limit", "30", "docker.io/alpine"})
search.WaitWithDefaultTimeout()
Expect(search).Should(Exit(0))
- Expect(len(search.OutputToStringArray())).To(Equal(31))
+ Expect(search.OutputToStringArray()).To(HaveLen(31))
})
It("podman search with filter stars", func() {
@@ -462,7 +462,7 @@ registries = ['{{.Host}}:{{.Port}}']`
search := podmanTest.Podman([]string{"search", "--limit", "30", "registry.redhat.io/*"})
search.WaitWithDefaultTimeout()
Expect(search).Should(Exit(0))
- Expect(len(search.OutputToStringArray())).To(Equal(31))
+ Expect(search.OutputToStringArray()).To(HaveLen(31))
search = podmanTest.Podman([]string{"search", "registry.redhat.io/*openshift*"})
search.WaitWithDefaultTimeout()
@@ -474,7 +474,7 @@ registries = ['{{.Host}}:{{.Port}}']`
search := podmanTest.Podman([]string{"search", "--list-tags", "--limit", "30", "docker.io/library/alpine"})
search.WaitWithDefaultTimeout()
Expect(search).Should(Exit(0))
- Expect(len(search.OutputToStringArray())).To(Equal(31))
+ Expect(search.OutputToStringArray()).To(HaveLen(31))
search = podmanTest.Podman([]string{"search", "--list-tags", "docker.io/library/alpine"})
search.WaitWithDefaultTimeout()
diff --git a/test/e2e/secret_test.go b/test/e2e/secret_test.go
index 758ed7edc..661ebbdc0 100644
--- a/test/e2e/secret_test.go
+++ b/test/e2e/secret_test.go
@@ -141,7 +141,7 @@ var _ = Describe("Podman secret", func() {
list := podmanTest.Podman([]string{"secret", "ls"})
list.WaitWithDefaultTimeout()
Expect(list).Should(Exit(0))
- Expect(len(list.OutputToStringArray())).To(Equal(2))
+ Expect(list.OutputToStringArray()).To(HaveLen(2))
})
@@ -158,7 +158,7 @@ var _ = Describe("Podman secret", func() {
list.WaitWithDefaultTimeout()
Expect(list).Should(Exit(0))
- Expect(len(list.OutputToStringArray())).To(Equal(2), list.OutputToString())
+ Expect(list.OutputToStringArray()).To(HaveLen(2), list.OutputToString())
})
It("podman secret rm", func() {
@@ -179,7 +179,7 @@ var _ = Describe("Podman secret", func() {
session = podmanTest.Podman([]string{"secret", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(1))
+ Expect(session.OutputToStringArray()).To(HaveLen(1))
})
It("podman secret rm --all", func() {
@@ -201,7 +201,7 @@ var _ = Describe("Podman secret", func() {
session = podmanTest.Podman([]string{"secret", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(1))
+ Expect(session.OutputToStringArray()).To(HaveLen(1))
})
It("podman secret creates from environment variable", func() {
diff --git a/test/e2e/stats_test.go b/test/e2e/stats_test.go
index a58e2485c..83a4896d5 100644
--- a/test/e2e/stats_test.go
+++ b/test/e2e/stats_test.go
@@ -213,7 +213,7 @@ var _ = Describe("Podman stats", func() {
// We have three containers. The unlimited ones need to have
// the same limit, the limited one a lower one.
limits := session.OutputToStringArray()
- Expect(len(limits)).To(BeNumerically("==", 3))
+ Expect(limits).To(HaveLen(3))
Expect(limits[0]).To(Equal(limits[1]))
Expect(limits[0]).ToNot(Equal(limits[2]))
diff --git a/test/e2e/system_connection_test.go b/test/e2e/system_connection_test.go
index 76b442ce8..95c2fe5b6 100644
--- a/test/e2e/system_connection_test.go
+++ b/test/e2e/system_connection_test.go
@@ -236,7 +236,7 @@ var _ = Describe("podman system connection", func() {
session := podmanTest.Podman(cmd)
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).Should(Equal(1))
+ Expect(session.OutputToStringArray()).Should(HaveLen(1))
Expect(session.Err.Contents()).Should(BeEmpty())
})
})
diff --git a/test/e2e/system_df_test.go b/test/e2e/system_df_test.go
index 4dc1f3591..acb6530cf 100644
--- a/test/e2e/system_df_test.go
+++ b/test/e2e/system_df_test.go
@@ -57,7 +57,7 @@ var _ = Describe("podman system df", func() {
session = podmanTest.Podman([]string{"system", "df"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(4))
+ Expect(session.OutputToStringArray()).To(HaveLen(4))
images := strings.Fields(session.OutputToStringArray()[1])
containers := strings.Fields(session.OutputToStringArray()[2])
volumes := strings.Fields(session.OutputToStringArray()[3])
diff --git a/test/e2e/system_reset_test.go b/test/e2e/system_reset_test.go
index 93ab166cd..812e98cfd 100644
--- a/test/e2e/system_reset_test.go
+++ b/test/e2e/system_reset_test.go
@@ -69,16 +69,16 @@ var _ = Describe("podman system reset", func() {
session = podmanTest.Podman([]string{"images", "-n"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(l))
+ Expect(session.OutputToStringArray()).To(HaveLen(l))
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(0))
+ Expect(session.OutputToStringArray()).To(BeEmpty())
session = podmanTest.Podman([]string{"container", "ls", "-q"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(0))
+ Expect(session.OutputToStringArray()).To(BeEmpty())
})
})
diff --git a/test/e2e/systemd_test.go b/test/e2e/systemd_test.go
index bbbec1648..1f237fc9e 100644
--- a/test/e2e/systemd_test.go
+++ b/test/e2e/systemd_test.go
@@ -99,7 +99,7 @@ WantedBy=default.target
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
conData := result.InspectContainerToJSON()
- Expect(len(conData)).To(Equal(1))
+ Expect(conData).To(HaveLen(1))
Expect(conData[0].Config.SystemdMode).To(BeTrue())
// stats not supported w/ CGv1 rootless or containerized
@@ -126,7 +126,7 @@ WantedBy=default.target
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
conData := result.InspectContainerToJSON()
- Expect(len(conData)).To(Equal(1))
+ Expect(conData).To(HaveLen(1))
Expect(conData[0].Config.SystemdMode).To(BeTrue())
})
@@ -155,7 +155,7 @@ WantedBy=default.target
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
conData := result.InspectContainerToJSON()
- Expect(len(conData)).To(Equal(1))
+ Expect(conData).To(HaveLen(1))
Expect(conData[0].Config.SystemdMode).To(BeTrue())
})
diff --git a/test/e2e/trust_test.go b/test/e2e/trust_test.go
index 9a0d57d7a..9909c0653 100644
--- a/test/e2e/trust_test.go
+++ b/test/e2e/trust_test.go
@@ -43,7 +43,7 @@ var _ = Describe("Podman trust", func() {
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
outArray := session.OutputToStringArray()
- Expect(len(outArray)).To(Equal(3))
+ Expect(outArray).To(HaveLen(3))
// Repository order is not guaranteed. So, check that
// all expected lines appear in output; we also check total number of lines, so that handles all of them.
@@ -69,7 +69,7 @@ var _ = Describe("Podman trust", func() {
if err != nil {
os.Exit(1)
}
- Expect(teststruct["default"][0]["type"]).To(Equal("insecureAcceptAnything"))
+ Expect(teststruct["default"][0]).To(HaveKeyWithValue("type", "insecureAcceptAnything"))
})
It("podman image trust show --json", func() {
@@ -79,7 +79,7 @@ var _ = Describe("Podman trust", func() {
Expect(session.OutputToString()).To(BeValidJSON())
var teststruct []map[string]string
json.Unmarshal(session.Out.Contents(), &teststruct)
- Expect(len(teststruct)).To(Equal(3))
+ Expect(teststruct).To(HaveLen(3))
// To ease comparison, group the unordered array of repos by repo (and we expect only one entry by repo, so order within groups doesn’t matter)
repoMap := map[string][]map[string]string{}
for _, e := range teststruct {
diff --git a/test/e2e/volume_create_test.go b/test/e2e/volume_create_test.go
index 90a9bfb0b..bd609943c 100644
--- a/test/e2e/volume_create_test.go
+++ b/test/e2e/volume_create_test.go
@@ -43,7 +43,7 @@ var _ = Describe("Podman volume create", func() {
check := podmanTest.Podman([]string{"volume", "ls", "-q"})
check.WaitWithDefaultTimeout()
Expect(check.OutputToString()).To(ContainSubstring(volName))
- Expect(len(check.OutputToStringArray())).To(Equal(1))
+ Expect(check.OutputToStringArray()).To(HaveLen(1))
})
It("podman create volume with name", func() {
@@ -55,7 +55,7 @@ var _ = Describe("Podman volume create", func() {
check := podmanTest.Podman([]string{"volume", "ls", "-q"})
check.WaitWithDefaultTimeout()
Expect(check.OutputToString()).To(ContainSubstring(volName))
- Expect(len(check.OutputToStringArray())).To(Equal(1))
+ Expect(check.OutputToStringArray()).To(HaveLen(1))
})
It("podman create and export volume", func() {
diff --git a/test/e2e/volume_inspect_test.go b/test/e2e/volume_inspect_test.go
index 172063b90..3fcdb7728 100644
--- a/test/e2e/volume_inspect_test.go
+++ b/test/e2e/volume_inspect_test.go
@@ -71,7 +71,7 @@ var _ = Describe("Podman volume inspect", func() {
session = podmanTest.Podman([]string{"volume", "inspect", "--format", "{{.Name}}", "--all"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
Expect(session.OutputToStringArray()[0]).To(Equal(volName1))
Expect(session.OutputToStringArray()[1]).To(Equal(volName2))
})
diff --git a/test/e2e/volume_ls_test.go b/test/e2e/volume_ls_test.go
index c1214366b..52b805718 100644
--- a/test/e2e/volume_ls_test.go
+++ b/test/e2e/volume_ls_test.go
@@ -42,7 +42,7 @@ var _ = Describe("Podman volume ls", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
})
It("podman ls volume filter with a key pattern", func() {
@@ -53,7 +53,7 @@ var _ = Describe("Podman volume ls", func() {
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "label=hello*"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
})
It("podman ls volume with JSON format", func() {
@@ -76,7 +76,7 @@ var _ = Describe("Podman volume ls", func() {
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(1), session.OutputToString())
+ Expect(session.OutputToStringArray()).To(HaveLen(1), session.OutputToString())
})
It("podman ls volume with --filter flag", func() {
@@ -92,24 +92,24 @@ var _ = Describe("Podman volume ls", func() {
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "label=foo"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
Expect(session.OutputToStringArray()[1]).To(ContainSubstring(volName))
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "label=foo=foo"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(0))
+ Expect(session.OutputToStringArray()).To(BeEmpty())
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "label=foo=bar"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
Expect(session.OutputToStringArray()[1]).To(ContainSubstring(volName))
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "label=foo=baz"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(0))
+ Expect(session.OutputToStringArray()).To(BeEmpty())
})
It("podman ls volume with --filter until flag", func() {
@@ -120,12 +120,12 @@ var _ = Describe("Podman volume ls", func() {
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "until=5000000000"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "until=50000"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(0))
+ Expect(session.OutputToStringArray()).To(BeEmpty())
})
It("podman volume ls with --filter dangling", func() {
@@ -171,14 +171,14 @@ var _ = Describe("Podman volume ls", func() {
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "label=foo", "--filter", "label=foo2"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(3))
+ Expect(session.OutputToStringArray()).To(HaveLen(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).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(3))
+ Expect(session.OutputToStringArray()).To(HaveLen(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 cdf635b14..a3a445866 100644
--- a/test/e2e/volume_plugin_test.go
+++ b/test/e2e/volume_plugin_test.go
@@ -72,7 +72,7 @@ var _ = Describe("Podman volume plugins", func() {
ls1.WaitWithDefaultTimeout()
Expect(ls1).Should(Exit(0))
arrOutput := ls1.OutputToStringArray()
- Expect(len(arrOutput)).To(Equal(1))
+ Expect(arrOutput).To(HaveLen(1))
Expect(arrOutput[0]).To(ContainSubstring(volName))
remove := podmanTest.Podman([]string{"volume", "rm", volName})
@@ -82,7 +82,7 @@ var _ = Describe("Podman volume plugins", func() {
ls2 := podmanTest.Podman([]string{"volume", "ls", "-q"})
ls2.WaitWithDefaultTimeout()
Expect(ls2).Should(Exit(0))
- Expect(len(ls2.OutputToStringArray())).To(Equal(0))
+ Expect(ls2.OutputToStringArray()).To(BeEmpty())
})
It("volume inspect with running plugin succeeds", func() {
@@ -130,7 +130,7 @@ var _ = Describe("Podman volume plugins", func() {
ls1.WaitWithDefaultTimeout()
Expect(ls1).Should(Exit(0))
arrOutput := ls1.OutputToStringArray()
- Expect(len(arrOutput)).To(Equal(1))
+ Expect(arrOutput).To(HaveLen(1))
Expect(arrOutput[0]).To(ContainSubstring(volName))
stop := podmanTest.Podman([]string{"stop", "--timeout", "0", ctrName})
@@ -146,7 +146,7 @@ var _ = Describe("Podman volume plugins", func() {
ls2 := podmanTest.Podman([]string{"volume", "ls", "-q"})
ls2.WaitWithDefaultTimeout()
Expect(ls2).Should(Exit(0))
- Expect(len(ls2.OutputToStringArray())).To(Equal(0))
+ Expect(ls2.OutputToStringArray()).To(BeEmpty())
})
It("use plugin in containers", func() {
diff --git a/test/e2e/volume_prune_test.go b/test/e2e/volume_prune_test.go
index 364ca0ab7..9ea8b1d25 100644
--- a/test/e2e/volume_prune_test.go
+++ b/test/e2e/volume_prune_test.go
@@ -49,7 +49,7 @@ var _ = Describe("Podman volume prune", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(4))
+ Expect(session.OutputToStringArray()).To(HaveLen(4))
session = podmanTest.Podman([]string{"volume", "prune", "--force"})
session.WaitWithDefaultTimeout()
@@ -58,7 +58,7 @@ var _ = Describe("Podman volume prune", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
podmanTest.Cleanup()
})
@@ -71,7 +71,7 @@ var _ = Describe("Podman volume prune", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
session = podmanTest.Podman([]string{"volume", "prune", "--force", "--filter", "until=50"})
session.WaitWithDefaultTimeout()
@@ -80,7 +80,7 @@ var _ = Describe("Podman volume prune", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
session = podmanTest.Podman([]string{"volume", "prune", "--force", "--filter", "until=5000000000"})
session.WaitWithDefaultTimeout()
@@ -89,7 +89,7 @@ var _ = Describe("Podman volume prune", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(0))
+ Expect(session.OutputToStringArray()).To(BeEmpty())
podmanTest.Cleanup()
})
@@ -122,7 +122,7 @@ var _ = Describe("Podman volume prune", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(7))
+ Expect(session.OutputToStringArray()).To(HaveLen(7))
session = podmanTest.Podman([]string{"volume", "prune", "--force", "--filter", "label=label1=value1"})
session.WaitWithDefaultTimeout()
@@ -131,7 +131,7 @@ var _ = Describe("Podman volume prune", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(6))
+ Expect(session.OutputToStringArray()).To(HaveLen(6))
session = podmanTest.Podman([]string{"volume", "prune", "--force", "--filter", "label=sharedlabel1=slv1"})
session.WaitWithDefaultTimeout()
@@ -140,7 +140,7 @@ var _ = Describe("Podman volume prune", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(5))
+ Expect(session.OutputToStringArray()).To(HaveLen(5))
session = podmanTest.Podman([]string{"volume", "prune", "--force", "--filter", "label=sharedlabel1"})
session.WaitWithDefaultTimeout()
@@ -149,7 +149,7 @@ var _ = Describe("Podman volume prune", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(3))
+ Expect(session.OutputToStringArray()).To(HaveLen(3))
podmanTest.Cleanup()
})
@@ -170,7 +170,7 @@ var _ = Describe("Podman volume prune", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(4))
+ Expect(session.OutputToStringArray()).To(HaveLen(4))
session = podmanTest.Podman([]string{"system", "prune", "--force", "--volumes"})
session.WaitWithDefaultTimeout()
@@ -179,7 +179,7 @@ var _ = Describe("Podman volume prune", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(0))
+ Expect(session.OutputToStringArray()).To(BeEmpty())
podmanTest.Cleanup()
})
diff --git a/test/e2e/volume_rm_test.go b/test/e2e/volume_rm_test.go
index a05c1b593..68d94963a 100644
--- a/test/e2e/volume_rm_test.go
+++ b/test/e2e/volume_rm_test.go
@@ -45,7 +45,7 @@ var _ = Describe("Podman volume rm", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(0))
+ Expect(session.OutputToStringArray()).To(BeEmpty())
})
It("podman volume rm with --force flag", func() {
@@ -66,7 +66,7 @@ var _ = Describe("Podman volume rm", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(0))
+ Expect(session.OutputToStringArray()).To(BeEmpty())
podmanTest.Cleanup()
})
@@ -93,7 +93,7 @@ var _ = Describe("Podman volume rm", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(0))
+ Expect(session.OutputToStringArray()).To(BeEmpty())
})
It("podman volume rm by partial name", func() {
@@ -108,7 +108,7 @@ var _ = Describe("Podman volume rm", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(0))
+ Expect(session.OutputToStringArray()).To(BeEmpty())
})
It("podman volume rm by nonunique partial name", func() {
diff --git a/test/system/010-images.bats b/test/system/010-images.bats
index 1e9d5f181..9de31f96c 100644
--- a/test/system/010-images.bats
+++ b/test/system/010-images.bats
@@ -221,9 +221,7 @@ Labels.created_at | 20[0-9-]\\\+T[0-9:]\\\+Z
iid=${output:0:12}
# Run the test: this will output three column-aligned rows. Test them.
- # Tab character (\t) should have the same effect as the 'table' directive
_run_format_test 'table' 'table {{.Repository}} {{.Tag}} {{.ID}}'
- _run_format_test 'tabs' '{{.Repository}}\t{{.Tag}}\t{{.ID}}'
# Clean up.
run_podman rmi ${aaa_name}:${aaa_tag} ${zzz_name}:${zzz_tag}
diff --git a/test/system/110-history.bats b/test/system/110-history.bats
index 75c15b088..0f6d75cb3 100644
--- a/test/system/110-history.bats
+++ b/test/system/110-history.bats
@@ -21,6 +21,14 @@ load helpers
done
}
+@test "podman history - custom format" {
+ run_podman history --format "{{.ID}}\t{{.ID}}" $IMAGE
+ od -c <<<$output
+ while IFS= read -r row; do
+ is "$row" ".* .*$"
+ done <<<$output
+}
+
@test "podman history - json" {
# Sigh. Timestamp in .created can be '...Z' or '...-06:00'
tests="
diff --git a/test/utils/utils.go b/test/utils/utils.go
index 944c1ac3c..f41024072 100644
--- a/test/utils/utils.go
+++ b/test/utils/utils.go
@@ -36,7 +36,6 @@ type PodmanTestCommon interface {
type PodmanTest struct {
PodmanMakeOptions func(args []string, noEvents, noCache bool) []string
PodmanBinary string
- ArtifactPath string
TempDir string
RemoteTest bool
RemotePodmanBinary string