@@ -304,7 +304,7 @@ func TestBlockMapperSetupDeviceError(t *testing.T) {
304
304
attachID := getAttachmentName (csiMapper .volumeID , string (csiMapper .driverName ), string (nodeName ))
305
305
attachment := makeTestAttachment (attachID , nodeName , pvName )
306
306
attachment .Status .Attached = true
307
- _ , err = csiMapper .k8s .StorageV1 ().VolumeAttachments ().Create (context .TODO (), attachment , metav1.CreateOptions {})
307
+ _ , err = csiMapper .k8s .StorageV1 ().VolumeAttachments ().Create (context .Background (), attachment , metav1.CreateOptions {})
308
308
if err != nil {
309
309
t .Fatalf ("failed to setup VolumeAttachment: %v" , err )
310
310
}
@@ -347,10 +347,10 @@ func TestBlockMapperMapPodDevice(t *testing.T) {
347
347
348
348
csiMapper .csiClient = setupClient (t , true )
349
349
350
- attachID := getAttachmentName (csiMapper .volumeID , string (csiMapper .driverName ), string ( nodeName ) )
350
+ attachID := getAttachmentName (csiMapper .volumeID , string (csiMapper .driverName ), nodeName )
351
351
attachment := makeTestAttachment (attachID , nodeName , pvName )
352
352
attachment .Status .Attached = true
353
- _ , err = csiMapper .k8s .StorageV1 ().VolumeAttachments ().Create (context .TODO (), attachment , metav1.CreateOptions {})
353
+ _ , err = csiMapper .k8s .StorageV1 ().VolumeAttachments ().Create (context .Background (), attachment , metav1.CreateOptions {})
354
354
if err != nil {
355
355
t .Fatalf ("failed to setup VolumeAttachment: %v" , err )
356
356
}
@@ -483,6 +483,9 @@ func TestBlockMapperTearDownDevice(t *testing.T) {
483
483
func TestVolumeSetupTeardown (t * testing.T ) {
484
484
defer featuregatetesting .SetFeatureGateDuringTest (t , utilfeature .DefaultFeatureGate , features .CSIBlockVolume , true )()
485
485
486
+ // Follow volume setup + teardown sequences at top of cs_block.go and set up / clean up one CSI block device.
487
+ // Focus on testing that there were no leftover files present after the cleanup.
488
+
486
489
plug , tmpDir := newTestPlugin (t , nil )
487
490
defer os .RemoveAll (tmpDir )
488
491
@@ -505,7 +508,6 @@ func TestVolumeSetupTeardown(t *testing.T) {
505
508
}
506
509
t .Log ("created attachement " , attachID )
507
510
508
- // SetupDevice
509
511
err = csiMapper .SetUpDevice ()
510
512
if err != nil {
511
513
t .Fatalf ("mapper failed to SetupDevice: %v" , err )
@@ -521,7 +523,6 @@ func TestVolumeSetupTeardown(t *testing.T) {
521
523
t .Errorf ("csi server expected device path %s, got %s" , stagingPath , svol .Path )
522
524
}
523
525
524
- // MapPodDevice
525
526
path , err := csiMapper .MapPodDevice ()
526
527
if err != nil {
527
528
t .Fatalf ("mapper failed to GetGlobalMapPath: %v" , err )
@@ -552,7 +553,6 @@ func TestVolumeSetupTeardown(t *testing.T) {
552
553
t .Fatalf ("unmapper failed to GetGlobalMapPath: %v" , err )
553
554
}
554
555
555
- // UnmapDevice
556
556
err = csiUnmapper .UnmapPodDevice ()
557
557
if err != nil {
558
558
t .Errorf ("unmapper failed to call UnmapPodDevice: %v" , err )
@@ -566,7 +566,6 @@ func TestVolumeSetupTeardown(t *testing.T) {
566
566
csiUnmapper = unmapper .(* csiBlockMapper )
567
567
csiUnmapper .csiClient = csiMapper .csiClient
568
568
569
- // TearDownDevice
570
569
err = csiUnmapper .TearDownDevice (globalMapPath , "/dev/test" )
571
570
if err != nil {
572
571
t .Fatal (err )
0 commit comments