From dfab9bf560145299ad91e10a396c4e748b3f03bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Miri=C4=87?= Date: Wed, 15 Dec 2021 17:05:40 +0100 Subject: [PATCH] Set RunStatus to AbortedUser when test.abort() is called See https://github.com/grafana/k6/pull/2093#pullrequestreview-829915711 --- core/engine.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/engine.go b/core/engine.go index df61f5a2380..599421e187c 100644 --- a/core/engine.go +++ b/core/engine.go @@ -31,6 +31,7 @@ import ( "gopkg.in/guregu/null.v3" "go.k6.io/k6/errext" + "go.k6.io/k6/js/common" "go.k6.io/k6/lib" "go.k6.io/k6/lib/metrics" "go.k6.io/k6/output" @@ -263,9 +264,12 @@ func (e *Engine) startBackgroundProcesses( if err != nil { e.logger.WithError(err).Debug("run: execution scheduler returned an error") var serr errext.Exception - if errors.As(err, &serr) { + switch { + case errors.As(err, &serr): e.setRunStatus(lib.RunStatusAbortedScriptError) - } else { + case common.IsInterruptError(err): + e.setRunStatus(lib.RunStatusAbortedUser) + default: e.setRunStatus(lib.RunStatusAbortedSystem) } } else {