Skip to content

Commit

Permalink
chore: make short tests faster (#810)
Browse files Browse the repository at this point in the history
The test cases covering failure behavior were all inadvertently using
exponential backoff in test runs, causing unnecessary slowdowns. This
commit disables exponential backoff in tests by having the mock API
server return 400 status codes instead of 501s when a request is not
recognized. As a result, the exponential backoff logic does not trigger.

This change reduces the time taken by ~75% to about ~5s.
  • Loading branch information
enocom authored May 22, 2024
1 parent beb3605 commit 1d9d3c0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/mock/sqladmin.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func httpClient(requests ...*Request) (*http.Client, string, func() error) {
}
}
// Unexpected requests should throw an error
resp.WriteHeader(http.StatusNotImplemented)
resp.WriteHeader(http.StatusBadRequest)
// TODO: follow error format better?
resp.Write([]byte(fmt.Sprintf("unexpected request sent to mock client: %v", req)))
},
Expand Down

0 comments on commit 1d9d3c0

Please sign in to comment.