mirror of https://github.com/status-im/consul.git
Fix nondeterministic test (#18828)
This commit is contained in:
parent
1fda2965e8
commit
edf56ee970
|
@ -11,9 +11,11 @@ import (
|
|||
"strings"
|
||||
"text/tabwriter"
|
||||
|
||||
"github.com/mitchellh/cli"
|
||||
"golang.org/x/exp/maps"
|
||||
|
||||
"github.com/hashicorp/consul/api"
|
||||
"github.com/hashicorp/consul/command/flags"
|
||||
"github.com/mitchellh/cli"
|
||||
)
|
||||
|
||||
func New(ui cli.Ui) *cmd {
|
||||
|
@ -135,9 +137,11 @@ func formatNodesCounts(usageStats map[string]api.ServiceUsage) (string, error) {
|
|||
|
||||
fmt.Fprint(tw, "\t\n")
|
||||
|
||||
for dc, usage := range usageStats {
|
||||
nodesTotal += usage.Nodes
|
||||
fmt.Fprintf(tw, "%s\t%d\n", dc, usage.Nodes)
|
||||
nodes := maps.Keys(usageStats)
|
||||
sort.Strings(nodes)
|
||||
for _, dc := range nodes {
|
||||
nodesTotal += usageStats[dc].Nodes
|
||||
fmt.Fprintf(tw, "%s\t%d\n", dc, usageStats[dc].Nodes)
|
||||
}
|
||||
|
||||
fmt.Fprint(tw, "\t\n")
|
||||
|
|
Loading…
Reference in New Issue