@@ -17,6 +17,7 @@ limitations under the License.
17
17
package e2e
18
18
19
19
import (
20
+ "context"
20
21
"fmt"
21
22
"log"
22
23
"os"
@@ -277,18 +278,37 @@ var _ = ginkgo.Describe("[blob-csi-e2e] Dynamic Provisioning", func() {
277
278
test .Run (cs , ns )
278
279
})
279
280
280
- ginkgo .It ("should create a NFSv3 volume on demand with mount options [nfs]" , func () {
281
- if isAzureStackCloud {
282
- ginkgo .Skip ("test case is not available for Azure Stack" )
283
- }
281
+ ginkgo .It ("should create a volume on demand (Bring Your Own Key)" , func () {
282
+ // get storage account secret name
283
+ err := os .Chdir ("../.." )
284
+ gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
285
+ defer func () {
286
+ err := os .Chdir ("test/e2e" )
287
+ gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
288
+ }()
289
+
290
+ getSecretNameScript := "test/utils/get_storage_account_secret_name.sh"
291
+ log .Printf ("run script: %s\n " , getSecretNameScript )
292
+
293
+ cmd := exec .Command ("bash" , getSecretNameScript )
294
+ output , err := cmd .CombinedOutput ()
295
+ log .Printf ("got output: %v, error: %v\n " , string (output ), err )
296
+ gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
297
+
298
+ secretName := strings .TrimSuffix (string (output ), "\n " )
299
+ log .Printf ("got storage account secret name: %v\n " , secretName )
300
+ bringKeyStorageClassParameters ["csi.storage.k8s.io/provisioner-secret-name" ] = secretName
301
+ bringKeyStorageClassParameters ["csi.storage.k8s.io/node-stage-secret-name" ] = secretName
302
+
284
303
pods := []testsuites.PodDetails {
285
304
{
286
305
Cmd : "echo 'hello world' > /mnt/test-1/data && grep 'hello world' /mnt/test-1/data" ,
287
306
Volumes : []testsuites.VolumeDetails {
288
307
{
289
308
ClaimSize : "10Gi" ,
290
309
MountOptions : []string {
291
- "nconnect=16" ,
310
+ "-o allow_other" ,
311
+ "--file-cache-timeout-in-seconds=120" ,
292
312
},
293
313
VolumeMount : testsuites.VolumeMountDetails {
294
314
NameGenerate : "test-volume-" ,
@@ -299,17 +319,37 @@ var _ = ginkgo.Describe("[blob-csi-e2e] Dynamic Provisioning", func() {
299
319
},
300
320
}
301
321
test := testsuites.DynamicallyProvisionedCmdVolumeTest {
302
- CSIDriver : testDriver ,
303
- Pods : pods ,
304
- StorageClassParameters : map [string ]string {
305
- "skuName" : "Premium_LRS" ,
306
- "protocol" : "nfs" ,
322
+ CSIDriver : testDriver ,
323
+ Pods : pods ,
324
+ StorageClassParameters : bringKeyStorageClassParameters ,
325
+ }
326
+ test .Run (cs , ns )
327
+ })
328
+
329
+ ginkgo .It ("should create a volume on demand and resize it [blob.csi.azure.com]" , func () {
330
+ pods := []testsuites.PodDetails {
331
+ {
332
+ Cmd : "echo 'hello world' > /mnt/test-1/data && grep 'hello world' /mnt/test-1/data" ,
333
+ Volumes : []testsuites.VolumeDetails {
334
+ {
335
+ ClaimSize : "10Gi" ,
336
+ VolumeMount : testsuites.VolumeMountDetails {
337
+ NameGenerate : "test-volume-" ,
338
+ MountPathGenerate : "/mnt/test-" ,
339
+ },
340
+ },
341
+ },
307
342
},
308
343
}
344
+ test := testsuites.DynamicallyProvisionedResizeVolumeTest {
345
+ CSIDriver : testDriver ,
346
+ Pods : pods ,
347
+ StorageClassParameters : map [string ]string {"skuName" : "Standard_LRS" },
348
+ }
309
349
test .Run (cs , ns )
310
350
})
311
351
312
- ginkgo .It ("should create a volume on demand (Bring Your Own Key) " , func () {
352
+ ginkgo .It ("should create an CSI inline volume [blob.csi.azure.com] " , func () {
313
353
// get storage account secret name
314
354
err := os .Chdir ("../.." )
315
355
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
@@ -328,15 +368,27 @@ var _ = ginkgo.Describe("[blob-csi-e2e] Dynamic Provisioning", func() {
328
368
329
369
secretName := strings .TrimSuffix (string (output ), "\n " )
330
370
log .Printf ("got storage account secret name: %v\n " , secretName )
331
- bringKeyStorageClassParameters ["csi.storage.k8s.io/provisioner-secret-name" ] = secretName
332
- bringKeyStorageClassParameters ["csi.storage.k8s.io/node-stage-secret-name" ] = secretName
371
+ segments := strings .Split (secretName , "-" )
372
+ if len (segments ) != 5 {
373
+ ginkgo .Fail (fmt .Sprintf ("%s have %d elements, expected: %d " , secretName , len (segments ), 5 ))
374
+ }
375
+ accountName := segments [3 ]
376
+
377
+ containerName := "csi-inline-blobfuse-volume"
378
+ req := makeCreateVolumeReq (containerName )
379
+ req .Parameters ["storageAccount" ] = accountName
380
+ resp , err := blobDriver .CreateVolume (context .Background (), req )
381
+ if err != nil {
382
+ ginkgo .Fail (fmt .Sprintf ("create volume error: %v" , err ))
383
+ }
384
+ volumeID := resp .Volume .VolumeId
385
+ ginkgo .By (fmt .Sprintf ("Successfully provisioned Blobfuse volume: %q\n " , volumeID ))
333
386
334
387
pods := []testsuites.PodDetails {
335
388
{
336
- Cmd : "echo 'hello world' > /mnt/test-1/data && grep 'hello world' /mnt/test-1/data" ,
337
389
Volumes : []testsuites.VolumeDetails {
338
390
{
339
- ClaimSize : "10Gi " ,
391
+ ClaimSize : "100Gi " ,
340
392
MountOptions : []string {
341
393
"-o allow_other" ,
342
394
"--file-cache-timeout-in-seconds=120" ,
@@ -349,21 +401,30 @@ var _ = ginkgo.Describe("[blob-csi-e2e] Dynamic Provisioning", func() {
349
401
},
350
402
},
351
403
}
352
- test := testsuites.DynamicallyProvisionedCmdVolumeTest {
353
- CSIDriver : testDriver ,
354
- Pods : pods ,
355
- StorageClassParameters : bringKeyStorageClassParameters ,
404
+
405
+ test := testsuites.DynamicallyProvisionedInlineVolumeTest {
406
+ CSIDriver : testDriver ,
407
+ Pods : pods ,
408
+ SecretName : secretName ,
409
+ ContainerName : containerName ,
410
+ ReadOnly : false ,
356
411
}
357
412
test .Run (cs , ns )
358
413
})
359
414
360
- ginkgo .It ("should create a volume on demand and resize it [blob.csi.azure.com]" , func () {
415
+ ginkgo .It ("should create a NFSv3 volume on demand with mount options [nfs]" , func () {
416
+ if isAzureStackCloud {
417
+ ginkgo .Skip ("test case is not available for Azure Stack" )
418
+ }
361
419
pods := []testsuites.PodDetails {
362
420
{
363
421
Cmd : "echo 'hello world' > /mnt/test-1/data && grep 'hello world' /mnt/test-1/data" ,
364
422
Volumes : []testsuites.VolumeDetails {
365
423
{
366
424
ClaimSize : "10Gi" ,
425
+ MountOptions : []string {
426
+ "nconnect=16" ,
427
+ },
367
428
VolumeMount : testsuites.VolumeMountDetails {
368
429
NameGenerate : "test-volume-" ,
369
430
MountPathGenerate : "/mnt/test-" ,
@@ -372,10 +433,13 @@ var _ = ginkgo.Describe("[blob-csi-e2e] Dynamic Provisioning", func() {
372
433
},
373
434
},
374
435
}
375
- test := testsuites.DynamicallyProvisionedResizeVolumeTest {
376
- CSIDriver : testDriver ,
377
- Pods : pods ,
378
- StorageClassParameters : map [string ]string {"skuName" : "Standard_LRS" },
436
+ test := testsuites.DynamicallyProvisionedCmdVolumeTest {
437
+ CSIDriver : testDriver ,
438
+ Pods : pods ,
439
+ StorageClassParameters : map [string ]string {
440
+ "skuName" : "Premium_LRS" ,
441
+ "protocol" : "nfs" ,
442
+ },
379
443
}
380
444
test .Run (cs , ns )
381
445
})
0 commit comments