need to use local variable so that pluginNameToConfig map can keep correct contents

because the type of PluginConfig.Args is not pointer.

It also fixed framework_test so that it can test PluginConfig initialization.
This commit is contained in:
Shingo Omura
2019-09-09 14:13:15 +09:00
parent 35cf6b6cbc
commit 439a6825e7
2 changed files with 127 additions and 66 deletions

View File

@@ -582,7 +582,9 @@ func (f *framework) GetWaitingPod(uid types.UID) WaitingPod {
func pluginNameToConfig(args []config.PluginConfig) map[string]*runtime.Unknown {
pc := make(map[string]*runtime.Unknown, 0)
for _, p := range args {
for i := range args {
// This is needed because the type of PluginConfig.Args is not pointer type.
p := args[i]
pc[p.Name] = &p.Args
}
return pc