Skip to content

Commit c103fac

Browse files
committed
Refined the unautheticated error on cloud run
1 parent 2e28992 commit c103fac

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

internal/cmd/cloud.go

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,10 @@ import (
3131
// Grafana Cloud without being logged in or having a valid token.
3232
//
3333
//nolint:staticcheck // the error is shown to the user so here punctuation and capital are required
34-
var errUserUnauthenticated = errors.New("To run tests in Grafana Cloud, you must first authenticate." +
35-
" Run the `k6 cloud login` command, or check the docs" +
34+
var errUserUnauthenticated = errors.New("You must first authenticate to run tests in Grafana Cloud." +
35+
" Run the `k6 cloud login` command providing the stack and token, or check the docs" +
3636
" https://grafana.com/docs/grafana-cloud/testing/k6/author-run/tokens-and-cli-authentication" +
37-
" for additional authentication methods.")
38-
39-
// errStackNotConfigured represents a configuration error when trying to run
40-
// Grafana Cloud tests without a stack being configured.
41-
//
42-
//nolint:staticcheck // the error is shown to the user so here punctuation and capital are required
43-
var errStackNotConfigured = errors.New(
44-
"To run tests in Grafana Cloud, a stack must be configured." +
45-
" Run `k6 cloud login --stack <url-or-slug>` to set your default stack," +
46-
" or set the K6_CLOUD_STACK_ID environment variable.")
37+
" for additional methods.")
4738

4839
// checkCloudLogin verifies that both a token and a stack are configured.
4940
// Together they represent a complete Grafana Cloud login.
@@ -52,7 +43,7 @@ func checkCloudLogin(conf cloudapi.Config) error {
5243
return errUserUnauthenticated
5344
}
5445
if !conf.StackID.Valid || conf.StackID.Int64 == 0 {
55-
return errStackNotConfigured
46+
return errUserUnauthenticated
5647
}
5748
return nil
5849
}

0 commit comments

Comments
 (0)