diff --git a/pkg/volume/csi/csi_mounter_test.go b/pkg/volume/csi/csi_mounter_test.go index b3b087281a..4aa1a44d79 100644 --- a/pkg/volume/csi/csi_mounter_test.go +++ b/pkg/volume/csi/csi_mounter_test.go @@ -164,6 +164,7 @@ func MounterSetUpTests(t *testing.T, podInfoEnabled bool) { pv := makeTestPV("test-pv", 10, test.driver, testVol) pv.Spec.CSI.VolumeAttributes = test.attributes + pv.Spec.MountOptions = []string{"foo=bar", "baz=qux"} pvName := pv.GetName() mounter, err := plug.NewMounter( @@ -240,6 +241,9 @@ func MounterSetUpTests(t *testing.T, podInfoEnabled bool) { if vol.Path != csiMounter.GetPath() { t.Errorf("csi server expected path %s, got %s", csiMounter.GetPath(), vol.Path) } + if !reflect.DeepEqual(vol.MountFlags, pv.Spec.MountOptions) { + t.Errorf("csi server expected mount options %v, got %v", pv.Spec.MountOptions, vol.MountFlags) + } if podInfoEnabled { if !reflect.DeepEqual(vol.Attributes, test.expectedAttributes) { t.Errorf("csi server expected attributes %+v, got %+v", test.expectedAttributes, vol.Attributes) diff --git a/pkg/volume/csi/fake/fake_client.go b/pkg/volume/csi/fake/fake_client.go index 40b08f264b..775ff7ddfb 100644 --- a/pkg/volume/csi/fake/fake_client.go +++ b/pkg/volume/csi/fake/fake_client.go @@ -59,6 +59,7 @@ func (f *IdentityClient) Probe(ctx context.Context, in *csipb.ProbeRequest, opts type CSIVolume struct { Attributes map[string]string Path string + MountFlags []string } // NodeClient returns CSI node client @@ -126,6 +127,7 @@ func (f *NodeClient) NodePublishVolume(ctx context.Context, req *csipb.NodePubli f.nodePublishedVolumes[req.GetVolumeId()] = CSIVolume{ Path: req.GetTargetPath(), Attributes: req.GetVolumeAttributes(), + MountFlags: req.GetVolumeCapability().GetMount().MountFlags, } return &csipb.NodePublishVolumeResponse{}, nil }