mirror of https://github.com/hashicorp/consul
Sort tags so output is deterministic.
parent
73452d48b2
commit
86918be323
|
@ -123,6 +123,7 @@ func (c *CatalogListServicesCommand) Run(args []string) int {
|
|||
var b bytes.Buffer
|
||||
tw := tabwriter.NewWriter(&b, 0, 2, 6, ' ', 0)
|
||||
for _, s := range order {
|
||||
sort.Strings(services[s])
|
||||
fmt.Fprintf(tw, "%s\t%s\n", s, strings.Join(services[s], ","))
|
||||
}
|
||||
if err := tw.Flush(); err != nil {
|
||||
|
|
|
@ -102,7 +102,7 @@ func TestCatalogListServicesCommand_Run(t *testing.T) {
|
|||
}
|
||||
|
||||
output := ui.OutputWriter.String()
|
||||
if expected := "foo,bar"; !strings.Contains(output, expected) {
|
||||
if expected := "bar,foo"; !strings.Contains(output, expected) {
|
||||
t.Errorf("expected %q to contain %q", output, expected)
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue