From f77dd0ebac12be6d3f9335f70860232d1ddee7be Mon Sep 17 00:00:00 2001 From: Lars Lehtonen Date: Fri, 25 Aug 2017 20:37:05 -0700 Subject: [PATCH] Fix swallowed errors in tests of photon_pd package --- pkg/volume/photon_pd/photon_pd_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkg/volume/photon_pd/photon_pd_test.go b/pkg/volume/photon_pd/photon_pd_test.go index b874c5b0da6..955195a51f5 100644 --- a/pkg/volume/photon_pd/photon_pd_test.go +++ b/pkg/volume/photon_pd/photon_pd_test.go @@ -179,6 +179,9 @@ func TestPlugin(t *testing.T) { PersistentVolumeReclaimPolicy: v1.PersistentVolumeReclaimDelete, } provisioner, err := plug.(*photonPersistentDiskPlugin).newProvisionerInternal(options, &fakePDManager{}) + if err != nil { + t.Fatalf("Error creating new provisioner:%v", err) + } persistentSpec, err := provisioner.Provision() if err != nil { t.Errorf("Provision() failed: %v", err) @@ -198,6 +201,9 @@ func TestPlugin(t *testing.T) { PersistentVolume: persistentSpec, } deleter, err := plug.(*photonPersistentDiskPlugin).newDeleterInternal(volSpec, &fakePDManager{}) + if err != nil { + t.Fatalf("Error creating new deleter:%v", err) + } err = deleter.Delete() if err != nil { t.Errorf("Deleter() failed: %v", err) @@ -228,11 +234,17 @@ func TestMounterAndUnmounterTypeAssert(t *testing.T) { } mounter, err := plug.(*photonPersistentDiskPlugin).newMounterInternal(volume.NewSpecFromVolume(spec), types.UID("poduid"), &fakePDManager{}, &mount.FakeMounter{}) + if err != nil { + t.Fatalf("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.(*photonPersistentDiskPlugin).newUnmounterInternal("vol1", types.UID("poduid"), &fakePDManager{}, &mount.FakeMounter{}) + if err != nil { + t.Fatalf("Error creating new unmounter:%v", err) + } if _, ok := unmounter.(volume.Mounter); ok { t.Errorf("Volume Unmounter can be type-assert to Mounter") }