diff --git a/pkg/framework/runner/tests.go b/pkg/framework/runner/tests.go index 6445f2c..d150213 100644 --- a/pkg/framework/runner/tests.go +++ b/pkg/framework/runner/tests.go @@ -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" @@ -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 @@ -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) }