diff --git a/pkg/controller/volume/attachdetach/attach_detach_controller_test.go b/pkg/controller/volume/attachdetach/attach_detach_controller_test.go index b0e12589b16..9f8b5865801 100644 --- a/pkg/controller/volume/attachdetach/attach_detach_controller_test.go +++ b/pkg/controller/volume/attachdetach/attach_detach_controller_test.go @@ -102,6 +102,10 @@ func Test_AttachDetachControllerStateOfWolrdPopulators_Positive(t *testing.T) { // Test the ActualStateOfWorld contains all the node volumes nodes, err := adc.nodeLister.List(labels.Everything()) + if err != nil { + t.Fatalf("Failed to list nodes in indexer. Expected: Actual: %v", err) + } + for _, node := range nodes { nodeName := types.NodeName(node.Name) for _, attachedVolume := range node.Status.VolumesAttached { diff --git a/pkg/volume/aws_ebs/aws_ebs_test.go b/pkg/volume/aws_ebs/aws_ebs_test.go index 85538b3649a..7c149bf06d6 100644 --- a/pkg/volume/aws_ebs/aws_ebs_test.go +++ b/pkg/volume/aws_ebs/aws_ebs_test.go @@ -186,6 +186,9 @@ func TestPlugin(t *testing.T) { PersistentVolumeReclaimPolicy: v1.PersistentVolumeReclaimDelete, } provisioner, err := plug.(*awsElasticBlockStorePlugin).newProvisionerInternal(options, &fakePDManager{}) + if err != nil { + t.Errorf("Error creating new provisioner:%v", err) + } persistentSpec, err := provisioner.Provision() if err != nil { t.Errorf("Provision() failed: %v", err) @@ -209,6 +212,9 @@ func TestPlugin(t *testing.T) { PersistentVolume: persistentSpec, } deleter, err := plug.(*awsElasticBlockStorePlugin).newDeleterInternal(volSpec, &fakePDManager{}) + if err != nil { + t.Errorf("Error creating new deleter:%v", err) + } err = deleter.Delete() if err != nil { t.Errorf("Deleter() failed: %v", err) @@ -288,11 +294,17 @@ func TestMounterAndUnmounterTypeAssert(t *testing.T) { } mounter, err := plug.(*awsElasticBlockStorePlugin).newMounterInternal(volume.NewSpecFromVolume(spec), types.UID("poduid"), &fakePDManager{}, &mount.FakeMounter{}) + if err != nil { + t.Errorf("Error creating new mounter:%v", err) + } if _, ok := mounter.(volume.Unmounter); ok { t.Errorf("Volume Mounter can be type-assert to Unmounter") } unmounter, err := plug.(*awsElasticBlockStorePlugin).newUnmounterInternal("vol1", types.UID("poduid"), &fakePDManager{}, &mount.FakeMounter{}) + if err != nil { + t.Errorf("Error creating new unmounter:%v", err) + } if _, ok := unmounter.(volume.Mounter); ok { t.Errorf("Volume Unmounter can be type-assert to Mounter") } diff --git a/pkg/volume/fc/fc_util.go b/pkg/volume/fc/fc_util.go index 5ad268c4b2f..f229d5700d6 100644 --- a/pkg/volume/fc/fc_util.go +++ b/pkg/volume/fc/fc_util.go @@ -220,6 +220,9 @@ func (util *FCUtil) AttachDisk(b fcDiskMounter) (string, error) { // mount it globalPDPath := util.MakeGlobalPDName(*b.fcDisk) noMnt, err := b.mounter.IsLikelyNotMountPoint(globalPDPath) + if err != nil { + return devicePath, fmt.Errorf("Heuristic determination of mount point failed:%v", err) + } if !noMnt { glog.Infof("fc: %s already mounted", globalPDPath) return devicePath, nil diff --git a/pkg/volume/flocker/flocker_volume_test.go b/pkg/volume/flocker/flocker_volume_test.go index 7f1a2e30715..db24c348ba2 100644 --- a/pkg/volume/flocker/flocker_volume_test.go +++ b/pkg/volume/flocker/flocker_volume_test.go @@ -41,7 +41,7 @@ func newTestableProvisioner(assert *assert.Assertions, options volume.VolumeOpti assert.NoError(err, "Can't find the plugin by name") provisioner, err := plug.(*flockerPlugin).newProvisionerInternal(options, &fakeFlockerUtil{}) - + assert.NoError(err, fmt.Sprintf("Can't create new provisioner:%v", err)) return tmpDir, provisioner } diff --git a/pkg/volume/gce_pd/gce_pd_test.go b/pkg/volume/gce_pd/gce_pd_test.go index 285e7b5faf0..cb8397da2b8 100644 --- a/pkg/volume/gce_pd/gce_pd_test.go +++ b/pkg/volume/gce_pd/gce_pd_test.go @@ -179,6 +179,9 @@ func TestPlugin(t *testing.T) { PersistentVolumeReclaimPolicy: v1.PersistentVolumeReclaimDelete, } provisioner, err := plug.(*gcePersistentDiskPlugin).newProvisionerInternal(options, &fakePDManager{}) + if err != nil { + t.Errorf("Error creating new provisioner:%v", err) + } persistentSpec, err := provisioner.Provision() if err != nil { t.Errorf("Provision() failed: %v", err) @@ -202,6 +205,9 @@ func TestPlugin(t *testing.T) { PersistentVolume: persistentSpec, } deleter, err := plug.(*gcePersistentDiskPlugin).newDeleterInternal(volSpec, &fakePDManager{}) + if err != nil { + t.Errorf("Error creating new deleter:%v", err) + } err = deleter.Delete() if err != nil { t.Errorf("Deleter() failed: %v", err) diff --git a/pkg/volume/host_path/host_path_test.go b/pkg/volume/host_path/host_path_test.go index 1184f5d35ad..a421ab731ff 100644 --- a/pkg/volume/host_path/host_path_test.go +++ b/pkg/volume/host_path/host_path_test.go @@ -158,7 +158,9 @@ func TestProvisioner(t *testing.T) { tempPath := fmt.Sprintf("/tmp/hostpath/%s", uuid.NewUUID()) defer os.RemoveAll(tempPath) err := os.MkdirAll(tempPath, 0750) - + if err != nil { + t.Errorf("Failed to create tempPath %s error:%v", tempPath, err) + } plugMgr := volume.VolumePluginMgr{} plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{ProvisioningEnabled: true}), nil, diff --git a/pkg/volume/portworx/portworx_test.go b/pkg/volume/portworx/portworx_test.go index e14ef825020..311ecf7409d 100644 --- a/pkg/volume/portworx/portworx_test.go +++ b/pkg/volume/portworx/portworx_test.go @@ -205,6 +205,9 @@ func TestPlugin(t *testing.T) { } provisioner, err := plug.(*portworxVolumePlugin).newProvisionerInternal(options, &fakePortworxManager{}) + if err != nil { + t.Errorf("Error creating a new provisioner:%v", err) + } persistentSpec, err := provisioner.Provision() if err != nil { t.Errorf("Provision() failed: %v", err) @@ -228,6 +231,9 @@ func TestPlugin(t *testing.T) { PersistentVolume: persistentSpec, } deleter, err := plug.(*portworxVolumePlugin).newDeleterInternal(volSpec, &fakePortworxManager{}) + if err != nil { + t.Errorf("Error creating a new Deleter:%v", err) + } err = deleter.Delete() if err != nil { t.Errorf("Deleter() failed: %v", err) diff --git a/pkg/volume/storageos/storageos_test.go b/pkg/volume/storageos/storageos_test.go index 8f1f29887b7..645dd8c6cef 100644 --- a/pkg/volume/storageos/storageos_test.go +++ b/pkg/volume/storageos/storageos_test.go @@ -363,7 +363,9 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { fakeConfig := &fakeConfig{} apiCfg := fakeConfig.GetAPIConfig() mounter, err := plug.(*storageosPlugin).newMounterInternal(spec, pod, apiCfg, fakeManager, &mount.FakeMounter{}, mount.NewFakeExec(nil)) - + if err != nil { + t.Fatalf("error creating a new internal mounter:%v", err) + } if !mounter.GetAttributes().ReadOnly { t.Errorf("Expected true for mounter.IsReadOnly") } diff --git a/pkg/volume/util/device_util_linux_test.go b/pkg/volume/util/device_util_linux_test.go index 59c86a7105c..94ac9b5a47b 100644 --- a/pkg/volume/util/device_util_linux_test.go +++ b/pkg/volume/util/device_util_linux_test.go @@ -116,10 +116,16 @@ func TestFindDeviceForPath(t *testing.T) { io := &mockOsIOHandler{} disk, err := findDeviceForPath("/dev/sde", io) + if err != nil { + t.Fatalf("error finding device for path /dev/sde:%v", err) + } if disk != "sde" { t.Fatalf("disk [%s] didn't match expected sde", disk) } disk, err = findDeviceForPath("/returns/a/dev", io) + if err != nil { + t.Fatalf("error finding device for path /returns/a/dev:%v", err) + } if disk != "sde" { t.Fatalf("disk [%s] didn't match expected sde", disk) }