From 1d9d3c0b16a92b64e50ecbd2ee339377e5e396df Mon Sep 17 00:00:00 2001 From: Eno Compton Date: Wed, 22 May 2024 10:03:17 -0600 Subject: [PATCH] chore: make short tests faster (#810) 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. --- internal/mock/sqladmin.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/mock/sqladmin.go b/internal/mock/sqladmin.go index 26cf3459..9913d4e6 100644 --- a/internal/mock/sqladmin.go +++ b/internal/mock/sqladmin.go @@ -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))) },