From 3c4789b4641f49d4d9fc34876ff8a65902b5eb52 Mon Sep 17 00:00:00 2001 From: Justin Santa Barbara Date: Thu, 4 Oct 2018 21:36:45 -0400 Subject: [PATCH] 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` --- pkg/volume/awsebs/aws_ebs_test.go | 2 +- pkg/volume/util/util.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/volume/awsebs/aws_ebs_test.go b/pkg/volume/awsebs/aws_ebs_test.go index c18282f4f2..30ab3aeb28 100644 --- a/pkg/volume/awsebs/aws_ebs_test.go +++ b/pkg/volume/awsebs/aws_ebs_test.go @@ -371,7 +371,7 @@ func TestMountOptions(t *testing.T) { t.Errorf("Expected success, got: %v", err) } mountOptions := fakeMounter.MountPoints[0].Opts - expectedMountOptions := []string{"bind", "_netdev"} + expectedMountOptions := []string{"_netdev", "bind"} if !reflect.DeepEqual(mountOptions, expectedMountOptions) { t.Errorf("Expected mount options to be %v got %v", expectedMountOptions, mountOptions) } diff --git a/pkg/volume/util/util.go b/pkg/volume/util/util.go index 72d9a781e7..4feb00ed0e 100644 --- a/pkg/volume/util/util.go +++ b/pkg/volume/util/util.go @@ -766,7 +766,7 @@ func JoinMountOptions(userOptions []string, systemOptions []string) []string { for _, mountOption := range systemOptions { allMountOptions.Insert(mountOption) } - return allMountOptions.UnsortedList() + return allMountOptions.List() } // ValidateZone returns: