(params []testRunParams, ctx plugin.ExecutionContext, logger log.Logger)
| 131 | } |
| 132 | |
| 133 | func (c TestRunCommand) executeAll(params []testRunParams, ctx plugin.ExecutionContext, logger log.Logger) ([]testRunStatus, error) { |
| 134 | statusChannel := make(chan testRunStatus) |
| 135 | var wg sync.WaitGroup |
| 136 | for _, p := range params { |
| 137 | wg.Add(1) |
| 138 | go c.execute(p, ctx, p.Logger, &wg, statusChannel) |
| 139 | } |
| 140 | |
| 141 | go func() { |
| 142 | wg.Wait() |
| 143 | close(statusChannel) |
| 144 | }() |
| 145 | |
| 146 | var progressBar *visualization.ProgressBar |
| 147 | if !ctx.Debug { |
| 148 | progressBar = visualization.NewProgressBar(logger) |
| 149 | defer progressBar.Remove() |
| 150 | } |
| 151 | once := sync.Once{} |
| 152 | progress := c.showPackagingProgress(progressBar) |
| 153 | defer once.Do(func() { close(progress) }) |
| 154 | |
| 155 | status := make([]testRunStatus, len(params)) |
| 156 | for s := range statusChannel { |
| 157 | once.Do(func() { close(progress) }) |
| 158 | status[s.ExecutionId] = s |
| 159 | c.updateProgressBar(progressBar, status) |
| 160 | } |
| 161 | |
| 162 | results := []testRunStatus{} |
| 163 | for _, s := range status { |
| 164 | if s.Err != nil { |
| 165 | return nil, s.Err |
| 166 | } |
| 167 | results = append(results, s) |
| 168 | } |
| 169 | return results, nil |
| 170 | } |
| 171 | |
| 172 | func (c TestRunCommand) updateProgressBar(progressBar *visualization.ProgressBar, status []testRunStatus) { |
| 173 | if progressBar == nil { |
no test coverage detected