Skip to content

Commit

Permalink
Change thresholds-error verb from breach to cross
Browse files Browse the repository at this point in the history
The word "cross" appears much more frequently with "threshold"
than the word "breach" does.
  • Loading branch information
MattDodsonEnglish authored and imiric committed May 31, 2023
1 parent 25d3da4 commit 0761ba8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
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

0 comments on commit 0761ba8

Please sign in to comment.