mirror of https://github.com/k3s-io/k3s
Add unit tests for CSI mount options
parent
65d3beb820
commit
85b224856d
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue