MCPcopy
hub / github.com/grafana/k6 / runAll

Method runAll

metrics/thresholds.go:145–166  ·  view source on GitHub ↗
(timeSpentInTest time.Duration)

Source from the content-addressed store, hash-verified

143}
144
145func (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

Callers 2

RunMethod · 0.95
TestThresholdsRunAllFunction · 0.95

Calls 3

DurationTypeAlias · 0.92
ErrorfMethod · 0.80
runMethod · 0.65

Tested by 1

TestThresholdsRunAllFunction · 0.76