diff --git a/cmd/cloud.go b/cmd/cloud.go index 78e90191e76..f2a29430d37 100644 --- a/cmd/cloud.go +++ b/cmd/cloud.go @@ -317,7 +317,8 @@ func (c *cmdCloud) run(cmd *cobra.Command, args []string) error { // Although by looking at [ResultStatus] and [RunStatus] isn't self-explanatory, // the scenario when the test run has finished, but it failed is an exceptional case for those situations // when thresholds have been crossed (failed). So, we report this situation as such. - if testProgress.RunStatus == cloudapi.RunStatusFinished { + if testProgress.RunStatus == cloudapi.RunStatusFinished || + testProgress.RunStatus == cloudapi.RunStatusAbortedThreshold { return errext.WithExitCodeIfNone(errors.New("Thresholds have been crossed"), exitcodes.ThresholdsHaveFailed) } diff --git a/cmd/tests/cmd_cloud_test.go b/cmd/tests/cmd_cloud_test.go index 45c1dd499cb..69fff4284f6 100644 --- a/cmd/tests/cmd_cloud_test.go +++ b/cmd/tests/cmd_cloud_test.go @@ -257,6 +257,27 @@ func runCloudTests(t *testing.T, setupCmd setupCommandFunc) { t.Log(stdout) assert.Contains(t, stdout, `Thresholds have been crossed`) }) + + t.Run("TestCloudAbortedThreshold", func(t *testing.T) { + t.Parallel() + + progressCallback := func() cloudapi.TestProgressResponse { + return cloudapi.TestProgressResponse{ + RunStatusText: "Finished", + RunStatus: cloudapi.RunStatusAbortedThreshold, + ResultStatus: cloudapi.ResultStatusFailed, + Progress: 1.0, + } + } + ts := getSimpleCloudTestState(t, nil, setupCmd, nil, nil, progressCallback) + ts.ExpectedExitCode = int(exitcodes.ThresholdsHaveFailed) + + cmd.ExecuteWithGlobalState(ts.GlobalState) + + stdout := ts.Stdout.String() + t.Log(stdout) + assert.Contains(t, stdout, `Thresholds have been crossed`) + }) } func cloudTestStartSimple(tb testing.TB, testRunID int) http.Handler {