From ee1f2f04d269269842893d3ec149af52e3802b7c Mon Sep 17 00:00:00 2001 From: Martin Polden Date: Thu, 23 Jan 2025 12:03:36 +0100 Subject: [PATCH] Reduce verbosity of deployment failures --- client/go/internal/cli/cmd/deploy_test.go | 2 +- client/go/internal/cli/cmd/log_test.go | 2 +- client/go/internal/cli/cmd/status_test.go | 8 ++++---- client/go/internal/vespa/target.go | 4 ++-- client/go/internal/vespa/target_cloud.go | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/client/go/internal/cli/cmd/deploy_test.go b/client/go/internal/cli/cmd/deploy_test.go index 1c74c1364ca2..fe3f36a0a9f0 100644 --- a/client/go/internal/cli/cmd/deploy_test.go +++ b/client/go/internal/cli/cmd/deploy_test.go @@ -107,7 +107,7 @@ func TestDeployCloudFastWait(t *testing.T) { httpClient.NextResponseString(200, `ok`) httpClient.NextResponseString(200, `{"active": false, "status": "unsuccesful"}`) require.NotNil(t, cli.Run("deploy", pkgDir)) - assert.Equal(t, stderr.String(), "Error: deployment run 0 not yet complete after waiting up to 3s: aborting wait: deployment failed: run 0 ended with unsuccessful status: unsuccesful\n") + assert.Equal(t, stderr.String(), "Error: deployment failed: run 0 ended with unsuccessful status: unsuccesful\n") assert.True(t, httpClient.Consumed()) // Deployment which is running does not return error diff --git a/client/go/internal/cli/cmd/log_test.go b/client/go/internal/cli/cmd/log_test.go index e8e8a76b988c..9b6ec552f8c2 100644 --- a/client/go/internal/cli/cmd/log_test.go +++ b/client/go/internal/cli/cmd/log_test.go @@ -75,7 +75,7 @@ func TestLogLocalIncompatible(t *testing.T) { cli.httpClient = httpClient assert.NotNil(t, cli.Run("log", "--from", "2021-09-27T10:00:00Z", "--to", "2021-09-27T11:00:00Z")) - assert.Equal(t, `Error: could not retrieve logs: failed to read logs: aborting wait: got status 404 + assert.Equal(t, `Error: could not retrieve logs: failed to read logs: got status 404 Hint: This command requires a newer version of the Vespa platform: platform version is older than required version: 8.358.0 < 8.359.0 `, stderr.String()) } diff --git a/client/go/internal/cli/cmd/status_test.go b/client/go/internal/cli/cmd/status_test.go index 5ccac420c4e4..1529d66e97d6 100644 --- a/client/go/internal/cli/cmd/status_test.go +++ b/client/go/internal/cli/cmd/status_test.go @@ -45,7 +45,7 @@ func TestStatusCommandMultiCluster(t *testing.T) { client.NextStatus(400) // One cluster is unavilable assert.NotNil(t, cli.Run("status")) assert.Equal(t, `Container bar at http://127.0.0.1:8080 is ready -Container foo at http://127.0.0.1:8080 is not ready: unhealthy container foo: status 400 at http://127.0.0.1:8080/status.html: aborting wait: got status 400 +Container foo at http://127.0.0.1:8080 is not ready: unhealthy container foo: status 400 at http://127.0.0.1:8080/status.html: got status 400 `, stdout.String()) assert.Equal(t, "Error: services not ready: foo\n", @@ -66,7 +66,7 @@ func TestStatusCommandMultiClusterWait(t *testing.T) { client.NextStatus(400) assert.NotNil(t, cli.Run("status", "--cluster", "foo", "--wait", "10")) assert.Equal(t, "Waiting up to 10s for cluster discovery...\nWaiting up to 10s for container foo...\n"+ - "Error: unhealthy container foo after waiting up to 10s: status 400 at http://127.0.0.1:8080/status.html: aborting wait: got status 400\n", stderr.String()) + "Error: unhealthy container foo after waiting up to 10s: status 400 at http://127.0.0.1:8080/status.html: got status 400\n", stderr.String()) } func TestStatusCommandWithUrlTarget(t *testing.T) { @@ -154,7 +154,7 @@ func TestStatusCloudDeployment(t *testing.T) { }) assert.NotNil(t, cli.Run("status", "deployment")) assert.Equal(t, `Deployment is still running. See https://console.vespa-cloud.com/tenant/t1/application/a1/dev/instance/i1/job/dev-us-north-1/run/1337 for more details -Warning: deployment run 1337 not yet complete after waiting up to 3s: wait deadline reached +Warning: wait deadline reached Hint: Consider using the --wait flag to increase the wait period Hint: --wait 120 will make this command wait for completion up to 2 minutes `, stderr.String()) @@ -184,7 +184,7 @@ Hint: --wait 120 will make this command wait for completion up to 2 minutes Body: []byte(`{"active": false, "status": "failure"}`), }) assert.NotNil(t, cli.Run("status", "deployment", "42", "-w", "10")) - assert.Equal(t, "Waiting up to 10s for deployment to converge...\nWarning: deployment run 42 not yet complete after waiting up to 10s: aborting wait: deployment failed: run 42 ended with unsuccessful status: failure\n", stderr.String()) + assert.Equal(t, "Waiting up to 10s for deployment to converge...\nWarning: deployment failed: run 42 ended with unsuccessful status: failure\n", stderr.String()) } func isLocalTarget(args []string) bool { diff --git a/client/go/internal/vespa/target.go b/client/go/internal/vespa/target.go index 674bedc9343f..5a1210229cd0 100644 --- a/client/go/internal/vespa/target.go +++ b/client/go/internal/vespa/target.go @@ -337,7 +337,7 @@ func wait(service *Service, okFn responseFunc, reqFn requestFunc, timeout, retry for time.Now().Before(deadline) || loopOnce { response, err = service.Do(reqFn(), 20*time.Second) if errors.Is(err, errAuth) { - return status, fmt.Errorf("aborting wait: %w", err) + return status, err } else if err == nil { status = response.StatusCode body, err := io.ReadAll(response.Body) @@ -347,7 +347,7 @@ func wait(service *Service, okFn responseFunc, reqFn requestFunc, timeout, retry response.Body.Close() ok, err := okFn(status, body) if err != nil { - return status, fmt.Errorf("aborting wait: %w", err) + return status, err } if ok { return status, nil diff --git a/client/go/internal/vespa/target_cloud.go b/client/go/internal/vespa/target_cloud.go index d410a9103eaf..bb90b72ffddd 100644 --- a/client/go/internal/vespa/target_cloud.go +++ b/client/go/internal/vespa/target_cloud.go @@ -259,7 +259,7 @@ func (t *cloudTarget) AwaitDeployment(runID int64, timeout time.Duration) (int64 } _, err = deployServiceWait(t, jobSuccessFunc, requestFunc, timeout, t.retryInterval) if err != nil { - return runID, fmt.Errorf("deployment run %d not yet complete%s: %w", runID, waitDescription(timeout), err) + return runID, err } if !success { return runID, fmt.Errorf("deployment run %d not yet complete%s", runID, waitDescription(timeout))