func (e *parallelExecution) executeLazily(totalStreams int, resChan chan *result.SuiteResult) { e.wg.Add(totalStreams) for i := 0; i < totalStreams; i++ { go e.startStream(e.specCollection, reporter.NewParallelConsole(i+1), resChan) } e.wg.Wait() close(resChan) }
func (e *parallelExecution) executeEagerly(distributions int, resChan chan *result.SuiteResult) { specs := filter.DistributeSpecs(e.specCollection.Specs(), distributions) e.wg.Add(distributions) for i, s := range specs { go e.startSpecsExecution(s, reporter.NewParallelConsole(i+1), resChan) } e.wg.Wait() close(resChan) }
func (e *parallelSpecExecution) eagerExecution(distributions int) []*result.SuiteResult { specCollections := filter.DistributeSpecs(e.specifications, distributions) suiteResultChannel := make(chan *result.SuiteResult, len(specCollections)) for i, specCollection := range specCollections { go e.startSpecsExecution(specCollection, suiteResultChannel, reporter.NewParallelConsole(i+1)) } suiteResults := make([]*result.SuiteResult, 0) for _, _ = range specCollections { suiteResults = append(suiteResults, <-suiteResultChannel) } return suiteResults }
func (e *parallelExecution) lazyExecution(totalStreams int) []*result.SuiteResult { suiteResultChannel := make(chan *result.SuiteResult, e.specStore.size()) e.wg.Add(totalStreams) for i := 0; i < totalStreams; i++ { go e.startStream(e.specStore, reporter.NewParallelConsole(i+1), suiteResultChannel) } e.wg.Wait() var suiteResults []*result.SuiteResult for i := 0; i < totalStreams; i++ { suiteResults = append(suiteResults, <-suiteResultChannel) } close(suiteResultChannel) return suiteResults }
func (e *parallelSpecExecution) lazyExecution(totalStreams int) []*result.SuiteResult { allSpecs := &specList{} for _, spec := range e.specifications { allSpecs.specs = append(allSpecs.specs, spec) } suiteResultChannel := make(chan *result.SuiteResult, len(e.specifications)) e.wg.Add(totalStreams) for i := 0; i < totalStreams; i++ { go e.startStream(allSpecs, reporter.NewParallelConsole(i+1), suiteResultChannel) } e.wg.Wait() suiteResults := make([]*result.SuiteResult, 0) for i := 0; i < totalStreams; i++ { suiteResults = append(suiteResults, <-suiteResultChannel) } close(suiteResultChannel) return suiteResults }