Skip to content

Commit a0027c5

Browse files
authored
Merge pull request #375 from andyzhangx/add-more-allowed-parameters
fix: add more allowed storage class parameters
2 parents 6134ec6 + 701b351 commit a0027c5

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

pkg/blob/controllerserver.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,12 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
9090
secretNamespace = v
9191
case storeAccountKeyField:
9292
storeAccountKey = v
93+
case serverNameField:
94+
// no op, only used in NodeStageVolume
95+
case storageEndpointSuffixField:
96+
// no op, only used in NodeStageVolume
9397
default:
94-
return nil, fmt.Errorf("invalid option %s in storage class", k)
98+
return nil, fmt.Errorf("invalid parameter %s in storage class", k)
9599
}
96100
}
97101

pkg/blob/controllerserver_test.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,34 @@ func TestCreateVolume(t *testing.T) {
223223
}
224224
},
225225
},
226+
{
227+
name: "invalid parameter",
228+
testFunc: func(t *testing.T) {
229+
d := NewFakeDriver()
230+
mp := make(map[string]string)
231+
mp[skuNameField] = "unit-test"
232+
mp[storageAccountTypeField] = "unit-test"
233+
mp[locationField] = "unit-test"
234+
mp[storageAccountField] = "unit-test"
235+
mp[resourceGroupField] = "unit-test"
236+
mp["containername"] = "unit-test"
237+
mp["invalidparameter"] = "invalidvalue"
238+
req := &csi.CreateVolumeRequest{
239+
Name: "unit-test",
240+
VolumeCapabilities: stdVolumeCapabilities,
241+
Parameters: mp,
242+
}
243+
d.Cap = []*csi.ControllerServiceCapability{
244+
controllerServiceCapability,
245+
}
246+
247+
expectedErr := fmt.Errorf("invalid parameter %s in storage class", "invalidparameter")
248+
_, err := d.CreateVolume(context.Background(), req)
249+
if !reflect.DeepEqual(err, expectedErr) {
250+
t.Errorf("Unexpected error: %v", err)
251+
}
252+
},
253+
},
226254
}
227255
for _, tc := range testCases {
228256
t.Run(tc.name, tc.testFunc)

0 commit comments

Comments
 (0)