diff options
author | Ashley Cui <acui@redhat.com> | 2021-06-29 14:56:15 -0400 |
---|---|---|
committer | Ashley Cui <acui@redhat.com> | 2021-06-29 14:57:11 -0400 |
commit | 3e8c0e00de5d29de31005f4932147548f256a194 (patch) | |
tree | d627d1db71a938cdaeddee478c638d6c2493bf62 /cmd | |
parent | 599b7d746a6ccad6ebbd70abb72be30bead094a6 (diff) | |
download | podman-3e8c0e00de5d29de31005f4932147548f256a194.tar.gz podman-3e8c0e00de5d29de31005f4932147548f256a194.tar.bz2 podman-3e8c0e00de5d29de31005f4932147548f256a194.zip |
Make system connection ls deterministic
Sort system connection ls by name, making the output deterministic. Previously, we were just iterating through a map, which caused CI flakes.
Signed-off-by: Ashley Cui <acui@redhat.com>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/system/connection/list.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/cmd/podman/system/connection/list.go b/cmd/podman/system/connection/list.go index 2f74215c1..de85ce3fa 100644 --- a/cmd/podman/system/connection/list.go +++ b/cmd/podman/system/connection/list.go @@ -3,6 +3,7 @@ package connection import ( "fmt" "os" + "sort" "github.com/containers/common/pkg/completion" "github.com/containers/common/pkg/config" @@ -77,6 +78,10 @@ func list(cmd *cobra.Command, _ []string) error { rows = append(rows, r) } + sort.Slice(rows, func(i, j int) bool { + return rows[i].Name < rows[j].Name + }) + format := "{{.Name}}\t{{.Identity}}\t{{.URI}}\n" switch { case report.IsJSON(cmd.Flag("format").Value.String()): |