Fixed a possible nil pointer dereference caused by variable plug

This commit is contained in:
mengjiao.liu
2021-04-01 17:36:33 +08:00
committed by Mengjiao Liu
parent 5de1a754c8
commit c24b87b133
22 changed files with 47 additions and 47 deletions

View File

@@ -49,7 +49,7 @@ func TestCanSupport(t *testing.T) {
plug, err := plugMgr.FindPluginByName("kubernetes.io/gce-pd")
if err != nil {
t.Errorf("Can't find the plugin by name")
t.Fatal("Can't find the plugin by name")
}
if plug.GetPluginName() != "kubernetes.io/gce-pd" {
t.Errorf("Wrong name: %s", plug.GetPluginName())
@@ -356,7 +356,7 @@ func TestUnsupportedVolumeHost(t *testing.T) {
plug, err := plugMgr.FindPluginByName("kubernetes.io/gce-pd")
if err != nil {
t.Errorf("Can't find the plugin by name")
t.Fatal("Can't find the plugin by name")
}
_, err = plug.ConstructVolumeSpec("", "")