Skip to content

Commit

Permalink
Merge pull request #8858 from ulyssessouza/avoid-test-flakyness-by-or…
Browse files Browse the repository at this point in the history
…dering-volumes

Avoid test flakyness by ordering volumes before checking
  • Loading branch information
Ulysses Souza authored Oct 31, 2021
2 parents 04d8212 + 284bad4 commit 76fe903
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/compose/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package compose
import (
"os"
"path/filepath"
"sort"
"testing"

"github.com/compose-spec/compose-go/types"
Expand Down Expand Up @@ -124,12 +125,18 @@ func TestBuildContainerMountOptions(t *testing.T) {
}

mounts, err := buildContainerMountOptions(project, project.Services[0], moby.ImageInspect{}, inherit)
sort.Slice(mounts, func(i, j int) bool {
return mounts[i].Target < mounts[j].Target
})
assert.NilError(t, err)
assert.Assert(t, len(mounts) == 2)
assert.Equal(t, mounts[0].Target, "/var/myvolume1")
assert.Equal(t, mounts[1].Target, "/var/myvolume2")

mounts, err = buildContainerMountOptions(project, project.Services[0], moby.ImageInspect{}, inherit)
sort.Slice(mounts, func(i, j int) bool {
return mounts[i].Target < mounts[j].Target
})
assert.NilError(t, err)
assert.Assert(t, len(mounts) == 2)
assert.Equal(t, mounts[0].Target, "/var/myvolume1")
Expand Down

0 comments on commit 76fe903

Please sign in to comment.