mirror of https://github.com/docker/cli.git
Deflake TestVolumeCreateClusterOpts
Add Secret sorting prior to request to prevent flakiness in CI Signed-off-by: Phong Tran <tran.pho@northeastern.edu> Co-authored-by: Sebastiaan van Stijn <thaJeztah@users.noreply.github.com> Signed-off-by: Phong Tran <tran.pho@northeastern.edu>
This commit is contained in:
parent
df3c2f171d
commit
1d85b4d0ec
|
@ -3,6 +3,7 @@ package volume
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/docker/cli/cli"
|
"github.com/docker/cli/cli"
|
||||||
|
@ -153,6 +154,9 @@ func runCreate(dockerCli command.Cli, options createOptions) error {
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
sort.SliceStable(volOpts.ClusterVolumeSpec.Secrets, func(i, j int) bool {
|
||||||
|
return volOpts.ClusterVolumeSpec.Secrets[i].Key < volOpts.ClusterVolumeSpec.Secrets[j].Key
|
||||||
|
})
|
||||||
|
|
||||||
// TODO(dperny): ignore if no topology specified
|
// TODO(dperny): ignore if no topology specified
|
||||||
topology := &volume.TopologyRequirement{}
|
topology := &volume.TopologyRequirement{}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package volume
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
@ -192,6 +193,9 @@ func TestVolumeCreateClusterOpts(t *testing.T) {
|
||||||
|
|
||||||
cli := test.NewFakeCli(&fakeClient{
|
cli := test.NewFakeCli(&fakeClient{
|
||||||
volumeCreateFunc: func(body volume.CreateOptions) (volume.Volume, error) {
|
volumeCreateFunc: func(body volume.CreateOptions) (volume.Volume, error) {
|
||||||
|
sort.SliceStable(body.ClusterVolumeSpec.Secrets, func(i, j int) bool {
|
||||||
|
return body.ClusterVolumeSpec.Secrets[i].Key < body.ClusterVolumeSpec.Secrets[j].Key
|
||||||
|
})
|
||||||
assert.DeepEqual(t, body, expectedBody)
|
assert.DeepEqual(t, body, expectedBody)
|
||||||
return volume.Volume{}, nil
|
return volume.Volume{}, nil
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue