Example #1
0
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, logger.NewParallelLogger(i+1))
	}
	suiteResults := make([]*result.SuiteResult, 0)
	for _, _ = range specCollections {
		suiteResults = append(suiteResults, <-suiteResultChannel)
	}
	return suiteResults
}
Example #2
0
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, logger.NewParallelLogger(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
}
Example #3
0
func (e *parallelSpecExecution) start() *result.SuiteResult {
	startTime := time.Now()
	specCollections := filter.DistributeSpecs(e.specifications, e.numberOfExecutionStreams)
	suiteResultChannel := make(chan *result.SuiteResult, len(specCollections))
	for i, specCollection := range specCollections {
		go e.startSpecsExecution(specCollection, suiteResultChannel, nil, logger.NewParallelLogger(i+1))
	}
	e.logger.Info("Executing in %s parallel streams.", strconv.Itoa(len(specCollections)))
	suiteResults := make([]*result.SuiteResult, 0)
	for _, _ = range specCollections {
		suiteResults = append(suiteResults, <-suiteResultChannel)
	}

	e.aggregateResult = e.aggregateResults(suiteResults)
	e.aggregateResult.Timestamp = startTime.Format(config.LayoutForTimeStamp)
	e.aggregateResult.ProjectName = filepath.Base(config.ProjectRoot)
	e.aggregateResult.Environment = env.CurrentEnv
	e.aggregateResult.Tags = ExecuteTags
	e.aggregateResult.ExecutionTime = int64(time.Since(startTime) / 1e6)
	return e.aggregateResult
}