Merge pull request #23627 from alrs/fix-backend-remote-state-dropped-test-errs

Fix backend remote state dropped test errors
This commit is contained in:
Pam Selle 2019-12-12 15:21:29 -05:00 committed by GitHub
commit 41675543c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 9 deletions

View File

@ -26,7 +26,7 @@ func TestHTTPClient(t *testing.T) {
url, err := url.Parse(ts.URL) url, err := url.Parse(ts.URL)
if err != nil { if err != nil {
t.Fatalf("err: %s", err) t.Fatalf("Parse: %s", err)
} }
// Test basic get/update // Test basic get/update
@ -73,6 +73,10 @@ func TestHTTPClient(t *testing.T) {
UpdateMethod: "PUT", UpdateMethod: "PUT",
Client: retryablehttp.NewClient(), Client: retryablehttp.NewClient(),
} }
if err != nil {
t.Fatalf("Parse: %s", err)
}
remote.TestClient(t, client) // first time through: 201 remote.TestClient(t, client) // first time through: 201
remote.TestClient(t, client) // second time, with identical data: 204 remote.TestClient(t, client) // second time, with identical data: 204
@ -83,18 +87,13 @@ func TestHTTPClient(t *testing.T) {
defer ts.Close() defer ts.Close()
url, err = url.Parse(ts.URL) url, err = url.Parse(ts.URL)
if err != nil {
t.Fatalf("Parse: %s", err)
}
client = &httpClient{URL: url, Client: retryablehttp.NewClient()} client = &httpClient{URL: url, Client: retryablehttp.NewClient()}
remote.TestClient(t, client) remote.TestClient(t, client)
} }
func assertError(t *testing.T, err error, expected string) {
if err == nil {
t.Fatalf("Expected empty config to err")
} else if err.Error() != expected {
t.Fatalf("Expected err.Error() to be \"%s\", got \"%s\"", expected, err.Error())
}
}
type testHTTPHandler struct { type testHTTPHandler struct {
Data []byte Data []byte
Locked bool Locked bool