mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-08 09:19:41 +08:00
fix: avoid data racing
This commit is contained in:
10
runner.go
10
runner.go
@@ -477,8 +477,16 @@ func (r *caseRunner) runStepTestCase(step *TStep) (stepResult *stepData, err err
|
||||
success: false,
|
||||
}
|
||||
testcase := step.TestCase
|
||||
|
||||
// copy testcase to avoid data racing
|
||||
copiedTestCase := &TestCase{}
|
||||
if err = copier.Copy(copiedTestCase, testcase); err != nil {
|
||||
log.Error().Err(err).Msg("copy testcase failed")
|
||||
return nil, err
|
||||
}
|
||||
|
||||
start := time.Now()
|
||||
err = r.hrpRunner.newCaseRunner(testcase).run()
|
||||
err = r.hrpRunner.newCaseRunner(copiedTestCase).run()
|
||||
stepResult.elapsed = time.Since(start).Milliseconds()
|
||||
if err != nil {
|
||||
return stepResult, err
|
||||
|
||||
Reference in New Issue
Block a user