mirror of https://github.com/docker/compose.git
Avoid test flakyness by ordering volumes before checking
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
This commit is contained in:
parent
04d8212a88
commit
284bad4411
|
@ -19,6 +19,7 @@ package compose
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"sort"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/types"
|
"github.com/compose-spec/compose-go/types"
|
||||||
|
@ -124,12 +125,18 @@ func TestBuildContainerMountOptions(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
mounts, err := buildContainerMountOptions(project, project.Services[0], moby.ImageInspect{}, inherit)
|
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.NilError(t, err)
|
||||||
assert.Assert(t, len(mounts) == 2)
|
assert.Assert(t, len(mounts) == 2)
|
||||||
assert.Equal(t, mounts[0].Target, "/var/myvolume1")
|
assert.Equal(t, mounts[0].Target, "/var/myvolume1")
|
||||||
assert.Equal(t, mounts[1].Target, "/var/myvolume2")
|
assert.Equal(t, mounts[1].Target, "/var/myvolume2")
|
||||||
|
|
||||||
mounts, err = buildContainerMountOptions(project, project.Services[0], moby.ImageInspect{}, inherit)
|
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.NilError(t, err)
|
||||||
assert.Assert(t, len(mounts) == 2)
|
assert.Assert(t, len(mounts) == 2)
|
||||||
assert.Equal(t, mounts[0].Target, "/var/myvolume1")
|
assert.Equal(t, mounts[0].Target, "/var/myvolume1")
|
||||||
|
|
Loading…
Reference in New Issue