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

@@ -890,7 +890,7 @@ func TestCanSupport(t *testing.T) {
plugin, err := pluginMgr.FindPluginByName(projectedPluginName)
if err != nil {
t.Errorf("Can't find the plugin by name")
t.Fatal("Can't find the plugin by name")
}
if plugin.GetPluginName() != projectedPluginName {
t.Errorf("Wrong name: %s", plugin.GetPluginName())
@@ -921,7 +921,7 @@ func TestPlugin(t *testing.T) {
plugin, err := pluginMgr.FindPluginByName(projectedPluginName)
if err != nil {
t.Errorf("Can't find the plugin by name")
t.Fatal("Can't find the plugin by name")
}
pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Namespace: testNamespace, UID: testPodUID}}
@@ -986,7 +986,7 @@ func TestInvalidPathProjected(t *testing.T) {
plugin, err := pluginMgr.FindPluginByName(projectedPluginName)
if err != nil {
t.Errorf("Can't find the plugin by name")
t.Fatal("Can't find the plugin by name")
}
pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Namespace: testNamespace, UID: testPodUID}}
@@ -1036,7 +1036,7 @@ func TestPluginReboot(t *testing.T) {
plugin, err := pluginMgr.FindPluginByName(projectedPluginName)
if err != nil {
t.Errorf("Can't find the plugin by name")
t.Fatal("Can't find the plugin by name")
}
pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Namespace: testNamespace, UID: testPodUID}}
@@ -1090,7 +1090,7 @@ func TestPluginOptional(t *testing.T) {
plugin, err := pluginMgr.FindPluginByName(projectedPluginName)
if err != nil {
t.Errorf("Can't find the plugin by name")
t.Fatal("Can't find the plugin by name")
}
pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Namespace: testNamespace, UID: testPodUID}}
@@ -1188,7 +1188,7 @@ func TestPluginOptionalKeys(t *testing.T) {
plugin, err := pluginMgr.FindPluginByName(projectedPluginName)
if err != nil {
t.Errorf("Can't find the plugin by name")
t.Fatal("Can't find the plugin by name")
}
pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Namespace: testNamespace, UID: testPodUID}}