Skip to content

Commit

Permalink
fix: lock testsuite and sort child testcases (#585)
Browse files Browse the repository at this point in the history
Signed-off-by: Marcin Owsiany <[email protected]>
  • Loading branch information
porridge authored Dec 3, 2024
1 parent d7a702e commit ad3c90f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/report/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,15 @@ func (ts *Testsuite) AddTestcase(testcase *Testcase) {
// this is needed to calc elapse time of testsuite in a async work
testcase.end = time.Now()
elapsed := time.Since(testcase.Timestamp)
ts.lock.Lock()
defer ts.lock.Unlock()
testcase.Time = fmt.Sprintf("%.3f", elapsed.Seconds())
testcase.Classname = filepath.Base(ts.Name)

ts.Testcases = append(ts.Testcases, testcase)
sort.Slice(ts.Testcases, func(i, j int) bool {
return ts.Testcases[i].Name < ts.Testcases[j].Name
})
ts.Tests++
if testcase.Failure != nil {
ts.Failures++
Expand Down

0 comments on commit ad3c90f

Please sign in to comment.