From 37cd20b4b3ee440561cde0c16716bb4c6048955b Mon Sep 17 00:00:00 2001 From: Mihail Stoykov <312246+mstoykov@users.noreply.github.com> Date: Tue, 7 Mar 2023 12:12:28 +0200 Subject: [PATCH] Reference 'k6 cloud' instead of 'Load Impact' in docs and errors (#2942) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ivan Mirić --- cloudapi/client.go | 9 +++++---- cloudapi/config.go | 2 +- cloudapi/errors.go | 6 +++--- cmd/login_cloud.go | 4 ++-- cmd/run.go | 4 ++-- output/cloud/output.go | 4 ++-- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/cloudapi/client.go b/cloudapi/client.go index 59d87a8ec65..547b9923146 100644 --- a/cloudapi/client.go +++ b/cloudapi/client.go @@ -23,7 +23,7 @@ const ( k6IdempotencyKeyHeader = "k6-Idempotency-Key" ) -// Client handles communication with Load Impact cloud API. +// Client handles communication with the k6 Cloud API. type Client struct { client *http.Client token string @@ -160,7 +160,7 @@ func (c *Client) do(req *http.Request, v interface{}, attempt int) (retry bool, func checkResponse(r *http.Response) error { if r == nil { - return ErrUnknown + return errUnknown } if c := r.StatusCode; c >= 200 && c <= 299 { @@ -177,10 +177,10 @@ func checkResponse(r *http.Response) error { } if err := json.Unmarshal(data, &payload); err != nil { if r.StatusCode == http.StatusUnauthorized { - return ErrNotAuthenticated + return errNotAuthenticated } if r.StatusCode == http.StatusForbidden { - return ErrNotAuthorized + return errNotAuthorized } return fmt.Errorf( "unexpected HTTP error from %s: %d %s", @@ -220,6 +220,7 @@ func shouldAddIdempotencyKey(req *http.Request) bool { // randomStrHex returns a hex string which can be used // for session token id or idempotency key. +// //nolint:gosec func randomStrHex() string { // 16 hex characters diff --git a/cloudapi/config.go b/cloudapi/config.go index 7f9e5c617b0..2e0ca2bb34d 100644 --- a/cloudapi/config.go +++ b/cloudapi/config.go @@ -10,7 +10,7 @@ import ( "go.k6.io/k6/lib/types" ) -// Config holds all the necessary data and options for sending metrics to the Load Impact cloud. +// Config holds all the necessary data and options for sending metrics to the k6 Cloud. // //nolint:lll type Config struct { diff --git a/cloudapi/errors.go b/cloudapi/errors.go index 56216dc1b1f..3aabccd9fe6 100644 --- a/cloudapi/errors.go +++ b/cloudapi/errors.go @@ -8,9 +8,9 @@ import ( ) var ( - ErrNotAuthorized = errors.New("Not allowed to upload result to Load Impact cloud") - ErrNotAuthenticated = errors.New("Failed to authenticate with Load Impact cloud") - ErrUnknown = errors.New("An error occurred talking to Load Impact cloud") + errNotAuthorized = errors.New("not allowed to upload result to k6 Cloud") + errNotAuthenticated = errors.New("failed to authenticate with k6 Cloud") + errUnknown = errors.New("an error occurred communicating with k6 Cloud") ) // ErrorResponse represents an error cause by talking to the API diff --git a/cmd/login_cloud.go b/cmd/login_cloud.go index 8dc4fc890df..3586dea8551 100644 --- a/cmd/login_cloud.go +++ b/cmd/login_cloud.go @@ -32,8 +32,8 @@ func getCmdLoginCloud(gs *state.GlobalState) *cobra.Command { loginCloudCommand := &cobra.Command{ Use: "cloud", - Short: "Authenticate with Load Impact", - Long: `Authenticate with Load Impact. + Short: "Authenticate with k6 Cloud", + Long: `Authenticate with k6 Cloud", This will set the default token used when just "k6 run -o cloud" is passed.`, Example: exampleText, diff --git a/cmd/run.go b/cmd/run.go index 5c4452540d6..1a99661b6c2 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -373,8 +373,8 @@ func getCmdRun(gs *state.GlobalState) *cobra.Command { runCmd := &cobra.Command{ Use: "run", - Short: "Start a load test", - Long: `Start a load test. + Short: "Start a test", + Long: `Start a test. This also exposes a REST API to interact with it. Various k6 subcommands offer a commandline interface for interacting with it.`, diff --git a/output/cloud/output.go b/output/cloud/output.go index aa0267d7a42..16658eae9eb 100644 --- a/output/cloud/output.go +++ b/output/cloud/output.go @@ -25,10 +25,10 @@ import ( "go.k6.io/k6/metrics" ) -// TestName is the default Load Impact Cloud test name +// TestName is the default k6 Cloud test name const TestName = "k6 test" -// Output sends result data to the Load Impact cloud service. +// Output sends result data to the k6 Cloud service. type Output struct { config cloudapi.Config referenceID string