From 3c5a36357c8a87012e0802d8fc5863f438ad9abb Mon Sep 17 00:00:00 2001 From: James Phillips Date: Fri, 14 Jul 2017 17:00:08 -0700 Subject: [PATCH] Sort tags so output is deterministic. --- command/catalog_list_services.go | 1 + command/catalog_list_services_test.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/command/catalog_list_services.go b/command/catalog_list_services.go index cfd76923f..427b65566 100644 --- a/command/catalog_list_services.go +++ b/command/catalog_list_services.go @@ -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 { diff --git a/command/catalog_list_services_test.go b/command/catalog_list_services_test.go index 4e6be7c62..23eca94b2 100644 --- a/command/catalog_list_services_test.go +++ b/command/catalog_list_services_test.go @@ -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) } })