diff --git a/pkg/volume/azure_file/azure_file_test.go b/pkg/volume/azure_file/azure_file_test.go index bb1a5ad3ad..425657e0ea 100644 --- a/pkg/volume/azure_file/azure_file_test.go +++ b/pkg/volume/azure_file/azure_file_test.go @@ -235,6 +235,9 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { spec := volume.NewSpecFromPersistentVolume(pv, true) pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}} mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{}) + if mounter == nil { + t.Fatalf("Got a nil Mounter") + } if !mounter.GetAttributes().ReadOnly { t.Errorf("Expected true for mounter.IsReadOnly") diff --git a/pkg/volume/configmap/configmap_test.go b/pkg/volume/configmap/configmap_test.go index ce300e976b..5ff5acf801 100644 --- a/pkg/volume/configmap/configmap_test.go +++ b/pkg/volume/configmap/configmap_test.go @@ -317,7 +317,7 @@ func TestPlugin(t *testing.T) { t.Errorf("Failed to make a new Mounter: %v", err) } if mounter == nil { - t.Errorf("Got a nil Mounter") + t.Fatalf("Got a nil Mounter") } vName, err := plugin.GetVolumeName(volume.NewSpecFromVolume(volumeSpec)) @@ -381,7 +381,7 @@ func TestPluginReboot(t *testing.T) { t.Errorf("Failed to make a new Mounter: %v", err) } if mounter == nil { - t.Errorf("Got a nil Mounter") + t.Fatalf("Got a nil Mounter") } podMetadataDir := fmt.Sprintf("%v/pods/test_pod_uid3/plugins/kubernetes.io~configmap/test_volume_name", rootDir) @@ -597,7 +597,7 @@ func doTestCleanAndTeardown(plugin volume.VolumePlugin, podUID types.UID, testVo t.Errorf("Failed to make a new Unmounter: %v", err) } if unmounter == nil { - t.Errorf("Got a nil Unmounter") + t.Fatalf("Got a nil Unmounter") } if err := unmounter.TearDown(); err != nil { diff --git a/pkg/volume/downwardapi/downwardapi_test.go b/pkg/volume/downwardapi/downwardapi_test.go index 393e158b7a..b0edd400f7 100644 --- a/pkg/volume/downwardapi/downwardapi_test.go +++ b/pkg/volume/downwardapi/downwardapi_test.go @@ -241,7 +241,7 @@ func newDownwardAPITest(t *testing.T, name string, volumeFiles, podLabels, podAn t.Errorf("Failed to make a new Mounter: %v", err) } if mounter == nil { - t.Errorf("Got a nil Mounter") + t.Fatalf("Got a nil Mounter") } volumePath := mounter.GetPath() @@ -278,7 +278,7 @@ func (test *downwardAPITest) tearDown() { test.t.Errorf("Failed to make a new Unmounter: %v", err) } if unmounter == nil { - test.t.Errorf("Got a nil Unmounter") + test.t.Fatalf("Got a nil Unmounter") } if err := unmounter.TearDown(); err != nil { diff --git a/pkg/volume/empty_dir/empty_dir_test.go b/pkg/volume/empty_dir/empty_dir_test.go index 765581b5bb..642c49422c 100644 --- a/pkg/volume/empty_dir/empty_dir_test.go +++ b/pkg/volume/empty_dir/empty_dir_test.go @@ -221,7 +221,7 @@ func TestPluginBackCompat(t *testing.T) { t.Errorf("Failed to make a new Mounter: %v", err) } if mounter == nil { - t.Errorf("Got a nil Mounter") + t.Fatalf("Got a nil Mounter") } volPath := mounter.GetPath() @@ -249,6 +249,9 @@ func TestMetrics(t *testing.T) { if err != nil { t.Errorf("Failed to make a new Mounter: %v", err) } + if mounter == nil { + t.Fatalf("Got a nil Mounter") + } // Need to create the subdirectory os.MkdirAll(mounter.GetPath(), 0755) diff --git a/pkg/volume/fc/fc_test.go b/pkg/volume/fc/fc_test.go index c65ff800f9..5e6ab7f9fa 100644 --- a/pkg/volume/fc/fc_test.go +++ b/pkg/volume/fc/fc_test.go @@ -362,6 +362,9 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { spec := volume.NewSpecFromPersistentVolume(pv, true) pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}} mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{}) + if mounter == nil { + t.Fatalf("Got a nil Mounter") + } if !mounter.GetAttributes().ReadOnly { t.Errorf("Expected true for mounter.IsReadOnly") diff --git a/pkg/volume/gce_pd/gce_pd_test.go b/pkg/volume/gce_pd/gce_pd_test.go index 5f9b3619fe..4dc1761ec7 100644 --- a/pkg/volume/gce_pd/gce_pd_test.go +++ b/pkg/volume/gce_pd/gce_pd_test.go @@ -251,6 +251,9 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { spec := volume.NewSpecFromPersistentVolume(pv, true) pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}} mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{}) + if mounter == nil { + t.Fatalf("Got a nil Mounter") + } if !mounter.GetAttributes().ReadOnly { t.Errorf("Expected true for mounter.IsReadOnly") diff --git a/pkg/volume/host_path/host_path_test.go b/pkg/volume/host_path/host_path_test.go index a16b2ee89a..01bd126a18 100644 --- a/pkg/volume/host_path/host_path_test.go +++ b/pkg/volume/host_path/host_path_test.go @@ -225,7 +225,7 @@ func TestPlugin(t *testing.T) { t.Errorf("Failed to make a new Mounter: %v", err) } if mounter == nil { - t.Errorf("Got a nil Mounter") + t.Fatalf("Got a nil Mounter") } path := mounter.GetPath() @@ -242,7 +242,7 @@ func TestPlugin(t *testing.T) { t.Errorf("Failed to make a new Unmounter: %v", err) } if unmounter == nil { - t.Errorf("Got a nil Unmounter") + t.Fatalf("Got a nil Unmounter") } if err := unmounter.TearDown(); err != nil { @@ -288,6 +288,9 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { spec := volume.NewSpecFromPersistentVolume(pv, true) pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}} mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{}) + if mounter == nil { + t.Fatalf("Got a nil Mounter") + } if !mounter.GetAttributes().ReadOnly { t.Errorf("Expected true for mounter.IsReadOnly") diff --git a/pkg/volume/iscsi/iscsi_test.go b/pkg/volume/iscsi/iscsi_test.go index 1c88d0bf7f..d9499bf532 100644 --- a/pkg/volume/iscsi/iscsi_test.go +++ b/pkg/volume/iscsi/iscsi_test.go @@ -283,6 +283,9 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { spec := volume.NewSpecFromPersistentVolume(pv, true) pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}} mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{}) + if mounter == nil { + t.Fatalf("Got a nil Mounter") + } if !mounter.GetAttributes().ReadOnly { t.Errorf("Expected true for mounter.IsReadOnly") diff --git a/pkg/volume/nfs/nfs_test.go b/pkg/volume/nfs/nfs_test.go index e96ef55cae..3b086b44b6 100644 --- a/pkg/volume/nfs/nfs_test.go +++ b/pkg/volume/nfs/nfs_test.go @@ -247,6 +247,9 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { spec := volume.NewSpecFromPersistentVolume(pv, true) pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}} mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{}) + if mounter == nil { + t.Fatalf("Got a nil Mounter") + } if !mounter.GetAttributes().ReadOnly { t.Errorf("Expected true for mounter.IsReadOnly") diff --git a/pkg/volume/quobyte/quobyte_test.go b/pkg/volume/quobyte/quobyte_test.go index 6dcc5616b4..86fb2fd092 100644 --- a/pkg/volume/quobyte/quobyte_test.go +++ b/pkg/volume/quobyte/quobyte_test.go @@ -194,6 +194,9 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { spec := volume.NewSpecFromPersistentVolume(pv, true) pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}} mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{}) + if mounter == nil { + t.Fatalf("Got a nil Mounter") + } if !mounter.GetAttributes().ReadOnly { t.Errorf("Expected true for mounter.IsReadOnly") diff --git a/pkg/volume/rbd/rbd_test.go b/pkg/volume/rbd/rbd_test.go index 6ef38de89e..8ff60bbe80 100644 --- a/pkg/volume/rbd/rbd_test.go +++ b/pkg/volume/rbd/rbd_test.go @@ -235,6 +235,9 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { spec := volume.NewSpecFromPersistentVolume(pv, true) pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}} mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{}) + if mounter == nil { + t.Fatalf("Got a nil Mounter") + } if !mounter.GetAttributes().ReadOnly { t.Errorf("Expected true for mounter.IsReadOnly") diff --git a/pkg/volume/secret/secret_test.go b/pkg/volume/secret/secret_test.go index 702b0999b3..438442a4c7 100644 --- a/pkg/volume/secret/secret_test.go +++ b/pkg/volume/secret/secret_test.go @@ -319,7 +319,7 @@ func TestPlugin(t *testing.T) { t.Errorf("Failed to make a new Mounter: %v", err) } if mounter == nil { - t.Errorf("Got a nil Mounter") + t.Fatalf("Got a nil Mounter") } volumePath := mounter.GetPath() @@ -392,7 +392,7 @@ func TestPluginReboot(t *testing.T) { t.Errorf("Failed to make a new Mounter: %v", err) } if mounter == nil { - t.Errorf("Got a nil Mounter") + t.Fatalf("Got a nil Mounter") } podMetadataDir := fmt.Sprintf("%v/pods/test_pod_uid3/plugins/kubernetes.io~secret/test_volume_name", rootDir) @@ -617,7 +617,7 @@ func doTestCleanAndTeardown(plugin volume.VolumePlugin, podUID types.UID, testVo t.Errorf("Failed to make a new Unmounter: %v", err) } if unmounter == nil { - t.Errorf("Got a nil Unmounter") + t.Fatalf("Got a nil Unmounter") } if err := unmounter.TearDown(); err != nil {