| 143 | } |
| 144 | |
| 145 | func (ts *Thresholds) runAll(timeSpentInTest time.Duration) (bool, error) { |
| 146 | succeeded := true |
| 147 | for i, threshold := range ts.Thresholds { |
| 148 | b, err := threshold.run(ts.sinked) |
| 149 | if err != nil { |
| 150 | return false, fmt.Errorf("threshold %d run error: %w", i, err) |
| 151 | } |
| 152 | |
| 153 | if !b { |
| 154 | succeeded = false |
| 155 | |
| 156 | if ts.Abort || !threshold.AbortOnFail { |
| 157 | continue |
| 158 | } |
| 159 | |
| 160 | ts.Abort = !threshold.AbortGracePeriod.Valid || |
| 161 | threshold.AbortGracePeriod.Duration < types.Duration(timeSpentInTest) |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | return succeeded, nil |
| 166 | } |
| 167 | |
| 168 | // Run processes all the thresholds with the provided Sink at the provided time and returns if any |
| 169 | // of them fails |