Skip to content

Commit

Permalink
SCALRCORE-26173 - Terraform provider > clients > handle rate limit, f…
Browse files Browse the repository at this point in the history
…ix tests
  • Loading branch information
soltysss committed Jun 13, 2023
1 parent 6822e5d commit df3ba0d
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions scalr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"io/ioutil"
"net/http"
"net/http/httptest"
"net/url"
"os"
"testing"
)
Expand Down Expand Up @@ -190,26 +191,38 @@ func TestClient_retryHTTPCheck(t *testing.T) {
checkErr error
}{
"429-no-server-errors": {
resp: &http.Response{StatusCode: 429},
resp: &http.Response{
StatusCode: 429,
Request: &http.Request{URL: &url.URL{Host: "scalr.test", Path: "/test/thing"}},
},
err: nil,
checkOK: true,
checkErr: nil,
},
"429-with-server-errors": {
resp: &http.Response{StatusCode: 429},
resp: &http.Response{
StatusCode: 429,
Request: &http.Request{URL: &url.URL{Host: "scalr.test", Path: "/test/thing"}},
},
err: nil,
retryServerErrors: true,
checkOK: true,
checkErr: nil,
},
"500-no-server-errors": {
resp: &http.Response{StatusCode: 500},
resp: &http.Response{
StatusCode: 500,
Request: &http.Request{URL: &url.URL{Host: "scalr.test", Path: "/test/thing"}},
},
err: nil,
checkOK: false,
checkErr: nil,
},
"500-with-server-errors": {
resp: &http.Response{StatusCode: 500},
resp: &http.Response{
StatusCode: 500,
Request: &http.Request{URL: &url.URL{Host: "scalr.test", Path: "/test/thing"}},
},
err: nil,
retryServerErrors: true,
checkOK: true,
Expand Down

0 comments on commit df3ba0d

Please sign in to comment.