Skip to content

Commit

Permalink
Merge pull request #73 from nejtr0n/patch-1
Browse files Browse the repository at this point in the history
Fix data race
  • Loading branch information
koodeex authored Jul 24, 2023
2 parents 9ab0a77 + eba053b commit 97fb94f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/framework/runner/tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"reflect"
"sync"

"github.com/ozontech/allure-go/pkg/allure"
"github.com/ozontech/allure-go/pkg/framework/provider"
Expand All @@ -12,6 +13,7 @@ import (
type suiteResult struct {
Container *allure.Container `json:"container,omitempty"`
TestResults []TestResult `json:"test_results,omitempty"`
mu sync.Mutex
}

// NewSuiteResult Returns new SuiteResult
Expand All @@ -21,6 +23,9 @@ func NewSuiteResult(container *allure.Container) SuiteResult {

// NewResult appends test result to suite result
func (sr *suiteResult) NewResult(result TestResult) {
sr.mu.Lock()
defer sr.mu.Unlock()

sr.TestResults = append(sr.TestResults, result)
}

Expand Down

0 comments on commit 97fb94f

Please sign in to comment.