@@ -36,6 +36,8 @@ import (
36
36
"k8s.io/client-go/kubernetes"
37
37
"k8s.io/client-go/kubernetes/fake"
38
38
39
+ //fakecloud "k8s.io/cloud-provider/fake"
40
+
39
41
"sigs.k8s.io/blob-csi-driver/pkg/util"
40
42
"sigs.k8s.io/cloud-provider-azure/pkg/azureclients/storageaccountclient/mockstorageaccountclient"
41
43
azure "sigs.k8s.io/cloud-provider-azure/pkg/provider"
@@ -749,10 +751,11 @@ func TestGetContainerReference(t *testing.T) {
749
751
fakeAccountKey := "test-key"
750
752
fakeContainerName := "test-con"
751
753
testCases := []struct {
752
- name string
753
- containerName string
754
- secrets map [string ]string
755
- expectedError error
754
+ name string
755
+ containerName string
756
+ endpointSuffix string
757
+ secrets map [string ]string
758
+ expectedError error
756
759
}{
757
760
{
758
761
name : "failed to retrieve accountName" ,
@@ -783,23 +786,26 @@ func TestGetContainerReference(t *testing.T) {
783
786
},
784
787
expectedError : fmt .Errorf ("azure: base storage service url required" ),
785
788
},
786
- /*{
787
- name: "container reference is nil",
788
- containerName: fakeContainerName,
789
+ {
790
+ name : "Successful I/O" ,
791
+ containerName : fakeContainerName ,
792
+ endpointSuffix : "endpointSuffix" ,
789
793
secrets : map [string ]string {
790
- "accountName": fakeAccountName ,
794
+ "accountName" : "devstoreaccount1" ,
791
795
"accountKey" : fakeAccountKey ,
792
796
},
793
- expectedError: fmt.Errorf("ContainerReference of %s is nil", fakeContainerName) ,
794
- },*/
797
+ expectedError : nil ,
798
+ },
795
799
}
796
800
797
801
d := NewFakeDriver ()
798
- d .cloud = & azure.Cloud {}
802
+ d .cloud = azure .GetTestCloud (gomock .NewController (t ))
803
+ //encodedStr := base64.StdEncoding.EncodeToString([]byte{12, 34, 56})
799
804
d .cloud .KubeClient = fake .NewSimpleClientset ()
800
- //d.cloud.Environment.StorageEndpointSuffix =
805
+
801
806
for _ , tc := range testCases {
802
807
t .Run (tc .name , func (t * testing.T ) {
808
+ d .cloud .Environment .StorageEndpointSuffix = tc .endpointSuffix
803
809
container , err := getContainerReference (tc .containerName , tc .secrets , d .cloud .Environment )
804
810
if tc .expectedError != nil {
805
811
assert .Error (t , err )
0 commit comments