Skip to content

Commit

Permalink
Fix slowest tests (#2276)
Browse files Browse the repository at this point in the history
Avoid lengthy sleep retries. Lower cancellation delay.

Fixes #2255
  • Loading branch information
weikanglim committed May 22, 2023
1 parent f0022df commit ed2244c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cli/azd/pkg/azsdk/zip_deploy_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func registerPollingErrorMocks(mockContext *mocks.MockContext) {
errorStatus := DeployStatusResponse{
DeployStatus: DeployStatus{
Id: "ID",
Status: http.StatusInternalServerError,
Status: http.StatusBadRequest,
StatusText: "Error",
Message: "Bad deploy package",
Progress: nil,
Expand All @@ -172,6 +172,6 @@ func registerPollingErrorMocks(mockContext *mocks.MockContext) {
},
}

return mocks.CreateHttpResponseWithBody(request, http.StatusInternalServerError, errorStatus)
return mocks.CreateHttpResponseWithBody(request, http.StatusBadRequest, errorStatus)
})
}
3 changes: 1 addition & 2 deletions cli/azd/pkg/exec/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestRunCommand(t *testing.T) {
}

func TestKillCommand(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
defer cancel()

s := time.Now()
Expand All @@ -69,7 +69,6 @@ func TestKillCommand(t *testing.T) {
// what we're sleeping on in the powershell)
since := time.Since(s)
require.LessOrEqual(t, since, 10*time.Second)
require.GreaterOrEqual(t, since, 1*time.Second)
}

func TestAppendEnv(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cli/azd/test/mocks/mockgraphsdk/mocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

func CreateGraphClient(mockContext *mocks.MockContext) (*graphsdk.GraphClient, error) {
clientOptions := CreateDefaultClientOptions(mockContext)

clientOptions.Retry.RetryDelay = -1
return graphsdk.NewGraphClient(mockContext.Credentials, clientOptions)
}

Expand Down

0 comments on commit ed2244c

Please sign in to comment.