Skip to content

Commit

Permalink
revert spec throttling, it causes race conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
sriv committed Nov 28, 2018
1 parent 714bbe3 commit 7888f9e
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions generator/transform.go
Expand Up @@ -23,7 +23,6 @@ import (
"path/filepath"
"sort"
"strings"
"sync"
"time"

"path"
Expand Down Expand Up @@ -65,31 +64,12 @@ func ToSuiteResult(pRoot string, psr *gm.ProtoSuiteResult) *SuiteResult {
suiteResult.ExecutionStatus = fail
}
suiteResult.SpecResults = make([]*spec, 0)
jobs := make(chan *gm.ProtoSpecResult, 10)
var wg = &sync.WaitGroup{}
results := make(chan *spec)
go func(jobs <-chan *gm.ProtoSpecResult, results chan<- *spec) {
for job := range jobs {
results <- toSpec(job)
}
}(jobs, results)
go func(results <-chan *spec, w *sync.WaitGroup) {
for {
select {
case r := <-results:
w.Done()
suiteResult.SpecResults = append(suiteResult.SpecResults, r)
}
}
}(results, wg)
for _, protoSpecRes := range psr.GetSpecResults() {
wg.Add(1)
jobs <- protoSpecRes
suiteResult.SpecResults = append(suiteResult.SpecResults, toSpec(protoSpecRes))
suiteResult.PassedScenarioCount = suiteResult.PassedScenarioCount + int(protoSpecRes.GetScenarioCount()-protoSpecRes.GetScenarioFailedCount()-protoSpecRes.GetScenarioSkippedCount())
suiteResult.FailedScenarioCount = suiteResult.FailedScenarioCount + int(protoSpecRes.GetScenarioFailedCount())
suiteResult.SkippedScenarioCount = suiteResult.SkippedScenarioCount + int(protoSpecRes.GetScenarioSkippedCount())
}
wg.Wait()
return &suiteResult
}

Expand Down

0 comments on commit 7888f9e

Please sign in to comment.