Skip to content

Commit

Permalink
Reduce verbosity of deployment failures
Browse files Browse the repository at this point in the history
  • Loading branch information
mpolden committed Jan 23, 2025
1 parent 51ba92a commit ee1f2f0
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion client/go/internal/cli/cmd/deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion client/go/internal/cli/cmd/log_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
8 changes: 4 additions & 4 deletions client/go/internal/cli/cmd/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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) {
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions client/go/internal/vespa/target.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion client/go/internal/vespa/target_cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit ee1f2f0

Please sign in to comment.