From 2d1e1cc83ebb1dc632c62adea93c460b70c49329 Mon Sep 17 00:00:00 2001 From: Ian Delahorne Date: Mon, 30 Jun 2014 09:07:36 -0500 Subject: [PATCH] Sort AMI names in Artifact.String - fixes random test failures With go tip, the output from Artifact.String will sometimes be output in a different order than the tests. Sort the AMI strings before outputting. See https://travis-ci.org/mitchellh/packer/jobs/28748467 for an example of this failure. --- builder/amazon/common/artifact.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/builder/amazon/common/artifact.go b/builder/amazon/common/artifact.go index 3913833d7..3dc33b4b9 100644 --- a/builder/amazon/common/artifact.go +++ b/builder/amazon/common/artifact.go @@ -6,6 +6,7 @@ import ( "github.com/mitchellh/goamz/ec2" "github.com/mitchellh/packer/packer" "log" + "sort" "strings" ) @@ -46,6 +47,7 @@ func (a *Artifact) String() string { amiStrings = append(amiStrings, single) } + sort.Sort(sort.StringSlice(amiStrings)) return fmt.Sprintf("AMIs were created:\n\n%s", strings.Join(amiStrings, "\n")) }