Fix swallowed errors in tests of photon_pd package
This commit is contained in:
		| @@ -179,6 +179,9 @@ func TestPlugin(t *testing.T) { | |||||||
| 		PersistentVolumeReclaimPolicy: v1.PersistentVolumeReclaimDelete, | 		PersistentVolumeReclaimPolicy: v1.PersistentVolumeReclaimDelete, | ||||||
| 	} | 	} | ||||||
| 	provisioner, err := plug.(*photonPersistentDiskPlugin).newProvisionerInternal(options, &fakePDManager{}) | 	provisioner, err := plug.(*photonPersistentDiskPlugin).newProvisionerInternal(options, &fakePDManager{}) | ||||||
|  | 	if err != nil { | ||||||
|  | 		t.Fatalf("Error creating new provisioner:%v", err) | ||||||
|  | 	} | ||||||
| 	persistentSpec, err := provisioner.Provision() | 	persistentSpec, err := provisioner.Provision() | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		t.Errorf("Provision() failed: %v", err) | 		t.Errorf("Provision() failed: %v", err) | ||||||
| @@ -198,6 +201,9 @@ func TestPlugin(t *testing.T) { | |||||||
| 		PersistentVolume: persistentSpec, | 		PersistentVolume: persistentSpec, | ||||||
| 	} | 	} | ||||||
| 	deleter, err := plug.(*photonPersistentDiskPlugin).newDeleterInternal(volSpec, &fakePDManager{}) | 	deleter, err := plug.(*photonPersistentDiskPlugin).newDeleterInternal(volSpec, &fakePDManager{}) | ||||||
|  | 	if err != nil { | ||||||
|  | 		t.Fatalf("Error creating new deleter:%v", err) | ||||||
|  | 	} | ||||||
| 	err = deleter.Delete() | 	err = deleter.Delete() | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		t.Errorf("Deleter() failed: %v", err) | 		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{}) | 	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 { | 	if _, ok := mounter.(volume.Unmounter); ok { | ||||||
| 		t.Errorf("Volume Mounter can be type-assert to Unmounter") | 		t.Errorf("Volume Mounter can be type-assert to Unmounter") | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	unmounter, err := plug.(*photonPersistentDiskPlugin).newUnmounterInternal("vol1", types.UID("poduid"), &fakePDManager{}, &mount.FakeMounter{}) | 	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 { | 	if _, ok := unmounter.(volume.Mounter); ok { | ||||||
| 		t.Errorf("Volume Unmounter can be type-assert to Mounter") | 		t.Errorf("Volume Unmounter can be type-assert to Mounter") | ||||||
| 	} | 	} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Lars Lehtonen
					Lars Lehtonen