From e3602127f9a81f5d5902c5a0cd7b0db4d1e495b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabio=20Badal=C3=AC?= Date: Wed, 9 Jun 2021 16:43:47 +0200 Subject: [PATCH] fix ordering of projects with parallel execution (#146) --- cmd/generate.go | 4 ++++ cmd/generate_test.go | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/generate.go b/cmd/generate.go index a0ce2ae5..27c32b4c 100644 --- a/cmd/generate.go +++ b/cmd/generate.go @@ -2,6 +2,7 @@ package cmd import ( "regexp" + "sort" log "github.com/sirupsen/logrus" @@ -461,6 +462,9 @@ func main(cmd *cobra.Command, args []string) error { return err } + // Sort the projects in config by Dir + sort.Slice(config.Projects, func(i, j int) bool { return config.Projects[i].Dir < config.Projects[j].Dir }) + // Convert config to YAML string yamlBytes, err := yaml.Marshal(&config) if err != nil { diff --git a/cmd/generate_test.go b/cmd/generate_test.go index 4ee9c131..d11528a6 100644 --- a/cmd/generate_test.go +++ b/cmd/generate_test.go @@ -77,9 +77,6 @@ func runTest(t *testing.T, goldenFile string, args []string) { return } - assert.ElementsMatch(t, content.Projects, goldenContents.Projects) - content.Projects = nil - goldenContents.Projects = nil assert.Equal(t, content, goldenContents) }