fix: copy testcase

This commit is contained in:
lilong.129
2024-08-20 23:37:49 +08:00
parent 1accd04a4b
commit 6b409ce649
+2 -2
View File
@@ -61,7 +61,7 @@ func (s *StepTestCaseWithOptionalArgs) Run(r *SessionRunner) (stepResult *StepRe
stepTestCase := s.step.TestCase.(*TestCase) stepTestCase := s.step.TestCase.(*TestCase)
// copy testcase to avoid data racing // copy testcase to avoid data racing
copiedTestCase := TestCase{} copiedTestCase := &TestCase{}
if err := copier.Copy(copiedTestCase, stepTestCase); err != nil { if err := copier.Copy(copiedTestCase, stepTestCase); err != nil {
log.Error().Err(err).Msg("copy step testcase failed") log.Error().Err(err).Msg("copy step testcase failed")
return stepResult, err return stepResult, err
@@ -75,7 +75,7 @@ func (s *StepTestCaseWithOptionalArgs) Run(r *SessionRunner) (stepResult *StepRe
// merge & override extractors // merge & override extractors
copiedTestCase.Config.Export = mergeSlices(s.step.Export, copiedTestCase.Config.Export) copiedTestCase.Config.Export = mergeSlices(s.step.Export, copiedTestCase.Config.Export)
caseRunner, err := r.caseRunner.hrpRunner.NewCaseRunner(copiedTestCase) caseRunner, err := r.caseRunner.hrpRunner.NewCaseRunner(*copiedTestCase)
if err != nil { if err != nil {
log.Error().Err(err).Msg("create case runner failed") log.Error().Err(err).Msg("create case runner failed")
return stepResult, err return stepResult, err