Skip to content

Commit

Permalink
fix panic when overriding config settings of a test that has no config
Browse files Browse the repository at this point in the history
  • Loading branch information
pk910 committed Mar 9, 2024
1 parent 9a891e8 commit f3d320d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pkg/coordinator/test/descriptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,22 @@ func LoadExternalTestConfig(ctx context.Context, globalVars types.Variables, ext
}

decoder := yaml.NewDecoder(reader)
testConfig := &types.TestConfig{
Config: map[string]interface{}{},
ConfigVars: map[string]string{},
}
testConfig := &types.TestConfig{}
testVars := vars.NewVariables(nil)

err := decoder.Decode(testConfig)
if err != nil {
return nil, nil, fmt.Errorf("error decoding external test config %v: %v", extTestCfg.File, err)
}

if testConfig.Config == nil {
testConfig.Config = map[string]interface{}{}
}

if testConfig.ConfigVars == nil {
testConfig.ConfigVars = map[string]string{}
}

for k, v := range testConfig.Config {
testVars.SetVar(k, v)
}
Expand Down

0 comments on commit f3d320d

Please sign in to comment.