Sort bind options in JoinMountOptions

We were not sorting them previously, which made the order
non-deterministic.  If we believe the order doesn't matter, let's pick
a consistent order to minimize the chances of a rare flake.

This also simplifies the unit tests, which were flaking
not-very-rarely, e.g. with

`bazel test //pkg/volume/awsebs/... --runs_per_test=8`
pull/58/head
Justin Santa Barbara 2018-10-04 21:36:45 -04:00
parent 0928bb4c01
commit 3c4789b464
2 changed files with 2 additions and 2 deletions

View File

@ -371,7 +371,7 @@ func TestMountOptions(t *testing.T) {
t.Errorf("Expected success, got: %v", err) t.Errorf("Expected success, got: %v", err)
} }
mountOptions := fakeMounter.MountPoints[0].Opts mountOptions := fakeMounter.MountPoints[0].Opts
expectedMountOptions := []string{"bind", "_netdev"} expectedMountOptions := []string{"_netdev", "bind"}
if !reflect.DeepEqual(mountOptions, expectedMountOptions) { if !reflect.DeepEqual(mountOptions, expectedMountOptions) {
t.Errorf("Expected mount options to be %v got %v", expectedMountOptions, mountOptions) t.Errorf("Expected mount options to be %v got %v", expectedMountOptions, mountOptions)
} }

View File

@ -766,7 +766,7 @@ func JoinMountOptions(userOptions []string, systemOptions []string) []string {
for _, mountOption := range systemOptions { for _, mountOption := range systemOptions {
allMountOptions.Insert(mountOption) allMountOptions.Insert(mountOption)
} }
return allMountOptions.UnsortedList() return allMountOptions.List()
} }
// ValidateZone returns: // ValidateZone returns: