Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change thresholds-error verb from breach to cross #3099

Merged
merged 1 commit into from
May 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,14 @@ func (c *cmdRun) run(cmd *cobra.Command, args []string) (err error) {
}
tErr := errext.WithAbortReasonIfNone(
errext.WithExitCodeIfNone(
fmt.Errorf("thresholds on metrics '%s' have been breached", strings.Join(breachedThresholds, ", ")),
fmt.Errorf("thresholds on metrics '%s' have been crossed", strings.Join(breachedThresholds, ", ")),
exitcodes.ThresholdsHaveFailed,
), errext.AbortedByThresholdsAfterTestEnd)

if err == nil {
err = tErr
} else {
logger.WithError(tErr).Debug("Breached thresholds, but test already exited with another error")
logger.WithError(tErr).Debug("Crossed thresholds, but test already exited with another error")
}
}
if finalizeThresholds != nil {
Expand Down
4 changes: 2 additions & 2 deletions cmd/tests/cmd_run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ func TestThresholdsFailed(t *testing.T) {
)
cmd.ExecuteWithGlobalState(ts.GlobalState)

expErr := "thresholds on metrics 'iterations{scenario:sc1}, iterations{scenario:sc2}' have been breached"
expErr := "thresholds on metrics 'iterations{scenario:sc1}, iterations{scenario:sc2}' have been crossed"
assert.True(t, testutils.LogContains(ts.LoggerHook.Drain(), logrus.ErrorLevel, expErr))
stdout := ts.Stdout.String()
t.Log(stdout)
Expand Down Expand Up @@ -697,7 +697,7 @@ func TestAbortedByThreshold(t *testing.T) {
)
cmd.ExecuteWithGlobalState(ts.GlobalState)

expErr := "thresholds on metrics 'iterations' were breached; at least one has abortOnFail enabled, stopping test prematurely"
expErr := "thresholds on metrics 'iterations' were crossed; at least one has abortOnFail enabled, stopping test prematurely"
assert.True(t, testutils.LogContains(ts.LoggerHook.Drain(), logrus.ErrorLevel, expErr))
stdOut := ts.Stdout.String()
t.Log(stdOut)
Expand Down
4 changes: 2 additions & 2 deletions metrics/engine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func (me *MetricsEngine) StartThresholdCalculations(
breached, shouldAbort := me.evaluateThresholds(true, getCurrentTestRunDuration)
if shouldAbort {
err := fmt.Errorf(
"thresholds on metrics '%s' were breached; at least one has abortOnFail enabled, stopping test prematurely",
"thresholds on metrics '%s' were crossed; at least one has abortOnFail enabled, stopping test prematurely",
strings.Join(breached, ", "),
)
me.logger.Debug(err.Error())
Expand Down Expand Up @@ -257,7 +257,7 @@ func (me *MetricsEngine) evaluateThresholds(
}
if len(breachedThresholds) > 0 {
sort.Strings(breachedThresholds)
me.logger.Debugf("Thresholds on %d metrics breached: %v", len(breachedThresholds), breachedThresholds)
me.logger.Debugf("Thresholds on %d metrics crossed: %v", len(breachedThresholds), breachedThresholds)
}
atomic.StoreUint32(&me.breachedThresholdsCount, uint32(len(breachedThresholds)))
return breachedThresholds, shouldAbort
Expand Down