@@ -641,76 +641,6 @@ func TestCreateVolume(t *testing.T) {
641
641
}
642
642
},
643
643
},
644
- {
645
- name : "Request namespace does not match" ,
646
- testFunc : func (t * testing.T ) {
647
- name := "baz"
648
- sku := "sku"
649
- kind := "StorageV2"
650
- location := "centralus"
651
- value := "foo bar"
652
- accounts := []storage.Account {
653
- {Name : & name , Sku : & storage.Sku {Name : storage .SkuName (sku )}, Kind : storage .Kind (kind ), Location : & location },
654
- }
655
- keys := storage.AccountListKeysResult {
656
- Keys : & []storage.AccountKey {
657
- {Value : & value },
658
- },
659
- }
660
-
661
- allParam := map [string ]string {
662
- skuNameField : "premium" ,
663
- storageAccountTypeField : "stoacctype" ,
664
- locationField : "loc" ,
665
- storageAccountField : "stoacc" ,
666
- resourceGroupField : "rg" ,
667
- shareNameField : "" ,
668
- diskNameField : "diskname" ,
669
- fsTypeField : "" ,
670
- storeAccountKeyField : "storeaccountkey" ,
671
- secretNamespaceField : "secretnamespace" ,
672
- }
673
-
674
- req := & csi.CreateVolumeRequest {
675
- Name : "random-vol-name-namespace-not-match" ,
676
- VolumeCapabilities : stdVolCap ,
677
- CapacityRange : lessThanPremCapRange ,
678
- Parameters : allParam ,
679
- }
680
-
681
- d := NewFakeDriver ()
682
- d .cloud = & azure.Cloud {}
683
- d .cloud .KubeClient = fake .NewSimpleClientset ()
684
-
685
- ctrl := gomock .NewController (t )
686
- defer ctrl .Finish ()
687
-
688
- mockFileClient := mockfileclient .NewMockInterface (ctrl )
689
- d .cloud .FileClient = mockFileClient
690
-
691
- mockStorageAccountsClient := mockstorageaccountclient .NewMockInterface (ctrl )
692
- d .cloud .StorageAccountClient = mockStorageAccountsClient
693
-
694
- mockFileClient .EXPECT ().CreateFileShare (gomock .Any (), gomock .Any (), gomock .Any ()).Return (nil ).AnyTimes ()
695
- mockStorageAccountsClient .EXPECT ().ListKeys (gomock .Any (), gomock .Any (), gomock .Any ()).Return (keys , nil ).AnyTimes ()
696
- mockStorageAccountsClient .EXPECT ().ListByResourceGroup (gomock .Any (), gomock .Any ()).Return (accounts , nil ).AnyTimes ()
697
- mockStorageAccountsClient .EXPECT ().Create (gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any ()).Return (nil ).AnyTimes ()
698
- mockFileClient .EXPECT ().GetFileShare (gomock .Any (), gomock .Any (), gomock .Any ()).Return (storage.FileShare {FileShareProperties : & storage.FileShareProperties {ShareQuota : & fakeShareQuota }}, nil ).AnyTimes ()
699
-
700
- d .AddControllerServiceCapabilities (
701
- []csi.ControllerServiceCapability_RPC_Type {
702
- csi .ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME ,
703
- })
704
-
705
- ctx := context .Background ()
706
-
707
- // expectedErr := status.Error(codes.Internal, "failed to store storage account key: couldn't create secret request namespace does not match object namespace, request: \"secretnamespace\" object: \"default\"")
708
- _ , err := d .CreateVolume (ctx , req )
709
- if ! reflect .DeepEqual (err , nil ) {
710
- t .Errorf ("Unexpected error: %v" , err )
711
- }
712
- },
713
- },
714
644
{
715
645
name : "Create disk returns error" ,
716
646
testFunc : func (t * testing.T ) {
0 commit comments