mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-05 07:49:37 +08:00
fix: data race
This commit is contained in:
@@ -289,6 +289,9 @@ func (b *HRPBoomer) convertBoomerTask(testcase *TestCase, rendezvousList []*Rend
|
||||
// reset start time only once
|
||||
once := sync.Once{}
|
||||
|
||||
// update session variables mutex
|
||||
mutex := sync.Mutex{}
|
||||
|
||||
return &boomer.Task{
|
||||
Name: testcase.Config.Name,
|
||||
Weight: testcase.Config.Weight,
|
||||
@@ -299,9 +302,11 @@ func (b *HRPBoomer) convertBoomerTask(testcase *TestCase, rendezvousList []*Rend
|
||||
// init session runner
|
||||
sessionRunner := caseRunner.newSession()
|
||||
|
||||
mutex.Lock()
|
||||
if parametersIterator.HasNext() {
|
||||
sessionRunner.updateSessionVariables(parametersIterator.Next())
|
||||
}
|
||||
mutex.Unlock()
|
||||
|
||||
startTime := time.Now()
|
||||
for _, step := range testcase.TestSteps {
|
||||
|
||||
@@ -281,7 +281,7 @@ func (r *HRPRunner) newCaseRunner(testcase *TestCase) (*testCaseRunner, error) {
|
||||
timeout := time.Duration(runner.testCase.Config.Timeout*1000) * time.Millisecond
|
||||
runner.hrpRunner.SetTimeout(timeout)
|
||||
}
|
||||
if plugin.Path() != "" {
|
||||
if plugin != nil {
|
||||
pluginContent, err := builtin.ReadFile(plugin.Path())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user