@@ -632,6 +632,64 @@ func TestCreateVolume(t *testing.T) {
632632 controller .Finish ()
633633 },
634634 },
635+ {
636+ name : "Failed with invalid allowSharedKeyAccess value" ,
637+ testFunc : func (t * testing.T ) {
638+ d := NewFakeDriver ()
639+ d .cloud = & azure.Cloud {}
640+ d .cloud .SubscriptionID = "subID"
641+
642+ mp := make (map [string ]string )
643+ mp [allowSharedKeyAccessField ] = "invalid"
644+ req := & csi.CreateVolumeRequest {
645+ Name : "unit-test" ,
646+ VolumeCapabilities : stdVolumeCapabilities ,
647+ Parameters : mp ,
648+ }
649+ d .Cap = []* csi.ControllerServiceCapability {
650+ controllerServiceCapability ,
651+ }
652+
653+ expectedErr := status .Errorf (codes .InvalidArgument , "invalid %s: invalid in volume context" , allowSharedKeyAccessField )
654+ _ , err := d .CreateVolume (context .Background (), req )
655+ if ! reflect .DeepEqual (err , expectedErr ) {
656+ t .Errorf ("Unexpected error: %v\n Expected error: %v" , err , expectedErr )
657+ }
658+ },
659+ },
660+ {
661+ name : "Failed with storeAccountKey is not supported for account with shared access key disabled" ,
662+ testFunc : func (t * testing.T ) {
663+ d := NewFakeDriver ()
664+ d .cloud = & azure.Cloud {}
665+ d .cloud .SubscriptionID = "subID"
666+
667+ mp := make (map [string ]string )
668+ mp [protocolField ] = "fuse"
669+ mp [skuNameField ] = "unit-test"
670+ mp [storageAccountTypeField ] = "unit-test"
671+ mp [locationField ] = "unit-test"
672+ mp [storageAccountField ] = "unittest"
673+ mp [resourceGroupField ] = "unit-test"
674+ mp [containerNameField ] = "unit-test"
675+ mp [mountPermissionsField ] = "0750"
676+ mp [allowSharedKeyAccessField ] = falseValue
677+ req := & csi.CreateVolumeRequest {
678+ Name : "unit-test" ,
679+ VolumeCapabilities : stdVolumeCapabilities ,
680+ Parameters : mp ,
681+ }
682+ d .Cap = []* csi.ControllerServiceCapability {
683+ controllerServiceCapability ,
684+ }
685+
686+ expectedErr := status .Errorf (codes .InvalidArgument , "storeAccountKey is not supported for account with shared access key disabled" )
687+ _ , err := d .CreateVolume (context .Background (), req )
688+ if ! reflect .DeepEqual (err , expectedErr ) {
689+ t .Errorf ("Unexpected error: %v\n Expected error: %v" , err , expectedErr )
690+ }
691+ },
692+ },
635693 {
636694 name : "Successful I/O" ,
637695 testFunc : func (t * testing.T ) {
0 commit comments