mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-07 08:49:37 +08:00
fix: failed to parse testcase config while load testing
This commit is contained in:
@@ -95,27 +95,27 @@ func (b *HRPBoomer) convertBoomerTask(testcase *TestCase, rendezvousList []*Rend
|
|||||||
Name: config.Name,
|
Name: config.Name,
|
||||||
Weight: config.Weight,
|
Weight: config.Weight,
|
||||||
Fn: func() {
|
Fn: func() {
|
||||||
sessionRunner := hrpRunner.NewSessionRunner(testcase)
|
sessionTestCase := &TestCase{}
|
||||||
|
// copy testcase to avoid data racing
|
||||||
|
if err := copier.Copy(sessionTestCase, testcase); err != nil {
|
||||||
|
log.Error().Err(err).Msg("copy testcase data failed")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
sessionRunner := hrpRunner.NewSessionRunner(sessionTestCase)
|
||||||
sessionRunner.parser.plugin = plugin
|
sessionRunner.parser.plugin = plugin
|
||||||
|
|
||||||
testcaseSuccess := true // flag whole testcase result
|
testcaseSuccess := true // flag whole testcase result
|
||||||
var transactionSuccess = true // flag current transaction result
|
var transactionSuccess = true // flag current transaction result
|
||||||
|
|
||||||
cfg := testcase.Config
|
cfg := sessionTestCase.Config
|
||||||
caseConfig := &TConfig{}
|
|
||||||
// copy config to avoid data racing
|
|
||||||
if err := copier.Copy(caseConfig, cfg); err != nil {
|
|
||||||
log.Error().Err(err).Msg("copy config data failed")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// iterate through all parameter iterators and update case variables
|
// iterate through all parameter iterators and update case variables
|
||||||
for _, it := range caseConfig.ParametersSetting.Iterators {
|
for _, it := range cfg.ParametersSetting.Iterators {
|
||||||
if it.HasNext() {
|
if it.HasNext() {
|
||||||
caseConfig.Variables = mergeVariables(it.Next(), caseConfig.Variables)
|
cfg.Variables = mergeVariables(it.Next(), cfg.Variables)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := sessionRunner.parseConfig(caseConfig); err != nil {
|
if err := sessionRunner.parseConfig(cfg); err != nil {
|
||||||
log.Error().Err(err).Msg("parse config failed")
|
log.Error().Err(err).Msg("parse config failed")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user