@@ -131,14 +131,54 @@ func (f *FakeDynamicProvisioner) GetSkuValuesForLocation(_ context.Context, loca
131131}
132132
133133func TestNewDriver (t * testing.T ) {
134+ fakeConfigFile := "fake-cred-file.json"
135+ fakeConfigContent := `{
136+ "tenantId": "fake-tenant-id",
137+ "subscriptionId": "fake-subscription-id",
138+ "aadClientId": "fake-client-id",
139+ "aadClientSecret": "fake-client-secret",
140+ "resourceGroup": "fake-resource-group",
141+ "location": "fake-location",
142+ }`
143+
144+ if err := os .WriteFile (fakeConfigFile , []byte (fakeConfigContent ), 0o600 ); err != nil {
145+ t .Error (err )
146+ }
147+
148+ defer func () {
149+ if err := os .Remove (fakeConfigFile ); err != nil {
150+ t .Error (err )
151+ }
152+ }()
153+
154+ t .Setenv (DefaultAzureConfigFileEnv , fakeConfigFile )
155+
134156 driverOptions := DriverOptions {
135157 NodeID : fakeNodeID ,
136- DriverName : DefaultDriverName ,
158+ DriverName : fakeDriverName ,
137159 EnableAzureLustreMockMount : false ,
138160 EnableAzureLustreMockDynProv : true ,
161+ WorkingMountDir : "/tmp" ,
162+ RemoveNotReadyTaint : true ,
139163 }
140164 d := NewDriver (& driverOptions )
141165 assert .NotNil (t , d )
166+ assert .NotNil (t , d .cloud )
167+ assert .NotNil (t , d .dynamicProvisioner )
168+ assert .Equal (t , "fake-resource-group" , d .resourceGroup )
169+ assert .Equal (t , "fake-location" , d .location )
170+ assert .Equal (t , fakeNodeID , d .NodeID )
171+ assert .Equal (t , fakeDriverName , d .Name )
172+ assert .Equal (t , "fake-subscription-id" , d .cloud .SubscriptionID )
173+ assert .Equal (t , "fake-tenant-id" , d .cloud .TenantID )
174+ assert .Equal (t , "fake-client-id" , d .cloud .AADClientID )
175+ assert .Equal (t , "fake-client-secret" , d .cloud .AADClientSecret )
176+ assert .Equal (t , "fake-location" , d .cloud .Location )
177+ assert .Equal (t , "fake-resource-group" , d .cloud .ResourceGroup )
178+ assert .Equal (t , "/tmp" , d .workingMountDir )
179+ assert .True (t , d .enableAzureLustreMockDynProv , "enableAzureLustreMockDynProv should be true" )
180+ assert .False (t , d .enableAzureLustreMockMount , "enableAzureLustreMockMount should be false" )
181+ assert .True (t , d .removeNotReadyTaint , "removeNotReadyTaint should be true" )
142182}
143183
144184func TestIsCorruptedDir (t * testing.T ) {
0 commit comments