Sort tags so output is deterministic.

This commit is contained in:
James Phillips 2017-07-14 17:00:08 -07:00
parent 1f8c79cdb5
commit 3c5a36357c
No known key found for this signature in database
GPG Key ID: 77183E682AC5FC11
2 changed files with 2 additions and 1 deletions

View File

@ -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 {

View File

@ -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)
}
})