From 3e8c0e00de5d29de31005f4932147548f256a194 Mon Sep 17 00:00:00 2001 From: Ashley Cui Date: Tue, 29 Jun 2021 14:56:15 -0400 Subject: 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 --- cmd/podman/system/connection/list.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'cmd/podman') 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()): -- cgit v1.2.3-54-g00ecf