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 (
|
||||
"context"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"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
|
||||
topology := &volume.TopologyRequirement{}
|
||||
|
|
|
@ -3,6 +3,7 @@ package volume
|
|||
import (
|
||||
"io"
|
||||
"reflect"
|
||||
"sort"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
|
@ -192,6 +193,9 @@ func TestVolumeCreateClusterOpts(t *testing.T) {
|
|||
|
||||
cli := test.NewFakeCli(&fakeClient{
|
||||
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)
|
||||
return volume.Volume{}, nil
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue