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.
@@ -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()):
